1
0
Fork 0
mirror of https://github.com/diamondburned/arikawa.git synced 2024-08-20 15:24:37 +00:00
Commit graph

685 commits

Author SHA1 Message Date
diamondburned 6ef093eb98 Gateway: Refactor, v8 user struct updates
This commit refactored several structures from package discord to be in
package gateway. Those structures are mostly presence ones, which per
official documentation has a lot more to do with the Gateway API than
the REST API or anything else.

This commit also renamed several global variables to have a more
consistent and obvious name.

As of v8, the user API has had a lot of minor and some major changes,
especially regarding its Ready event API. The most significant change is
the addition of the ReadySupplemental event as well as several changes
to the Ready field itself.

All of these changes above are breaking, and they have already broken
the state package. These breaking changes will be addressed in other
packages by the next commit.
2020-11-28 17:22:03 -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
diamondburned ba1200059c Discord: Fixed regression of unmarshaling Permission in Guild 2020-11-22 15:14:14 -08:00
diamondburned e755ea4260 *: Updated dependencies and dismock CI tests 2020-11-22 15:04:36 -08:00
mavolin b9d7ba4476 Option: fix nullable types getting serialized to nil on JSON null 2020-11-22 09:33:33 -08:00
mavolin fc5d10ced8 Discord: optimize struct sizes; add missing fields 2020-11-22 09:16:24 -08:00
mavolin a616eae7f0 API: rename ServiceX constants to XService 2020-11-22 09:14:07 -08:00
mavolin 0ec646e2a6 Discord: add Discord Service 2020-11-22 09:14:07 -08:00
mavolin da8de00e75 Discord: remove unnecessary option types 2020-11-22 09:14:07 -08:00
mavolin eb528da31d Discord: add missing Integration fields 2020-11-22 09:14:07 -08:00
mavolin a3aa53dcff API: rename Client.GuildVanityURL to Client.GuildVanityInvite 2020-11-21 10:12:12 -08:00
Maximilian von Lindern 1d58ea57fb
Discord: Add missing guild widget methods (#168)
* Discord: cleanup comments

* Discord: differentiate between GuildWidget and GuildWidgetSettings

* Discord: rename GuildImageURL and GuildImage to GuildWidgetURL and GuildWidget

* Discord: add missing guild widget endpoints
2020-11-21 09:40:54 -08:00
mavolin 59d2ac8959 API: fix wrong constants getting used for fetch limits 2020-11-21 08:36:14 -08:00
Maximilian von Lindern d6a45529ad
Discord: Add Sticker (#167)
* Discord: add sticker related types

* Discord: add Sticker field to Message
2020-11-21 08:35:19 -08:00
diamondburned f4635803ee Examples: Added Gateway intents and comments 2020-11-19 12:03:14 -08:00
diamondburned 1dc11549bc Updated README 2020-11-19 12:00:14 -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 8356a8a3f6 Voice: Omit deprecated function in tests 2020-11-18 16:18:15 -08:00
Terra Brown cdc0cfc300
Discord: (*Member).Mention proper format (#164) 2020-11-18 15:55:15 -08:00
diamondburned 6bdac16c2a Voice: Allow custom frame parameters; removed StopSpeaking
This comimt adds a method into the UDP connection to control the
internal frequency ticker which controls the speed of playback. For more
information, refer to (*voice/udp.Connection).ResetFrequency().

StopSpeaking is removed because it no longer works with variable
parameters. The functionality of that method was also arguably useless,
as it only sends silent frames.
2020-11-17 14:43:00 -08:00
diamondburned f4750292eb Voice: Minor concurrency improvements
This commit adds multiple thread safe guards to do better the
concurrency promises. However, it also omits completely those guarantees
in certain places that don't make sense to call concurrently. This is
mostly documented.

This commit also adds a small piece of code to concurrently run things
with the race detector.
2020-11-17 12:15:05 -08:00
diamondburned 1b8af1513e Voice: UDP now thread unsafe for performance
This commit omits thread safe guarantees in the UDP voice connection.
This is done because the UDP connection should not be shared across
threads, so those guarantees are now omitted for performance.

Session will still guard a UDP connection around a read mutex, because
Session itself has thread safe guarantees. This may change in the
future.
2020-11-17 12:15:05 -08:00
diamondburned 81b1a0a902 Session: Added a handleloop abstraction
This abstraction will mainly be in charge of handling events from a
channel and dispatching them to handlers in a thread safe manner. It
boxes synchronizing mechanisms inside a struct.
2020-11-17 12:15:05 -08:00
Tyler Stuyfzand 38fe1fafd0 Voice: Add UserID to SpeakingData 2020-11-17 12:15:05 -08:00
Tyler 59539403b3 Voice: Implement Voice Gateway events
Speaking event patches and support Client Connect/Disconnect events.
2020-11-17 12:15:05 -08:00
diamondburned d1242fc39a Voice: Remove Session from repository before disconnecting
This commit introduces this change so that Voice can be called from
other threads without waiting for one Session to disconnect itself.
2020-11-17 11:01:34 -08:00
diamondburned 364f8388ed State: Fixed a mutex copy 2020-11-17 11:01:34 -08:00
Tyler Stuyfzand de7d7f62a4
Voice: Add UserID to SpeakingData (#161) 2020-11-15 01:37:56 -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 4992f4ab20 API: Fixed incorrect DeleteAllReactions endpoint 2020-11-14 16:32:16 -08:00
diamondburned 1aaa2cbfe2 httputil: Removed debug logs 2020-11-14 15:36:18 -08:00
diamondburned 6cbe95d2b3 State: Fixed erroneous context setting and races in Ready 2020-11-14 15:30:18 -08:00
diamondburned f6e270ae9c json: Fixed a race condition with erroneous JSON streams 2020-11-14 14:18:50 -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 f85aac09be Voice: Added intent adders into constructor 2020-11-12 18:55:05 -08:00
Ethien Duckett 456692da93
API: stay within the boundaries of messageIDs (#160) 2020-11-11 11:07:30 -08:00
Maximilian von Lindern cc1975988d
API: abstract away boundary limits for DeleteMessages (#159)
remove boundary limits for DeleteMessages
rename deleteMessages to deleteMessagesRaw
use constant instead of limit literal
add min helper func
rename utils.go to math.go
2020-11-10 15:34:05 -08:00
mavolin d8ccaf78c3 API: rename SendMessageData.MessageReference to SendMessageData.Reference and fix omit issues 2020-11-03 10:35:45 -08:00
mavolin f9a59ac2e7 Discord: add doc to MessageReference
Add addtiontional type information to MessageReference as found in discord/discord-api-docs#2053
2020-11-03 10:25:57 -08:00
mavolin aff386402f Gateway: remove GuildSubscriptions from IdentifyData
With the requirement of intents on Gateway v8, the guild_subscriptions field has no effect, and is therefore removed
2020-11-03 10:18:04 -08:00
mavolin eb118dc1d6 Discord: add Message.ReferencedMessage and InlinedReplyMessage 2020-11-03 10:14:53 -08:00
mavolin e3c85094a7 API: add MessageReference 2020-11-03 10:14:53 -08:00
mavolin 88258b51c2 replace usage of discordapp.com with discord.com in docs 2020-11-03 10:14:53 -08:00
mavolin 661f96da03 API: add RepliedUser to AllowMentions 2020-11-03 10:14:53 -08:00
mavolin 5716c78d97 API: replace use of whitelist with more inclusive synonyms 2020-11-03 10:14:53 -08:00
diamondburned 0d219428a0 README: Updated badges 2020-11-02 17:32:00 -08:00
diamondburned 615b52de57 Gateway: Added missing GuildCreateEvent handler 2020-11-01 18:58:03 -08:00