Added more Gateway commands

This commit is contained in:
diamondburned (Forefront) 2020-01-18 14:35:07 -08:00
parent 5babb4d699
commit a82d71ad3c
2 changed files with 23 additions and 7 deletions

View File

@ -49,13 +49,6 @@ library, it is abstracted with an interface, making it possible to implement a
custom remote or local state storage.
- No code generation: just so the library is a lot easier to maintain.
## Roadmap
Things that need to be done before the library can be considered a viable
discordgo replacement.
- [ ] Gateway methods/calls
## Testing
The package includes integration tests that require `$BOT_TOKEN`. To run these

View File

@ -95,6 +95,10 @@ type RequestGuildMembersData struct {
Presences bool `json:"presences,omitempty"`
}
func (g *Gateway) RequestGuildMembers(data RequestGuildMembersData) error {
return g.Send(RequestGuildMembersOP, data)
}
type UpdateVoiceStateData struct {
GuildID discord.Snowflake `json:"guild_id"`
ChannelID discord.Snowflake `json:"channel_id"`
@ -102,6 +106,10 @@ type UpdateVoiceStateData struct {
SelfDeaf bool `json:"self_deaf"`
}
func (g *Gateway) UpdateVoiceState(data UpdateVoiceStateData) error {
return g.Send(VoiceStateUpdateOP, data)
}
type UpdateStatusData struct {
Since discord.Milliseconds `json:"since,omitempty"` // 0 if not idle
Game *discord.Activity `json:"game,omitempty"` // nullable
@ -109,3 +117,18 @@ type UpdateStatusData struct {
Status discord.Status `json:"status"`
AFK bool `json:"afk"`
}
func (g *Gateway) UpdateStatus(data UpdateStatusData) error {
return g.Send(StatusUpdateOP, data)
}
// Undocumented
type GuildSubscribeData struct {
GuildID discord.Snowflake `json:"guild_id"`
Typing bool `json:"typing"`
Activities bool `json:"activities"`
}
func (g *Gateway) GuildSubscribe(data GuildSubscribeData) error {
return g.Send(GuildSubscriptionsOP, data)
}