api.{Send,Edit}MessageData and their equivalents in package api/webhook
have been updated to add some fields added in Discord API v9.
(webhook.Client).EditMessage now also returns a message, because that
endpoint returns a message on success.
This commit adds the ErrorReplier callback into Context, which allows
the user to implement a custom way to format errors, such as putting
them into an embed.
This commit changes the existing Plumb behavior to allow normal commands
to coexist along a plumbed command. This change allows certain behaviors
that would otherwise require manually switching on arguments.
An example use case of this change would be having a default behavior
when a subcommand call doesn't have a command name. For example, given
this code:
func (b *Banana) Setup(sub *bot.Subcommand) { sub.SetPlumb(b.Help) }
func (b *Banana) Green(*gateway.MessageCreateEvent) {}
func (b *Banana) Help(*gateway.MessageCreateEvent) {}
The subcommand "banana" could have its own help when it's called as
"!banana", while "!banana green" would trigger another handler.
* Rate: don't sleep if sleep exceeds context deadline
* Httputil: add Client.Timeout
* Bot: set default API timeout to 5 minutes
* Rate: reduce calls to time.Now in Acquire
* API: Optimize to use deadline instead of recalculating
Co-authored-by: diamondburned <datutbrus@gmail.com>
This commit adds subcommand aliases as well as additional code in
HelpGenerate to cover for both subcommand and command aliases.
A breaking change is that {,Must}RegisterSubcommandCustom methods are
now replaced with normal {,Must}RegisterSubcommand methods. This is
because they now use variadic strings, which could take 0, 1 or more
arguments.
This commit also allows AddMiddleware and similar methods to be given a
method directly:
sub.Plumb(cmds.PlumbedHandler)
sub.AddMiddleware(cmds.PlumbedHandler, cmds.plumbMiddleware)
This change closes issue #146.
This commit adds automatic Intents detection into package bot. When the
Start function is used, the intents will be OR'd after running the
options callback.
This commit also breaks the old "AddIntent" methods to rename them to
"AddIntents" for correctness.
- Add alias parsing to `Context.findCommand`.
- Add new function to `Subcommand`: `AddAliases` that add new alias(es) to command.
- Added `Aliases` property to `MethodContext`