1
0
Fork 0
mirror of https://github.com/diamondburned/arikawa.git synced 2024-11-05 06:26:08 +00:00
Commit graph

108 commits

Author SHA1 Message Date
diamondburned 29582d6131 Bot: Allow both plumbed and normal commands
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.
2020-11-30 14:26:53 -08:00
diamondburned afc87adbae Bot: Refactored accordingly to State's new Store API 2020-11-29 17:19:59 -08:00
Maximilian von Lindern 0a8b24339b
API: Added timeout if deadline is after rate limit (#173)
* 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>
2020-11-25 12:08:42 -08:00
Maximilian von Lindern 3230916c45
State: don't check store if resource is not tracked through intents (#163)
Partially reviewed; good for the most part.
2020-11-19 10:43:31 -08:00
diamondburned 42724e0b91 Bot: Fixed CustomParser trim not using aliases and plumbs 2020-11-14 22:27:55 -08:00
diamondburned af63bb2e66 Bot: Proper unknown command error punctuations 2020-11-14 22:12:02 -08:00
diamondburned ee9d6b0d4d Bot: clearer subcommand not found error 2020-11-14 22:11:10 -08:00
diamondburned 0932e2903b Bot: Fixed CustomParser arguments still having subcommand 2020-11-14 21:05:31 -08:00
diamondburned 6cbe95d2b3 State: Fixed erroneous context setting and races in Ready 2020-11-14 15:30:18 -08:00
diamondburned 273fcf1418 Bot: Added subcommand aliases and better setup API
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.
2020-11-12 19:02:52 -08:00
diamondburned 9899f6073b Bot: Added automatic Intents detection from handlers
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.
2020-10-28 22:49:18 -07:00
diamondburned 75df94d9f4 *: Migrated Go Modules to v2 2020-10-28 15:39:59 -07:00
diamondburned 64ab8c4f30 Bot: Fixed trailing backticks causing out of bound panic 2020-08-29 22:09:58 -07:00
diamondburned d888a5a7ac Bot: Added better middleware documentation 2020-08-11 17:31:29 -07:00
diamondburned 3db68bcb0e Bot: Allow hanging quotes if command has a custom parser 2020-08-11 13:44:32 -07:00
Maximilian von Lindern 1585797b52 *: Linting and typo fixes (#134)
* Linting and typo fixes

* Linting and typo fixes

* revert comma fix
2020-07-29 16:58:33 -07:00
Maximilian von Lindern 908ef96089 Discord: Uint64 typed Snowflakes (#132)
* Use typed Snowflakes if possible

* Discord: make Snowflakes uint64

* Fix errors that emerged because of new typing
2020-07-29 16:58:33 -07:00
Maximilian von Lindern 78c36f13cd Discord: Rename Snowflake and Timestamp Valid methods (#128)
* Discord: rename Snowflake.Valid() to IsValid()

* Discord: rename Timestamp.Valid() to IsValid()
2020-07-29 16:58:33 -07:00
mavolin ba4b224168 handler: move package from /handler to /utils/handler 2020-07-29 16:58:33 -07:00
Tadeo Kondrak d290b0d01c *: Add typed Snowflake IDs (#122)
This PR closes #120.
2020-07-29 16:58:33 -07:00
diamondburned 56b1a7cce8 Bot: Help generators now allow generating hidden commands 2020-07-14 16:33:21 -07:00
diamondburned edb8a46ef2 Gateway: Added intent helpers and more context API support 2020-07-11 12:50:32 -07:00
ks129 93fbfd98d0 Fix aliases appending
Add 3 dots on appending to merge 2 slices.
2020-05-24 23:08:55 -07:00
ks129 23d97044ec Simplify aliases adding
- Removed duplicates check
- Fixed docstring
2020-05-24 23:08:55 -07:00
ks129 75fe1bd03a Implement command aliases
- Add alias parsing to `Context.findCommand`.
- Add new function to `Subcommand`: `AddAliases` that add new alias(es) to command.
- Added `Aliases` property to `MethodContext`
2020-05-24 23:08:55 -07:00
mavolin 41ce1f389e
make all error messages lowercase 2020-05-16 23:14:49 +02:00
diamondburned 795a69ca7d Bot: Added EditableCommands 2020-05-14 18:52:15 -07:00
diamondburned 17c620dd5a Bot: Updated arguments test 2020-05-14 18:07:16 -07:00
diamondburned fe950de9e0 Examples: Fixed up advanced_bot to make it up to date 2020-05-14 18:01:48 -07:00
diamondburned 729979088c Bot: Added more tests and the Help API 2020-05-14 14:04:18 -07:00
diamondburned (Forefront) 6613aa5b41 Bot: Added tests for middlewares 2020-05-14 13:59:17 -07:00
diamondburned (Forefront) e556d2afad Bot: Partially implemented middlewares 2020-05-14 13:59:17 -07:00
diamondburned (Forefront) 67430c6d7a Bot: Added Plumb support, fixed tests
Merged

Merged
2020-05-14 13:59:17 -07:00
diamondburned (Forefront) 9e59402591 Bot: Added tests for middlewares 2020-05-14 13:59:17 -07:00
diamondburned (Forefront) 964e8cdf13 Bot: Partially implemented middlewares 2020-05-14 13:59:17 -07:00
diamondburned (Forefront) c4504808a2 Bot: Updated message URL for arguments 2020-05-14 00:19:51 -07:00
diamondburned (Forefront) 2548b92f1e Bot: Errors can no longer mention others. 2020-05-12 01:02:08 -07:00
diamondburned (Forefront) 85c1326526 Bot: Added ArgsParser for each Context instead of global 2020-05-05 23:23:52 -07:00
diamondburned (Forefront) 7dbdc78d67 Bot: Added package infer for getting IDs from unknown structs 2020-05-05 23:15:25 -07:00
diamondburned (Forefront) d3574c2d7c Bot: Added arguments.Joined 2020-05-04 00:14:11 -07:00
diamondburned (Forefront) 25ecbb0ca5 Bot: Fixed RawArguments, added more tests for that 2020-05-03 23:48:12 -07:00
diamondburned (Forefront) 90bf9d74e3 Bot: Fixed bug where RawArguments still have the command 2020-05-03 22:57:44 -07:00
diamondburned (Forefront) 4a14c4d059 Bot: Allow variadic functions to have empty trailing arguments 2020-05-03 21:22:19 -07:00
diamondburned (Forefront) 6ece6e72ff API: Added 'Raw' which describes that type better 2020-05-03 19:13:58 -07:00
diamondburned (Forefront) be99041a03 Bot: API breakage to indicate changes 2020-05-03 19:12:44 -07:00
diamondburned (Forefront) cf48bd8543 Bot: Variadic arguments are now ellipsized in help 2020-05-03 18:35:51 -07:00
diamondburned (Forefront) b122aa6561 Bot: Added trailing manual parser support 2020-05-03 18:33:24 -07:00
diamondburned (Forefront) 3b903dce68 Bot: Added variadic arguments support 2020-05-03 15:59:10 -07:00
diamondburned (Forefront) 748ad5641c API: Added AllowedMentions and more tests 2020-04-19 16:35:37 -07:00
diamondburned (Forefront) 7905e2138b Fixed tests that broke because of previous breaking change 2020-04-12 16:24:28 -07:00