1
0
Fork 0
mirror of https://github.com/diamondburned/arikawa.git synced 2024-11-01 12:34:28 +00:00
Commit graph

119 commits

Author SHA1 Message Date
diamondburned 65d7b8765b Bot: Allow self-mentions; deprecate SanitizeMessage 2021-02-14 13:14:38 -08:00
diamondburned 74019dc909 Bot: Reply with reference to message 2021-02-14 12:39:39 -08:00
diamondburned d13aa00a57 Bot: Fixed extra space in top-level comments 2021-02-07 17:21:16 -08:00
diamondburned ac2f3ba68a Bot: Close gracefully by default 2021-01-29 23:25:15 -08:00
Dan Anstis da3f728ed4
Bot: Handle iphone style quotes (#182) 2021-01-14 16:23:14 -08:00
diamondburned d9a159d948 Bot: Fixed invalid test breaking 2021-01-05 21:15:38 -08:00
diamondburned e0f051b4c6 Shellwords: Simpler error and implementation 2020-12-19 18:02:31 -08:00
diamondburned 9df396bb7f Bot: Fixed unable to call Plumbed method by command 2020-12-18 15:00:21 -08:00
diamondburned 826b90a5f3 Bot: Start to add IntentGuilds for better caching 2020-12-14 14:54:56 -08:00
diamondburned b801e46760 Bot: Optional command when plumbed in Help, no more extra space 2020-12-14 14:18:04 -08:00
diamondburned 66c95761a7 Bot: Getter for Plumbed and Help generation fix 2020-12-14 13:43:36 -08:00
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