Add the server's port, whether to use tls or not and the channels to join upon connecting to the config.
Implement the Trigger class to hold info on who invoked a command and where they did it. (+ a neat function for replying)
Rework parts of command invokation for expandability in the future.
Command invocation:
Commands now go through a chain of one or more decorators. The topmost (or only) decorator must be Commands.command to register the command. Each decorator' s wrapper function takes four arguments:
bot: The bot receiving the command. Straightforward enough.
trigger: Trigger object with info on the command sender etc.
words: List of strings, the first of which is the name of the invoked command (with the prefix already stripped). The others are the arguments to the command, wich are seperated by whitespace.
words_eol: List of strings much like words, but including everything from the argument to the end of the line.
Each decorator calls the underlying function with all four arguments (calling the wrapper created by the decorator below) or only bot, trigger if it is the bottommost decorator in the chain (calling the command function directly).
An exception to this will likely be the parametrize decorator, which will, if present, always be at the bottom, calling the command function with bot, trigger followed by the parameters specified.
Changes:
Trigger
class to hold info on who invoked a command and where they did it. (+ a neat function for replying)Command invocation:
Commands now go through a chain of one or more decorators. The topmost (or only) decorator must be
Commands.command
to register the command. Each decorator' s wrapper function takes four arguments:bot
: The bot receiving the command. Straightforward enough.trigger
:Trigger
object with info on the command sender etc.words
: List of strings, the first of which is the name of the invoked command (with the prefix already stripped). The others are the arguments to the command, wich are seperated by whitespace.words_eol
: List of strings much likewords
, but including everything from the argument to the end of the line.The message
!mycommand arg1 arg2
would result in:(if the command prefix is
!
, of course.)Each decorator calls the underlying function with all four arguments (calling the wrapper created by the decorator below) or only
bot, trigger
if it is the bottommost decorator in the chain (calling the command function directly). An exception to this will likely be the parametrize decorator, which will, if present, always be at the bottom, calling the command function withbot, trigger
followed by the parameters specified.