tf2autobot icon indicating copy to clipboard operation
tf2autobot copied to clipboard

feature: custom prefix for steam & discord

Open Tolfx opened this issue 3 years ago • 1 comments

Description

Custom prefix for steam and discord configured in options.json

  • options.miscSettings.prefixes.steam
  • options.miscSettings.prefixes.discord

Changes

  • Updated schema validation for prefixes options
  • Updated logic for custom prefixes
  • Updated all messages with static fixed prefix to custom prefix

To do

  • Update wiki
  • Test cases for safety
    • Tested locally and worked what I could see, but rather new to the system so should test everything to see it works as intended

Extra

Fixes: #1354

Wanted to create %prefix% for messages on bptf.

Tolfx avatar Sep 14 '22 12:09 Tolfx

Thank you for the PR. I will look into this.

idinium96 avatar Sep 17 '22 12:09 idinium96

Interesting to see this. When I was implementing Discord interface from scratch, there were some discussions about differentiating bots by their prefixes, but that time we decided to manage it by differentiating Discord channels bots have access to.

I have some vague ideas about OOP-reworking command interface to make managing commands easier for programmers, as well as moving to slash-commands in Discord. Howewer, your PR might be good for some users for now.

RobotoLev avatar Oct 17 '22 09:10 RobotoLev

Interesting to see this. When I was implementing Discord interface from scratch, there were some discussions about differentiating bots by their prefixes, but that time we decided to manage it by differentiating Discord channels bots have access to.

I have some vague ideas about OOP-reworking command interface to make managing commands easier for programmers, as well as moving to slash-commands in Discord. Howewer, your PR might be good for some users for now.

I thought about making a whole module for commands and extensions for it but I'm selfish and don't need it. But hopefully it will in the future since the current way of handling commands scares me, would be easier to have them into classes and have a CommandHandler containing all the commands.

Tolfx avatar Oct 17 '22 15:10 Tolfx

Wouldn't it be better to refactor the whole command system, using if statements to check what command the user is using is too much bloat code, wouldn't it save more time to create a Command class with a CommandHandler getting our message if it's a command request and find our command in a map/array to which have been cached on bootstrap?

Would be easier to handle issues like this prefix issues because going around finding where ! is used will be too much repeating process, to avoid DRY so to say.

Tolfx avatar Jan 16 '23 10:01 Tolfx

If you're able to do that, sure, but let this PR get merged first, and I'll give you a write permission on the main repository so that you'll be able to create another branch for that.

idinium96 avatar Jan 16 '23 10:01 idinium96