mirror of
https://github.com/cwinfo/matterbridge.git
synced 2025-07-04 20:37:44 +00:00
Update dependencies (#1813)
This commit is contained in:
2
vendor/github.com/bwmarrin/discordgo/.travis.yml
generated
vendored
2
vendor/github.com/bwmarrin/discordgo/.travis.yml
generated
vendored
@ -4,6 +4,8 @@ go:
|
||||
- 1.14.x
|
||||
- 1.15.x
|
||||
- 1.16.x
|
||||
- 1.17.x
|
||||
- 1.18.x
|
||||
env:
|
||||
- GO111MODULE=on
|
||||
install:
|
||||
|
10
vendor/github.com/bwmarrin/discordgo/components.go
generated
vendored
10
vendor/github.com/bwmarrin/discordgo/components.go
generated
vendored
@ -70,7 +70,7 @@ type ActionsRow struct {
|
||||
func (r ActionsRow) MarshalJSON() ([]byte, error) {
|
||||
type actionsRow ActionsRow
|
||||
|
||||
return json.Marshal(struct {
|
||||
return Marshal(struct {
|
||||
actionsRow
|
||||
Type ComponentType `json:"type"`
|
||||
}{
|
||||
@ -145,7 +145,7 @@ func (b Button) MarshalJSON() ([]byte, error) {
|
||||
b.Style = PrimaryButton
|
||||
}
|
||||
|
||||
return json.Marshal(struct {
|
||||
return Marshal(struct {
|
||||
button
|
||||
Type ComponentType `json:"type"`
|
||||
}{
|
||||
@ -192,7 +192,7 @@ func (SelectMenu) Type() ComponentType {
|
||||
func (m SelectMenu) MarshalJSON() ([]byte, error) {
|
||||
type selectMenu SelectMenu
|
||||
|
||||
return json.Marshal(struct {
|
||||
return Marshal(struct {
|
||||
selectMenu
|
||||
Type ComponentType `json:"type"`
|
||||
}{
|
||||
@ -208,7 +208,7 @@ type TextInput struct {
|
||||
Style TextInputStyle `json:"style"`
|
||||
Placeholder string `json:"placeholder,omitempty"`
|
||||
Value string `json:"value,omitempty"`
|
||||
Required bool `json:"required,omitempty"`
|
||||
Required bool `json:"required"`
|
||||
MinLength int `json:"min_length,omitempty"`
|
||||
MaxLength int `json:"max_length,omitempty"`
|
||||
}
|
||||
@ -222,7 +222,7 @@ func (TextInput) Type() ComponentType {
|
||||
func (m TextInput) MarshalJSON() ([]byte, error) {
|
||||
type inputText TextInput
|
||||
|
||||
return json.Marshal(struct {
|
||||
return Marshal(struct {
|
||||
inputText
|
||||
Type ComponentType `json:"type"`
|
||||
}{
|
||||
|
4
vendor/github.com/bwmarrin/discordgo/discord.go
generated
vendored
4
vendor/github.com/bwmarrin/discordgo/discord.go
generated
vendored
@ -20,7 +20,7 @@ import (
|
||||
)
|
||||
|
||||
// VERSION of DiscordGo, follows Semantic Versioning. (http://semver.org/)
|
||||
const VERSION = "0.24.0"
|
||||
const VERSION = "0.25.0"
|
||||
|
||||
// New creates a new Discord session with provided token.
|
||||
// If the token is for a bot, it must be prefixed with "Bot "
|
||||
@ -36,6 +36,7 @@ func New(token string) (s *Session, err error) {
|
||||
StateEnabled: true,
|
||||
Compress: true,
|
||||
ShouldReconnectOnError: true,
|
||||
ShouldRetryOnRateLimit: true,
|
||||
ShardID: 0,
|
||||
ShardCount: 1,
|
||||
MaxRestRetries: 3,
|
||||
@ -49,7 +50,6 @@ func New(token string) (s *Session, err error) {
|
||||
// These can be modified prior to calling Open()
|
||||
s.Identify.Compress = true
|
||||
s.Identify.LargeThreshold = 250
|
||||
s.Identify.GuildSubscriptions = true
|
||||
s.Identify.Properties.OS = runtime.GOOS
|
||||
s.Identify.Properties.Browser = "DiscordGo v" + VERSION
|
||||
s.Identify.Intents = IntentsAllWithoutPrivileged
|
||||
|
21
vendor/github.com/bwmarrin/discordgo/endpoints.go
generated
vendored
21
vendor/github.com/bwmarrin/discordgo/endpoints.go
generated
vendored
@ -23,15 +23,16 @@ var (
|
||||
EndpointSmActive = EndpointSm + "active.json"
|
||||
EndpointSmUpcoming = EndpointSm + "upcoming.json"
|
||||
|
||||
EndpointDiscord = "https://discord.com/"
|
||||
EndpointAPI = EndpointDiscord + "api/v" + APIVersion + "/"
|
||||
EndpointGuilds = EndpointAPI + "guilds/"
|
||||
EndpointChannels = EndpointAPI + "channels/"
|
||||
EndpointUsers = EndpointAPI + "users/"
|
||||
EndpointGateway = EndpointAPI + "gateway"
|
||||
EndpointGatewayBot = EndpointGateway + "/bot"
|
||||
EndpointWebhooks = EndpointAPI + "webhooks/"
|
||||
EndpointStickers = EndpointAPI + "stickers/"
|
||||
EndpointDiscord = "https://discord.com/"
|
||||
EndpointAPI = EndpointDiscord + "api/v" + APIVersion + "/"
|
||||
EndpointGuilds = EndpointAPI + "guilds/"
|
||||
EndpointChannels = EndpointAPI + "channels/"
|
||||
EndpointUsers = EndpointAPI + "users/"
|
||||
EndpointGateway = EndpointAPI + "gateway"
|
||||
EndpointGatewayBot = EndpointGateway + "/bot"
|
||||
EndpointWebhooks = EndpointAPI + "webhooks/"
|
||||
EndpointStickers = EndpointAPI + "stickers/"
|
||||
EndpointStageInstances = EndpointAPI + "stage-instances"
|
||||
|
||||
EndpointCDN = "https://cdn.discordapp.com/"
|
||||
EndpointCDNAttachments = EndpointCDN + "attachments/"
|
||||
@ -72,6 +73,7 @@ var (
|
||||
EndpointGuildPreview = func(gID string) string { return EndpointGuilds + gID + "/preview" }
|
||||
EndpointGuildChannels = func(gID string) string { return EndpointGuilds + gID + "/channels" }
|
||||
EndpointGuildMembers = func(gID string) string { return EndpointGuilds + gID + "/members" }
|
||||
EndpointGuildMembersSearch = func(gID string) string { return EndpointGuildMembers(gID) + "/search" }
|
||||
EndpointGuildMember = func(gID, uID string) string { return EndpointGuilds + gID + "/members/" + uID }
|
||||
EndpointGuildMemberRole = func(gID, uID, rID string) string { return EndpointGuilds + gID + "/members/" + uID + "/roles/" + rID }
|
||||
EndpointGuildBans = func(gID string) string { return EndpointGuilds + gID + "/bans" }
|
||||
@ -94,6 +96,7 @@ var (
|
||||
EndpointGuildBanner = func(gID, hash string) string { return EndpointCDNBanners + gID + "/" + hash + ".png" }
|
||||
EndpointGuildStickers = func(gID string) string { return EndpointGuilds + gID + "/stickers" }
|
||||
EndpointGuildSticker = func(gID, sID string) string { return EndpointGuilds + gID + "/stickers/" + sID }
|
||||
EndpointStageInstance = func(cID string) string { return EndpointStageInstances + "/" + cID }
|
||||
EndpointGuildScheduledEvents = func(gID string) string { return EndpointGuilds + gID + "/scheduled-events" }
|
||||
EndpointGuildScheduledEvent = func(gID, eID string) string { return EndpointGuilds + gID + "/scheduled-events/" + eID }
|
||||
EndpointGuildScheduledEventUsers = func(gID, eID string) string { return EndpointGuildScheduledEvent(gID, eID) + "/users" }
|
||||
|
361
vendor/github.com/bwmarrin/discordgo/eventhandlers.go
generated
vendored
361
vendor/github.com/bwmarrin/discordgo/eventhandlers.go
generated
vendored
@ -7,62 +7,67 @@ package discordgo
|
||||
// Event type values are used to match the events returned by Discord.
|
||||
// EventTypes surrounded by __ are synthetic and are internal to DiscordGo.
|
||||
const (
|
||||
channelCreateEventType = "CHANNEL_CREATE"
|
||||
channelDeleteEventType = "CHANNEL_DELETE"
|
||||
channelPinsUpdateEventType = "CHANNEL_PINS_UPDATE"
|
||||
channelUpdateEventType = "CHANNEL_UPDATE"
|
||||
connectEventType = "__CONNECT__"
|
||||
disconnectEventType = "__DISCONNECT__"
|
||||
eventEventType = "__EVENT__"
|
||||
guildBanAddEventType = "GUILD_BAN_ADD"
|
||||
guildBanRemoveEventType = "GUILD_BAN_REMOVE"
|
||||
guildCreateEventType = "GUILD_CREATE"
|
||||
guildDeleteEventType = "GUILD_DELETE"
|
||||
guildEmojisUpdateEventType = "GUILD_EMOJIS_UPDATE"
|
||||
guildIntegrationsUpdateEventType = "GUILD_INTEGRATIONS_UPDATE"
|
||||
guildMemberAddEventType = "GUILD_MEMBER_ADD"
|
||||
guildMemberRemoveEventType = "GUILD_MEMBER_REMOVE"
|
||||
guildMemberUpdateEventType = "GUILD_MEMBER_UPDATE"
|
||||
guildMembersChunkEventType = "GUILD_MEMBERS_CHUNK"
|
||||
guildRoleCreateEventType = "GUILD_ROLE_CREATE"
|
||||
guildRoleDeleteEventType = "GUILD_ROLE_DELETE"
|
||||
guildRoleUpdateEventType = "GUILD_ROLE_UPDATE"
|
||||
guildUpdateEventType = "GUILD_UPDATE"
|
||||
guildScheduledEventCreateEventType = "GUILD_SCHEDULED_EVENT_CREATE"
|
||||
guildScheduledEventUpdateEventType = "GUILD_SCHEDULED_EVENT_UPDATE"
|
||||
guildScheduledEventDeleteEventType = "GUILD_SCHEDULED_EVENT_DELETE"
|
||||
interactionCreateEventType = "INTERACTION_CREATE"
|
||||
inviteCreateEventType = "INVITE_CREATE"
|
||||
inviteDeleteEventType = "INVITE_DELETE"
|
||||
messageAckEventType = "MESSAGE_ACK"
|
||||
messageCreateEventType = "MESSAGE_CREATE"
|
||||
messageDeleteEventType = "MESSAGE_DELETE"
|
||||
messageDeleteBulkEventType = "MESSAGE_DELETE_BULK"
|
||||
messageReactionAddEventType = "MESSAGE_REACTION_ADD"
|
||||
messageReactionRemoveEventType = "MESSAGE_REACTION_REMOVE"
|
||||
messageReactionRemoveAllEventType = "MESSAGE_REACTION_REMOVE_ALL"
|
||||
messageUpdateEventType = "MESSAGE_UPDATE"
|
||||
presenceUpdateEventType = "PRESENCE_UPDATE"
|
||||
presencesReplaceEventType = "PRESENCES_REPLACE"
|
||||
rateLimitEventType = "__RATE_LIMIT__"
|
||||
readyEventType = "READY"
|
||||
relationshipAddEventType = "RELATIONSHIP_ADD"
|
||||
relationshipRemoveEventType = "RELATIONSHIP_REMOVE"
|
||||
resumedEventType = "RESUMED"
|
||||
threadCreateEventType = "THREAD_CREATE"
|
||||
threadDeleteEventType = "THREAD_DELETE"
|
||||
threadListSyncEventType = "THREAD_LIST_SYNC"
|
||||
threadMemberUpdateEventType = "THREAD_MEMBER_UPDATE"
|
||||
threadMembersUpdateEventType = "THREAD_MEMBERS_UPDATE"
|
||||
threadUpdateEventType = "THREAD_UPDATE"
|
||||
typingStartEventType = "TYPING_START"
|
||||
userGuildSettingsUpdateEventType = "USER_GUILD_SETTINGS_UPDATE"
|
||||
userNoteUpdateEventType = "USER_NOTE_UPDATE"
|
||||
userSettingsUpdateEventType = "USER_SETTINGS_UPDATE"
|
||||
userUpdateEventType = "USER_UPDATE"
|
||||
voiceServerUpdateEventType = "VOICE_SERVER_UPDATE"
|
||||
voiceStateUpdateEventType = "VOICE_STATE_UPDATE"
|
||||
webhooksUpdateEventType = "WEBHOOKS_UPDATE"
|
||||
channelCreateEventType = "CHANNEL_CREATE"
|
||||
channelDeleteEventType = "CHANNEL_DELETE"
|
||||
channelPinsUpdateEventType = "CHANNEL_PINS_UPDATE"
|
||||
channelUpdateEventType = "CHANNEL_UPDATE"
|
||||
connectEventType = "__CONNECT__"
|
||||
disconnectEventType = "__DISCONNECT__"
|
||||
eventEventType = "__EVENT__"
|
||||
guildBanAddEventType = "GUILD_BAN_ADD"
|
||||
guildBanRemoveEventType = "GUILD_BAN_REMOVE"
|
||||
guildCreateEventType = "GUILD_CREATE"
|
||||
guildDeleteEventType = "GUILD_DELETE"
|
||||
guildEmojisUpdateEventType = "GUILD_EMOJIS_UPDATE"
|
||||
guildIntegrationsUpdateEventType = "GUILD_INTEGRATIONS_UPDATE"
|
||||
guildMemberAddEventType = "GUILD_MEMBER_ADD"
|
||||
guildMemberRemoveEventType = "GUILD_MEMBER_REMOVE"
|
||||
guildMemberUpdateEventType = "GUILD_MEMBER_UPDATE"
|
||||
guildMembersChunkEventType = "GUILD_MEMBERS_CHUNK"
|
||||
guildRoleCreateEventType = "GUILD_ROLE_CREATE"
|
||||
guildRoleDeleteEventType = "GUILD_ROLE_DELETE"
|
||||
guildRoleUpdateEventType = "GUILD_ROLE_UPDATE"
|
||||
guildStageInstanceCreateEventType = "STAGE_INSTANCE_CREATE"
|
||||
guildStageInstanceUpdateEventType = "STAGE_INSTANCE_UPDATE"
|
||||
guildStageInstanceDeleteEventType = "STAGE_INSTANCE_DELETE"
|
||||
guildScheduledEventCreateEventType = "GUILD_SCHEDULED_EVENT_CREATE"
|
||||
guildScheduledEventDeleteEventType = "GUILD_SCHEDULED_EVENT_DELETE"
|
||||
guildScheduledEventUpdateEventType = "GUILD_SCHEDULED_EVENT_UPDATE"
|
||||
guildScheduledEventUserAddEventType = "GUILD_SCHEDULED_EVENT_USER_ADD"
|
||||
guildScheduledEventUserRemoveEventType = "GUILD_SCHEDULED_EVENT_USER_REMOVE"
|
||||
guildUpdateEventType = "GUILD_UPDATE"
|
||||
interactionCreateEventType = "INTERACTION_CREATE"
|
||||
inviteCreateEventType = "INVITE_CREATE"
|
||||
inviteDeleteEventType = "INVITE_DELETE"
|
||||
messageAckEventType = "MESSAGE_ACK"
|
||||
messageCreateEventType = "MESSAGE_CREATE"
|
||||
messageDeleteEventType = "MESSAGE_DELETE"
|
||||
messageDeleteBulkEventType = "MESSAGE_DELETE_BULK"
|
||||
messageReactionAddEventType = "MESSAGE_REACTION_ADD"
|
||||
messageReactionRemoveEventType = "MESSAGE_REACTION_REMOVE"
|
||||
messageReactionRemoveAllEventType = "MESSAGE_REACTION_REMOVE_ALL"
|
||||
messageUpdateEventType = "MESSAGE_UPDATE"
|
||||
presenceUpdateEventType = "PRESENCE_UPDATE"
|
||||
presencesReplaceEventType = "PRESENCES_REPLACE"
|
||||
rateLimitEventType = "__RATE_LIMIT__"
|
||||
readyEventType = "READY"
|
||||
relationshipAddEventType = "RELATIONSHIP_ADD"
|
||||
relationshipRemoveEventType = "RELATIONSHIP_REMOVE"
|
||||
resumedEventType = "RESUMED"
|
||||
threadCreateEventType = "THREAD_CREATE"
|
||||
threadDeleteEventType = "THREAD_DELETE"
|
||||
threadListSyncEventType = "THREAD_LIST_SYNC"
|
||||
threadMemberUpdateEventType = "THREAD_MEMBER_UPDATE"
|
||||
threadMembersUpdateEventType = "THREAD_MEMBERS_UPDATE"
|
||||
threadUpdateEventType = "THREAD_UPDATE"
|
||||
typingStartEventType = "TYPING_START"
|
||||
userGuildSettingsUpdateEventType = "USER_GUILD_SETTINGS_UPDATE"
|
||||
userNoteUpdateEventType = "USER_NOTE_UPDATE"
|
||||
userSettingsUpdateEventType = "USER_SETTINGS_UPDATE"
|
||||
userUpdateEventType = "USER_UPDATE"
|
||||
voiceServerUpdateEventType = "VOICE_SERVER_UPDATE"
|
||||
voiceStateUpdateEventType = "VOICE_STATE_UPDATE"
|
||||
webhooksUpdateEventType = "WEBHOOKS_UPDATE"
|
||||
)
|
||||
|
||||
// channelCreateEventHandler is an event handler for ChannelCreate events.
|
||||
@ -310,66 +315,6 @@ func (eh guildIntegrationsUpdateEventHandler) Handle(s *Session, i interface{})
|
||||
}
|
||||
}
|
||||
|
||||
// guildScheduledEventCreateEventHandler is an event handler for GuildScheduledEventCreate events.
|
||||
type guildScheduledEventCreateEventHandler func(*Session, *GuildScheduledEventCreate)
|
||||
|
||||
// Type returns the event type for GuildScheduledEventCreate events.
|
||||
func (eh guildScheduledEventCreateEventHandler) Type() string {
|
||||
return guildScheduledEventCreateEventType
|
||||
}
|
||||
|
||||
// New returns a new instance of GuildScheduledEventCreate.
|
||||
func (eh guildScheduledEventCreateEventHandler) New() interface{} {
|
||||
return &GuildScheduledEventCreate{}
|
||||
}
|
||||
|
||||
// Handle is the handler for GuildScheduledEventCreate events.
|
||||
func (eh guildScheduledEventCreateEventHandler) Handle(s *Session, i interface{}) {
|
||||
if t, ok := i.(*GuildScheduledEventCreate); ok {
|
||||
eh(s, t)
|
||||
}
|
||||
}
|
||||
|
||||
// guildScheduledEventUpdateEventHandler is an event handler for GuildScheduledEventUpdate events.
|
||||
type guildScheduledEventUpdateEventHandler func(*Session, *GuildScheduledEventUpdate)
|
||||
|
||||
// Type returns the event type for GuildScheduledEventUpdate events.
|
||||
func (eh guildScheduledEventUpdateEventHandler) Type() string {
|
||||
return guildScheduledEventUpdateEventType
|
||||
}
|
||||
|
||||
// New returns a new instance of GuildScheduledEventUpdate.
|
||||
func (eh guildScheduledEventUpdateEventHandler) New() interface{} {
|
||||
return &GuildScheduledEventUpdate{}
|
||||
}
|
||||
|
||||
// Handle is the handler for GuildScheduledEventUpdate events.
|
||||
func (eh guildScheduledEventUpdateEventHandler) Handle(s *Session, i interface{}) {
|
||||
if t, ok := i.(*GuildScheduledEventUpdate); ok {
|
||||
eh(s, t)
|
||||
}
|
||||
}
|
||||
|
||||
// guildScheduledEventDeleteEventHandler is an event handler for GuildScheduledEventDelete events.
|
||||
type guildScheduledEventDeleteEventHandler func(*Session, *GuildScheduledEventDelete)
|
||||
|
||||
// Type returns the event type for GuildScheduledEventDelete events.
|
||||
func (eh guildScheduledEventDeleteEventHandler) Type() string {
|
||||
return guildScheduledEventDeleteEventType
|
||||
}
|
||||
|
||||
// New returns a new instance of GuildScheduledEventDelete.
|
||||
func (eh guildScheduledEventDeleteEventHandler) New() interface{} {
|
||||
return &GuildScheduledEventDelete{}
|
||||
}
|
||||
|
||||
// Handle is the handler for GuildScheduledEventDelete events.
|
||||
func (eh guildScheduledEventDeleteEventHandler) Handle(s *Session, i interface{}) {
|
||||
if t, ok := i.(*GuildScheduledEventDelete); ok {
|
||||
eh(s, t)
|
||||
}
|
||||
}
|
||||
|
||||
// guildMemberAddEventHandler is an event handler for GuildMemberAdd events.
|
||||
type guildMemberAddEventHandler func(*Session, *GuildMemberAdd)
|
||||
|
||||
@ -510,6 +455,166 @@ func (eh guildRoleUpdateEventHandler) Handle(s *Session, i interface{}) {
|
||||
}
|
||||
}
|
||||
|
||||
// guildStageInstanceEventCreateHandler is an event handler for StageInstanceEventCreate events.
|
||||
type guildStageInstanceEventCreateHandler func(*Session, *StageInstanceEventCreate)
|
||||
|
||||
// Type returns the event type for StageInstanceEventCreate events.
|
||||
func (eh guildStageInstanceEventCreateHandler) Type() string {
|
||||
return guildStageInstanceCreateEventType
|
||||
}
|
||||
|
||||
// New returns a new instance of StageInstanceEventCreate.
|
||||
func (eh guildStageInstanceEventCreateHandler) New() interface{} {
|
||||
return &StageInstanceEventCreate{}
|
||||
}
|
||||
|
||||
// Handle is the handler for StageInstanceEventCreate events.
|
||||
func (eh guildStageInstanceEventCreateHandler) Handle(s *Session, i interface{}) {
|
||||
if t, ok := i.(*StageInstanceEventCreate); ok {
|
||||
eh(s, t)
|
||||
}
|
||||
}
|
||||
|
||||
// guildStageInstanceEventUpdateHandler is an event handler for StageInstanceEventUpdate events.
|
||||
type guildStageInstanceEventUpdateHandler func(*Session, *StageInstanceEventUpdate)
|
||||
|
||||
// Type returns the event type for StageInstanceEventUpdate events.
|
||||
func (eh guildStageInstanceEventUpdateHandler) Type() string {
|
||||
return guildStageInstanceCreateEventType
|
||||
}
|
||||
|
||||
// New returns a new instance of StageInstanceEventUpdate.
|
||||
func (eh guildStageInstanceEventUpdateHandler) New() interface{} {
|
||||
return &StageInstanceEventUpdate{}
|
||||
}
|
||||
|
||||
// Handle is the handler for StageInstanceEventUpdate events.
|
||||
func (eh guildStageInstanceEventUpdateHandler) Handle(s *Session, i interface{}) {
|
||||
if t, ok := i.(*StageInstanceEventUpdate); ok {
|
||||
eh(s, t)
|
||||
}
|
||||
}
|
||||
|
||||
// guildStageInstanceEventDeleteHandler is an event handler for StageInstanceEventDelete events.
|
||||
type guildStageInstanceEventDeleteHandler func(*Session, *StageInstanceEventDelete)
|
||||
|
||||
// Type returns the event type for StageInstanceEventDelete events.
|
||||
func (eh guildStageInstanceEventDeleteHandler) Type() string {
|
||||
return guildStageInstanceCreateEventType
|
||||
}
|
||||
|
||||
// New returns a new instance of StageInstanceEventDelete.
|
||||
func (eh guildStageInstanceEventDeleteHandler) New() interface{} {
|
||||
return &StageInstanceEventDelete{}
|
||||
}
|
||||
|
||||
// Handle is the handler for StageInstanceEventDelete events.
|
||||
func (eh guildStageInstanceEventDeleteHandler) Handle(s *Session, i interface{}) {
|
||||
if t, ok := i.(*StageInstanceEventDelete); ok {
|
||||
eh(s, t)
|
||||
}
|
||||
}
|
||||
|
||||
// guildScheduledEventCreateEventHandler is an event handler for GuildScheduledEventCreate events.
|
||||
type guildScheduledEventCreateEventHandler func(*Session, *GuildScheduledEventCreate)
|
||||
|
||||
// Type returns the event type for GuildScheduledEventCreate events.
|
||||
func (eh guildScheduledEventCreateEventHandler) Type() string {
|
||||
return guildScheduledEventCreateEventType
|
||||
}
|
||||
|
||||
// New returns a new instance of GuildScheduledEventCreate.
|
||||
func (eh guildScheduledEventCreateEventHandler) New() interface{} {
|
||||
return &GuildScheduledEventCreate{}
|
||||
}
|
||||
|
||||
// Handle is the handler for GuildScheduledEventCreate events.
|
||||
func (eh guildScheduledEventCreateEventHandler) Handle(s *Session, i interface{}) {
|
||||
if t, ok := i.(*GuildScheduledEventCreate); ok {
|
||||
eh(s, t)
|
||||
}
|
||||
}
|
||||
|
||||
// guildScheduledEventDeleteEventHandler is an event handler for GuildScheduledEventDelete events.
|
||||
type guildScheduledEventDeleteEventHandler func(*Session, *GuildScheduledEventDelete)
|
||||
|
||||
// Type returns the event type for GuildScheduledEventDelete events.
|
||||
func (eh guildScheduledEventDeleteEventHandler) Type() string {
|
||||
return guildScheduledEventDeleteEventType
|
||||
}
|
||||
|
||||
// New returns a new instance of GuildScheduledEventDelete.
|
||||
func (eh guildScheduledEventDeleteEventHandler) New() interface{} {
|
||||
return &GuildScheduledEventDelete{}
|
||||
}
|
||||
|
||||
// Handle is the handler for GuildScheduledEventDelete events.
|
||||
func (eh guildScheduledEventDeleteEventHandler) Handle(s *Session, i interface{}) {
|
||||
if t, ok := i.(*GuildScheduledEventDelete); ok {
|
||||
eh(s, t)
|
||||
}
|
||||
}
|
||||
|
||||
// guildScheduledEventUpdateEventHandler is an event handler for GuildScheduledEventUpdate events.
|
||||
type guildScheduledEventUpdateEventHandler func(*Session, *GuildScheduledEventUpdate)
|
||||
|
||||
// Type returns the event type for GuildScheduledEventUpdate events.
|
||||
func (eh guildScheduledEventUpdateEventHandler) Type() string {
|
||||
return guildScheduledEventUpdateEventType
|
||||
}
|
||||
|
||||
// New returns a new instance of GuildScheduledEventUpdate.
|
||||
func (eh guildScheduledEventUpdateEventHandler) New() interface{} {
|
||||
return &GuildScheduledEventUpdate{}
|
||||
}
|
||||
|
||||
// Handle is the handler for GuildScheduledEventUpdate events.
|
||||
func (eh guildScheduledEventUpdateEventHandler) Handle(s *Session, i interface{}) {
|
||||
if t, ok := i.(*GuildScheduledEventUpdate); ok {
|
||||
eh(s, t)
|
||||
}
|
||||
}
|
||||
|
||||
// guildScheduledEventUserAddEventHandler is an event handler for GuildScheduledEventUserAdd events.
|
||||
type guildScheduledEventUserAddEventHandler func(*Session, *GuildScheduledEventUserAdd)
|
||||
|
||||
// Type returns the event type for GuildScheduledEventUserAdd events.
|
||||
func (eh guildScheduledEventUserAddEventHandler) Type() string {
|
||||
return guildScheduledEventUserAddEventType
|
||||
}
|
||||
|
||||
// New returns a new instance of GuildScheduledEventUserAdd.
|
||||
func (eh guildScheduledEventUserAddEventHandler) New() interface{} {
|
||||
return &GuildScheduledEventUserAdd{}
|
||||
}
|
||||
|
||||
// Handle is the handler for GuildScheduledEventUserAdd events.
|
||||
func (eh guildScheduledEventUserAddEventHandler) Handle(s *Session, i interface{}) {
|
||||
if t, ok := i.(*GuildScheduledEventUserAdd); ok {
|
||||
eh(s, t)
|
||||
}
|
||||
}
|
||||
|
||||
// guildScheduledEventUserRemoveEventHandler is an event handler for GuildScheduledEventUserRemove events.
|
||||
type guildScheduledEventUserRemoveEventHandler func(*Session, *GuildScheduledEventUserRemove)
|
||||
|
||||
// Type returns the event type for GuildScheduledEventUserRemove events.
|
||||
func (eh guildScheduledEventUserRemoveEventHandler) Type() string {
|
||||
return guildScheduledEventUserRemoveEventType
|
||||
}
|
||||
|
||||
// New returns a new instance of GuildScheduledEventUserRemove.
|
||||
func (eh guildScheduledEventUserRemoveEventHandler) New() interface{} {
|
||||
return &GuildScheduledEventUserRemove{}
|
||||
}
|
||||
|
||||
// Handle is the handler for GuildScheduledEventUserRemove events.
|
||||
func (eh guildScheduledEventUserRemoveEventHandler) Handle(s *Session, i interface{}) {
|
||||
if t, ok := i.(*GuildScheduledEventUserRemove); ok {
|
||||
eh(s, t)
|
||||
}
|
||||
}
|
||||
|
||||
// guildUpdateEventHandler is an event handler for GuildUpdate events.
|
||||
type guildUpdateEventHandler func(*Session, *GuildUpdate)
|
||||
|
||||
@ -1195,12 +1300,6 @@ func handlerForInterface(handler interface{}) EventHandler {
|
||||
return guildEmojisUpdateEventHandler(v)
|
||||
case func(*Session, *GuildIntegrationsUpdate):
|
||||
return guildIntegrationsUpdateEventHandler(v)
|
||||
case func(*Session, *GuildScheduledEventCreate):
|
||||
return guildScheduledEventCreateEventHandler(v)
|
||||
case func(*Session, *GuildScheduledEventUpdate):
|
||||
return guildScheduledEventUpdateEventHandler(v)
|
||||
case func(*Session, *GuildScheduledEventDelete):
|
||||
return guildScheduledEventDeleteEventHandler(v)
|
||||
case func(*Session, *GuildMemberAdd):
|
||||
return guildMemberAddEventHandler(v)
|
||||
case func(*Session, *GuildMemberRemove):
|
||||
@ -1215,6 +1314,16 @@ func handlerForInterface(handler interface{}) EventHandler {
|
||||
return guildRoleDeleteEventHandler(v)
|
||||
case func(*Session, *GuildRoleUpdate):
|
||||
return guildRoleUpdateEventHandler(v)
|
||||
case func(*Session, *GuildScheduledEventCreate):
|
||||
return guildScheduledEventCreateEventHandler(v)
|
||||
case func(*Session, *GuildScheduledEventDelete):
|
||||
return guildScheduledEventDeleteEventHandler(v)
|
||||
case func(*Session, *GuildScheduledEventUpdate):
|
||||
return guildScheduledEventUpdateEventHandler(v)
|
||||
case func(*Session, *GuildScheduledEventUserAdd):
|
||||
return guildScheduledEventUserAddEventHandler(v)
|
||||
case func(*Session, *GuildScheduledEventUserRemove):
|
||||
return guildScheduledEventUserRemoveEventHandler(v)
|
||||
case func(*Session, *GuildUpdate):
|
||||
return guildUpdateEventHandler(v)
|
||||
case func(*Session, *InteractionCreate):
|
||||
@ -1297,9 +1406,6 @@ func init() {
|
||||
registerInterfaceProvider(guildDeleteEventHandler(nil))
|
||||
registerInterfaceProvider(guildEmojisUpdateEventHandler(nil))
|
||||
registerInterfaceProvider(guildIntegrationsUpdateEventHandler(nil))
|
||||
registerInterfaceProvider(guildScheduledEventCreateEventHandler(nil))
|
||||
registerInterfaceProvider(guildScheduledEventUpdateEventHandler(nil))
|
||||
registerInterfaceProvider(guildScheduledEventDeleteEventHandler(nil))
|
||||
registerInterfaceProvider(guildMemberAddEventHandler(nil))
|
||||
registerInterfaceProvider(guildMemberRemoveEventHandler(nil))
|
||||
registerInterfaceProvider(guildMemberUpdateEventHandler(nil))
|
||||
@ -1307,6 +1413,11 @@ func init() {
|
||||
registerInterfaceProvider(guildRoleCreateEventHandler(nil))
|
||||
registerInterfaceProvider(guildRoleDeleteEventHandler(nil))
|
||||
registerInterfaceProvider(guildRoleUpdateEventHandler(nil))
|
||||
registerInterfaceProvider(guildScheduledEventCreateEventHandler(nil))
|
||||
registerInterfaceProvider(guildScheduledEventDeleteEventHandler(nil))
|
||||
registerInterfaceProvider(guildScheduledEventUpdateEventHandler(nil))
|
||||
registerInterfaceProvider(guildScheduledEventUserAddEventHandler(nil))
|
||||
registerInterfaceProvider(guildScheduledEventUserRemoveEventHandler(nil))
|
||||
registerInterfaceProvider(guildUpdateEventHandler(nil))
|
||||
registerInterfaceProvider(interactionCreateEventHandler(nil))
|
||||
registerInterfaceProvider(inviteCreateEventHandler(nil))
|
||||
|
31
vendor/github.com/bwmarrin/discordgo/events.go
generated
vendored
31
vendor/github.com/bwmarrin/discordgo/events.go
generated
vendored
@ -191,7 +191,9 @@ type GuildMembersChunk struct {
|
||||
Members []*Member `json:"members"`
|
||||
ChunkIndex int `json:"chunk_index"`
|
||||
ChunkCount int `json:"chunk_count"`
|
||||
NotFound []string `json:"not_found,omitempty"`
|
||||
Presences []*Presence `json:"presences,omitempty"`
|
||||
Nonce string `json:"nonce,omitempty"`
|
||||
}
|
||||
|
||||
// GuildIntegrationsUpdate is the data for a GuildIntegrationsUpdate event.
|
||||
@ -199,6 +201,21 @@ type GuildIntegrationsUpdate struct {
|
||||
GuildID string `json:"guild_id"`
|
||||
}
|
||||
|
||||
// StageInstanceEventCreate is the data for a StageInstanceEventCreate event.
|
||||
type StageInstanceEventCreate struct {
|
||||
*StageInstance
|
||||
}
|
||||
|
||||
// StageInstanceEventUpdate is the data for a StageInstanceEventUpdate event.
|
||||
type StageInstanceEventUpdate struct {
|
||||
*StageInstance
|
||||
}
|
||||
|
||||
// StageInstanceEventDelete is the data for a StageInstanceEventDelete event.
|
||||
type StageInstanceEventDelete struct {
|
||||
*StageInstance
|
||||
}
|
||||
|
||||
// GuildScheduledEventCreate is the data for a GuildScheduledEventCreate event.
|
||||
type GuildScheduledEventCreate struct {
|
||||
*GuildScheduledEvent
|
||||
@ -214,6 +231,20 @@ type GuildScheduledEventDelete struct {
|
||||
*GuildScheduledEvent
|
||||
}
|
||||
|
||||
// GuildScheduledEventUserAdd is the data for a GuildScheduledEventUserAdd event.
|
||||
type GuildScheduledEventUserAdd struct {
|
||||
GuildScheduledEventID string `json:"guild_scheduled_event_id"`
|
||||
UserID string `json:"user_id"`
|
||||
GuildID string `json:"guild_id"`
|
||||
}
|
||||
|
||||
// GuildScheduledEventUserRemove is the data for a GuildScheduledEventUserRemove event.
|
||||
type GuildScheduledEventUserRemove struct {
|
||||
GuildScheduledEventID string `json:"guild_scheduled_event_id"`
|
||||
UserID string `json:"user_id"`
|
||||
GuildID string `json:"guild_id"`
|
||||
}
|
||||
|
||||
// MessageAck is the data for a MessageAck event.
|
||||
type MessageAck struct {
|
||||
MessageID string `json:"message_id"`
|
||||
|
22
vendor/github.com/bwmarrin/discordgo/interactions.go
generated
vendored
22
vendor/github.com/bwmarrin/discordgo/interactions.go
generated
vendored
@ -35,12 +35,14 @@ type ApplicationCommand struct {
|
||||
Version string `json:"version,omitempty"`
|
||||
Type ApplicationCommandType `json:"type,omitempty"`
|
||||
Name string `json:"name"`
|
||||
NameLocalizations *map[Locale]string `json:"name_localizations,omitempty"`
|
||||
DefaultPermission *bool `json:"default_permission,omitempty"`
|
||||
|
||||
// NOTE: Chat commands only. Otherwise it mustn't be set.
|
||||
|
||||
Description string `json:"description,omitempty"`
|
||||
Options []*ApplicationCommandOption `json:"options"`
|
||||
Description string `json:"description,omitempty"`
|
||||
DescriptionLocalizations *map[Locale]string `json:"description_localizations,omitempty"`
|
||||
Options []*ApplicationCommandOption `json:"options"`
|
||||
}
|
||||
|
||||
// ApplicationCommandOptionType indicates the type of a slash command's option.
|
||||
@ -91,9 +93,11 @@ func (t ApplicationCommandOptionType) String() string {
|
||||
|
||||
// ApplicationCommandOption represents an option/subcommand/subcommands group.
|
||||
type ApplicationCommandOption struct {
|
||||
Type ApplicationCommandOptionType `json:"type"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description,omitempty"`
|
||||
Type ApplicationCommandOptionType `json:"type"`
|
||||
Name string `json:"name"`
|
||||
NameLocalizations map[Locale]string `json:"name_localizations,omitempty"`
|
||||
Description string `json:"description,omitempty"`
|
||||
DescriptionLocalizations map[Locale]string `json:"description_localizations,omitempty"`
|
||||
// NOTE: This feature was on the API, but at some point developers decided to remove it.
|
||||
// So I commented it, until it will be officially on the docs.
|
||||
// Default bool `json:"default"`
|
||||
@ -113,8 +117,9 @@ type ApplicationCommandOption struct {
|
||||
|
||||
// ApplicationCommandOptionChoice represents a slash command option choice.
|
||||
type ApplicationCommandOptionChoice struct {
|
||||
Name string `json:"name"`
|
||||
Value interface{} `json:"value"`
|
||||
Name string `json:"name"`
|
||||
NameLocalizations map[Locale]string `json:"name_localizations,omitempty"`
|
||||
Value interface{} `json:"value"`
|
||||
}
|
||||
|
||||
// ApplicationCommandPermissions represents a single user or role permission for a command.
|
||||
@ -175,6 +180,7 @@ func (t InteractionType) String() string {
|
||||
// Interaction represents data of an interaction.
|
||||
type Interaction struct {
|
||||
ID string `json:"id"`
|
||||
AppID string `json:"application_id"`
|
||||
Type InteractionType `json:"type"`
|
||||
Data InteractionData `json:"data"`
|
||||
GuildID string `json:"guild_id"`
|
||||
@ -509,7 +515,7 @@ type InteractionResponseData struct {
|
||||
TTS bool `json:"tts"`
|
||||
Content string `json:"content"`
|
||||
Components []MessageComponent `json:"components"`
|
||||
Embeds []*MessageEmbed `json:"embeds,omitempty"`
|
||||
Embeds []*MessageEmbed `json:"embeds"`
|
||||
AllowedMentions *MessageAllowedMentions `json:"allowed_mentions,omitempty"`
|
||||
Flags uint64 `json:"flags,omitempty"`
|
||||
Files []*File `json:"-"`
|
||||
|
15
vendor/github.com/bwmarrin/discordgo/message.go
generated
vendored
15
vendor/github.com/bwmarrin/discordgo/message.go
generated
vendored
@ -199,7 +199,9 @@ const (
|
||||
MessageFlagsCrossPosted MessageFlags = 1 << 0
|
||||
// MessageFlagsIsCrossPosted this message originated from a message in another channel (via Channel Following).
|
||||
MessageFlagsIsCrossPosted MessageFlags = 1 << 1
|
||||
// MessageFlagsSupressEmbeds do not include any embeds when serializing this message.
|
||||
// MessageFlagsSuppressEmbeds do not include any embeds when serializing this message.
|
||||
MessageFlagsSuppressEmbeds MessageFlags = 1 << 2
|
||||
// TODO: deprecated, remove when compatibility is not needed
|
||||
MessageFlagsSupressEmbeds MessageFlags = 1 << 2
|
||||
// MessageFlagsSourceMessageDeleted the source message for this crosspost has been deleted (via Channel Following).
|
||||
MessageFlagsSourceMessageDeleted MessageFlags = 1 << 3
|
||||
@ -225,7 +227,7 @@ type File struct {
|
||||
// MessageSend stores all parameters you can send with ChannelMessageSendComplex.
|
||||
type MessageSend struct {
|
||||
Content string `json:"content,omitempty"`
|
||||
Embeds []*MessageEmbed `json:"embeds,omitempty"`
|
||||
Embeds []*MessageEmbed `json:"embeds"`
|
||||
TTS bool `json:"tts"`
|
||||
Components []MessageComponent `json:"components"`
|
||||
Files []*File `json:"-"`
|
||||
@ -244,8 +246,9 @@ type MessageSend struct {
|
||||
type MessageEdit struct {
|
||||
Content *string `json:"content,omitempty"`
|
||||
Components []MessageComponent `json:"components"`
|
||||
Embeds []*MessageEmbed `json:"embeds,omitempty"`
|
||||
Embeds []*MessageEmbed `json:"embeds"`
|
||||
AllowedMentions *MessageAllowedMentions `json:"allowed_mentions,omitempty"`
|
||||
Flags MessageFlags `json:"flags,omitempty"`
|
||||
|
||||
ID string
|
||||
Channel string
|
||||
@ -342,7 +345,7 @@ type MessageEmbedFooter struct {
|
||||
|
||||
// MessageEmbedImage is a part of a MessageEmbed struct.
|
||||
type MessageEmbedImage struct {
|
||||
URL string `json:"url,omitempty"`
|
||||
URL string `json:"url"`
|
||||
ProxyURL string `json:"proxy_url,omitempty"`
|
||||
Width int `json:"width,omitempty"`
|
||||
Height int `json:"height,omitempty"`
|
||||
@ -350,7 +353,7 @@ type MessageEmbedImage struct {
|
||||
|
||||
// MessageEmbedThumbnail is a part of a MessageEmbed struct.
|
||||
type MessageEmbedThumbnail struct {
|
||||
URL string `json:"url,omitempty"`
|
||||
URL string `json:"url"`
|
||||
ProxyURL string `json:"proxy_url,omitempty"`
|
||||
Width int `json:"width,omitempty"`
|
||||
Height int `json:"height,omitempty"`
|
||||
@ -372,7 +375,7 @@ type MessageEmbedProvider struct {
|
||||
// MessageEmbedAuthor is a part of a MessageEmbed struct.
|
||||
type MessageEmbedAuthor struct {
|
||||
URL string `json:"url,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Name string `json:"name"`
|
||||
IconURL string `json:"icon_url,omitempty"`
|
||||
ProxyIconURL string `json:"proxy_icon_url,omitempty"`
|
||||
}
|
||||
|
300
vendor/github.com/bwmarrin/discordgo/restapi.go
generated
vendored
300
vendor/github.com/bwmarrin/discordgo/restapi.go
generated
vendored
@ -39,6 +39,59 @@ var (
|
||||
ErrUnauthorized = errors.New("HTTP request was unauthorized. This could be because the provided token was not a bot token. Please add \"Bot \" to the start of your token. https://discord.com/developers/docs/reference#authentication-example-bot-token-authorization-header")
|
||||
)
|
||||
|
||||
var (
|
||||
// Marshal defines function used to encode JSON payloads
|
||||
Marshal func(v interface{}) ([]byte, error) = json.Marshal
|
||||
// Unmarshal defines function used to decode JSON payloads
|
||||
Unmarshal func(src []byte, v interface{}) error = json.Unmarshal
|
||||
)
|
||||
|
||||
// RESTError stores error information about a request with a bad response code.
|
||||
// Message is not always present, there are cases where api calls can fail
|
||||
// without returning a json message.
|
||||
type RESTError struct {
|
||||
Request *http.Request
|
||||
Response *http.Response
|
||||
ResponseBody []byte
|
||||
|
||||
Message *APIErrorMessage // Message may be nil.
|
||||
}
|
||||
|
||||
// newRestError returns a new REST API error.
|
||||
func newRestError(req *http.Request, resp *http.Response, body []byte) *RESTError {
|
||||
restErr := &RESTError{
|
||||
Request: req,
|
||||
Response: resp,
|
||||
ResponseBody: body,
|
||||
}
|
||||
|
||||
// Attempt to decode the error and assume no message was provided if it fails
|
||||
var msg *APIErrorMessage
|
||||
err := Unmarshal(body, &msg)
|
||||
if err == nil {
|
||||
restErr.Message = msg
|
||||
}
|
||||
|
||||
return restErr
|
||||
}
|
||||
|
||||
// Error returns a Rest API Error with its status code and body.
|
||||
func (r RESTError) Error() string {
|
||||
return "HTTP " + r.Response.Status + ", " + string(r.ResponseBody)
|
||||
}
|
||||
|
||||
// RateLimitError is returned when a request exceeds a rate limit
|
||||
// and ShouldRetryOnRateLimit is false. The request may be manually
|
||||
// retried after waiting the duration specified by RetryAfter.
|
||||
type RateLimitError struct {
|
||||
*RateLimit
|
||||
}
|
||||
|
||||
// Error returns a rate limit error with rate limited endpoint and retry time.
|
||||
func (e RateLimitError) Error() string {
|
||||
return "Rate limit exceeded on " + e.URL + ", retry after " + e.RetryAfter.String()
|
||||
}
|
||||
|
||||
// Request is the same as RequestWithBucketID but the bucket id is the same as the urlStr
|
||||
func (s *Session) Request(method, urlStr string, data interface{}) (response []byte, err error) {
|
||||
return s.RequestWithBucketID(method, urlStr, data, strings.SplitN(urlStr, "?", 2)[0])
|
||||
@ -48,7 +101,7 @@ func (s *Session) Request(method, urlStr string, data interface{}) (response []b
|
||||
func (s *Session) RequestWithBucketID(method, urlStr string, data interface{}, bucketID string) (response []byte, err error) {
|
||||
var body []byte
|
||||
if data != nil {
|
||||
body, err = json.Marshal(data)
|
||||
body, err = Marshal(data)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
@ -108,7 +161,7 @@ func (s *Session) RequestWithLockedBucket(method, urlStr, contentType string, b
|
||||
}
|
||||
defer func() {
|
||||
err2 := resp.Body.Close()
|
||||
if err2 != nil {
|
||||
if s.Debug && err2 != nil {
|
||||
log.Println("error closing resp body")
|
||||
}
|
||||
}()
|
||||
@ -147,19 +200,24 @@ func (s *Session) RequestWithLockedBucket(method, urlStr, contentType string, b
|
||||
}
|
||||
case 429: // TOO MANY REQUESTS - Rate limiting
|
||||
rl := TooManyRequests{}
|
||||
err = json.Unmarshal(response, &rl)
|
||||
err = Unmarshal(response, &rl)
|
||||
if err != nil {
|
||||
s.log(LogError, "rate limit unmarshal error, %s", err)
|
||||
return
|
||||
}
|
||||
s.log(LogInformational, "Rate Limiting %s, retry in %v", urlStr, rl.RetryAfter)
|
||||
s.handleEvent(rateLimitEventType, &RateLimit{TooManyRequests: &rl, URL: urlStr})
|
||||
|
||||
time.Sleep(rl.RetryAfter)
|
||||
// we can make the above smarter
|
||||
// this method can cause longer delays than required
|
||||
if s.ShouldRetryOnRateLimit {
|
||||
s.log(LogInformational, "Rate Limiting %s, retry in %v", urlStr, rl.RetryAfter)
|
||||
s.handleEvent(rateLimitEventType, &RateLimit{TooManyRequests: &rl, URL: urlStr})
|
||||
|
||||
response, err = s.RequestWithLockedBucket(method, urlStr, contentType, b, s.Ratelimiter.LockBucketObject(bucket), sequence)
|
||||
time.Sleep(rl.RetryAfter)
|
||||
// we can make the above smarter
|
||||
// this method can cause longer delays than required
|
||||
|
||||
response, err = s.RequestWithLockedBucket(method, urlStr, contentType, b, s.Ratelimiter.LockBucketObject(bucket), sequence)
|
||||
} else {
|
||||
err = &RateLimitError{&RateLimit{TooManyRequests: &rl, URL: urlStr}}
|
||||
}
|
||||
case http.StatusUnauthorized:
|
||||
if strings.Index(s.Token, "Bot ") != 0 {
|
||||
s.log(LogInformational, ErrUnauthorized.Error())
|
||||
@ -174,7 +232,7 @@ func (s *Session) RequestWithLockedBucket(method, urlStr, contentType string, b
|
||||
}
|
||||
|
||||
func unmarshal(data []byte, v interface{}) error {
|
||||
err := json.Unmarshal(data, v)
|
||||
err := Unmarshal(data, v)
|
||||
if err != nil {
|
||||
return fmt.Errorf("%w: %s", ErrJSONUnmarshal, err)
|
||||
}
|
||||
@ -438,6 +496,19 @@ func (s *Session) Guild(guildID string) (st *Guild, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
// GuildWithCounts returns a Guild structure of a specific Guild with approximate member and presence counts.
|
||||
// guildID : The ID of a Guild
|
||||
func (s *Session) GuildWithCounts(guildID string) (st *Guild, err error) {
|
||||
|
||||
body, err := s.RequestWithBucketID("GET", EndpointGuild(guildID)+"?with_counts=true", nil, EndpointGuild(guildID))
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = unmarshal(body, &st)
|
||||
return
|
||||
}
|
||||
|
||||
// GuildPreview returns a GuildPreview structure of a specific public Guild.
|
||||
// guildID : The ID of a Guild
|
||||
func (s *Session) GuildPreview(guildID string) (st *GuildPreview, err error) {
|
||||
@ -481,7 +552,7 @@ func (s *Session) GuildEdit(guildID string, g GuildParams) (st *Guild, err error
|
||||
}
|
||||
}
|
||||
|
||||
//Bounds checking for regions
|
||||
// Bounds checking for regions
|
||||
if g.Region != "" {
|
||||
isValid := false
|
||||
regions, _ := s.VoiceRegions()
|
||||
@ -530,12 +601,30 @@ func (s *Session) GuildLeave(guildID string) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
// GuildBans returns an array of GuildBan structures for all bans of a
|
||||
// given guild.
|
||||
// guildID : The ID of a Guild.
|
||||
func (s *Session) GuildBans(guildID string) (st []*GuildBan, err error) {
|
||||
// GuildBans returns an array of GuildBan structures for bans in the given guild.
|
||||
// guildID : The ID of a Guild
|
||||
// limit : Max number of bans to return (max 1000)
|
||||
// beforeID : If not empty all returned users will be after the given id
|
||||
// afterID : If not empty all returned users will be before the given id
|
||||
func (s *Session) GuildBans(guildID string, limit int, beforeID, afterID string) (st []*GuildBan, err error) {
|
||||
uri := EndpointGuildBans(guildID)
|
||||
|
||||
body, err := s.RequestWithBucketID("GET", EndpointGuildBans(guildID), nil, EndpointGuildBans(guildID))
|
||||
v := url.Values{}
|
||||
if limit != 0 {
|
||||
v.Set("limit", strconv.Itoa(limit))
|
||||
}
|
||||
if beforeID != "" {
|
||||
v.Set("before", beforeID)
|
||||
}
|
||||
if afterID != "" {
|
||||
v.Set("after", afterID)
|
||||
}
|
||||
|
||||
if len(v) > 0 {
|
||||
uri += "?" + v.Encode()
|
||||
}
|
||||
|
||||
body, err := s.RequestWithBucketID("GET", uri, nil, EndpointGuildBans(guildID))
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
@ -631,6 +720,29 @@ func (s *Session) GuildMembers(guildID string, after string, limit int) (st []*M
|
||||
return
|
||||
}
|
||||
|
||||
// GuildMembersSearch returns a list of guild member objects whose username or nickname starts with a provided string
|
||||
// guildID : The ID of a Guild
|
||||
// query : Query string to match username(s) and nickname(s) against
|
||||
// limit : Max number of members to return (default 1, min 1, max 1000)
|
||||
func (s *Session) GuildMembersSearch(guildID, query string, limit int) (st []*Member, err error) {
|
||||
|
||||
uri := EndpointGuildMembersSearch(guildID)
|
||||
|
||||
queryParams := url.Values{}
|
||||
queryParams.Set("query", query)
|
||||
if limit > 1 {
|
||||
queryParams.Set("limit", strconv.Itoa(limit))
|
||||
}
|
||||
|
||||
body, err := s.RequestWithBucketID("GET", uri+"?"+queryParams.Encode(), nil, uri)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = unmarshal(body, &st)
|
||||
return
|
||||
}
|
||||
|
||||
// GuildMember returns a member of a guild.
|
||||
// guildID : The ID of a Guild.
|
||||
// userID : The ID of a User
|
||||
@ -710,6 +822,21 @@ func (s *Session) GuildMemberEdit(guildID, userID string, roles []string) (err e
|
||||
return
|
||||
}
|
||||
|
||||
// GuildMemberEditComplex edits the nickname and roles of a member.
|
||||
// guildID : The ID of a Guild.
|
||||
// userID : The ID of a User.
|
||||
// data : A GuildMemberEditData struct with the new nickname and roles
|
||||
func (s *Session) GuildMemberEditComplex(guildID, userID string, data GuildMemberParams) (st *Member, err error) {
|
||||
var body []byte
|
||||
body, err = s.RequestWithBucketID("PATCH", EndpointGuildMember(guildID, userID), data, EndpointGuildMember(guildID, ""))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
err = unmarshal(body, &st)
|
||||
return
|
||||
}
|
||||
|
||||
// GuildMemberMove moves a guild member from one voice channel to another/none
|
||||
// guildID : The ID of a Guild.
|
||||
// userID : The ID of a User.
|
||||
@ -1218,6 +1345,20 @@ func (s *Session) GuildEmojis(guildID string) (emoji []*Emoji, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
// GuildEmoji returns specified emoji.
|
||||
// guildID : The ID of a Guild
|
||||
// emojiID : The ID of an Emoji to retrieve
|
||||
func (s *Session) GuildEmoji(guildID, emojiID string) (emoji *Emoji, err error) {
|
||||
var body []byte
|
||||
body, err = s.RequestWithBucketID("GET", EndpointGuildEmoji(guildID, emojiID), nil, EndpointGuildEmoji(guildID, emojiID))
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = unmarshal(body, &emoji)
|
||||
return
|
||||
}
|
||||
|
||||
// GuildEmojiCreate creates a new emoji
|
||||
// guildID : The ID of a Guild.
|
||||
// name : The Name of the Emoji.
|
||||
@ -1244,12 +1385,12 @@ func (s *Session) GuildEmojiCreate(guildID, name, image string, roles []string)
|
||||
// guildID : The ID of a Guild.
|
||||
// emojiID : The ID of an Emoji.
|
||||
// name : The Name of the Emoji.
|
||||
// roles : The roles for which this emoji will be whitelisted, can be nil.
|
||||
// roles : The roles for which this emoji will be whitelisted, if nil or empty the roles will be reset.
|
||||
func (s *Session) GuildEmojiEdit(guildID, emojiID, name string, roles []string) (emoji *Emoji, err error) {
|
||||
|
||||
data := struct {
|
||||
Name string `json:"name"`
|
||||
Roles []string `json:"roles,omitempty"`
|
||||
Roles []string `json:"roles"`
|
||||
}{name, roles}
|
||||
|
||||
body, err := s.RequestWithBucketID("PATCH", EndpointGuildEmoji(guildID, emojiID), data, EndpointGuildEmojis(guildID))
|
||||
@ -1851,6 +1992,37 @@ func (s *Session) InviteWithCounts(inviteID string) (st *Invite, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
// InviteComplex returns an Invite structure of the given invite including specified fields.
|
||||
// inviteID : The invite code
|
||||
// guildScheduledEventID : If specified, includes specified guild scheduled event.
|
||||
// withCounts : Whether to include approximate member counts or not
|
||||
// withExpiration : Whether to include expiration time or not
|
||||
func (s *Session) InviteComplex(inviteID, guildScheduledEventID string, withCounts, withExpiration bool) (st *Invite, err error) {
|
||||
endpoint := EndpointInvite(inviteID)
|
||||
v := url.Values{}
|
||||
if guildScheduledEventID != "" {
|
||||
v.Set("guild_scheduled_event_id", guildScheduledEventID)
|
||||
}
|
||||
if withCounts {
|
||||
v.Set("with_counts", "true")
|
||||
}
|
||||
if withExpiration {
|
||||
v.Set("with_expiration", "true")
|
||||
}
|
||||
|
||||
if len(v) != 0 {
|
||||
endpoint += "?" + v.Encode()
|
||||
}
|
||||
|
||||
body, err := s.RequestWithBucketID("GET", endpoint, nil, EndpointInvite(""))
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = unmarshal(body, &st)
|
||||
return
|
||||
}
|
||||
|
||||
// InviteDelete deletes an existing invite
|
||||
// inviteID : the code of an invite
|
||||
func (s *Session) InviteDelete(inviteID string) (st *Invite, err error) {
|
||||
@ -2158,7 +2330,7 @@ func (s *Session) WebhookMessage(webhookID, token, messageID string) (message *M
|
||||
return
|
||||
}
|
||||
|
||||
err = json.Unmarshal(body, &message)
|
||||
err = Unmarshal(body, &message)
|
||||
|
||||
return
|
||||
}
|
||||
@ -2207,7 +2379,7 @@ func (s *Session) WebhookMessageDelete(webhookID, token, messageID string) (err
|
||||
// MessageReactionAdd creates an emoji reaction to a message.
|
||||
// channelID : The channel ID.
|
||||
// messageID : The message ID.
|
||||
// emojiID : Either the unicode emoji for the reaction, or a guild emoji identifier.
|
||||
// emojiID : Either the unicode emoji for the reaction, or a guild emoji identifier in name:id format (e.g. "hello:1234567654321")
|
||||
func (s *Session) MessageReactionAdd(channelID, messageID, emojiID string) error {
|
||||
|
||||
// emoji such as #⃣ need to have # escaped
|
||||
@ -2687,10 +2859,9 @@ func (s *Session) ApplicationCommandPermissionsBatchEdit(appID, guildID string,
|
||||
}
|
||||
|
||||
// InteractionRespond creates the response to an interaction.
|
||||
// appID : The application ID.
|
||||
// interaction : Interaction instance.
|
||||
// resp : Response message data.
|
||||
func (s *Session) InteractionRespond(interaction *Interaction, resp *InteractionResponse) (err error) {
|
||||
func (s *Session) InteractionRespond(interaction *Interaction, resp *InteractionResponse) error {
|
||||
endpoint := EndpointInteractionResponse(interaction.ID, interaction.Token)
|
||||
|
||||
if resp.Data != nil && len(resp.Data.Files) > 0 {
|
||||
@ -2700,32 +2871,30 @@ func (s *Session) InteractionRespond(interaction *Interaction, resp *Interaction
|
||||
}
|
||||
|
||||
_, err = s.request("POST", endpoint, contentType, body, endpoint, 0)
|
||||
} else {
|
||||
_, err = s.RequestWithBucketID("POST", endpoint, *resp, endpoint)
|
||||
return err
|
||||
}
|
||||
|
||||
_, err := s.RequestWithBucketID("POST", endpoint, *resp, endpoint)
|
||||
return err
|
||||
}
|
||||
|
||||
// InteractionResponse gets the response to an interaction.
|
||||
// appID : The application ID.
|
||||
// interaction : Interaction instance.
|
||||
func (s *Session) InteractionResponse(appID string, interaction *Interaction) (*Message, error) {
|
||||
return s.WebhookMessage(appID, interaction.Token, "@original")
|
||||
func (s *Session) InteractionResponse(interaction *Interaction) (*Message, error) {
|
||||
return s.WebhookMessage(interaction.AppID, interaction.Token, "@original")
|
||||
}
|
||||
|
||||
// InteractionResponseEdit edits the response to an interaction.
|
||||
// appID : The application ID.
|
||||
// interaction : Interaction instance.
|
||||
// newresp : Updated response message data.
|
||||
func (s *Session) InteractionResponseEdit(appID string, interaction *Interaction, newresp *WebhookEdit) (*Message, error) {
|
||||
return s.WebhookMessageEdit(appID, interaction.Token, "@original", newresp)
|
||||
func (s *Session) InteractionResponseEdit(interaction *Interaction, newresp *WebhookEdit) (*Message, error) {
|
||||
return s.WebhookMessageEdit(interaction.AppID, interaction.Token, "@original", newresp)
|
||||
}
|
||||
|
||||
// InteractionResponseDelete deletes the response to an interaction.
|
||||
// appID : The application ID.
|
||||
// interaction : Interaction instance.
|
||||
func (s *Session) InteractionResponseDelete(appID string, interaction *Interaction) error {
|
||||
endpoint := EndpointInteractionResponseActions(appID, interaction.Token)
|
||||
func (s *Session) InteractionResponseDelete(interaction *Interaction) error {
|
||||
endpoint := EndpointInteractionResponseActions(interaction.AppID, interaction.Token)
|
||||
|
||||
_, err := s.RequestWithBucketID("DELETE", endpoint, nil, endpoint)
|
||||
|
||||
@ -2733,29 +2902,76 @@ func (s *Session) InteractionResponseDelete(appID string, interaction *Interacti
|
||||
}
|
||||
|
||||
// FollowupMessageCreate creates the followup message for an interaction.
|
||||
// appID : The application ID.
|
||||
// interaction : Interaction instance.
|
||||
// wait : Waits for server confirmation of message send and ensures that the return struct is populated (it is nil otherwise)
|
||||
// data : Data of the message to send.
|
||||
func (s *Session) FollowupMessageCreate(appID string, interaction *Interaction, wait bool, data *WebhookParams) (*Message, error) {
|
||||
return s.WebhookExecute(appID, interaction.Token, wait, data)
|
||||
func (s *Session) FollowupMessageCreate(interaction *Interaction, wait bool, data *WebhookParams) (*Message, error) {
|
||||
return s.WebhookExecute(interaction.AppID, interaction.Token, wait, data)
|
||||
}
|
||||
|
||||
// FollowupMessageEdit edits a followup message of an interaction.
|
||||
// appID : The application ID.
|
||||
// interaction : Interaction instance.
|
||||
// messageID : The followup message ID.
|
||||
// data : Data to update the message
|
||||
func (s *Session) FollowupMessageEdit(appID string, interaction *Interaction, messageID string, data *WebhookEdit) (*Message, error) {
|
||||
return s.WebhookMessageEdit(appID, interaction.Token, messageID, data)
|
||||
func (s *Session) FollowupMessageEdit(interaction *Interaction, messageID string, data *WebhookEdit) (*Message, error) {
|
||||
return s.WebhookMessageEdit(interaction.AppID, interaction.Token, messageID, data)
|
||||
}
|
||||
|
||||
// FollowupMessageDelete deletes a followup message of an interaction.
|
||||
// appID : The application ID.
|
||||
// interaction : Interaction instance.
|
||||
// messageID : The followup message ID.
|
||||
func (s *Session) FollowupMessageDelete(appID string, interaction *Interaction, messageID string) error {
|
||||
return s.WebhookMessageDelete(appID, interaction.Token, messageID)
|
||||
func (s *Session) FollowupMessageDelete(interaction *Interaction, messageID string) error {
|
||||
return s.WebhookMessageDelete(interaction.AppID, interaction.Token, messageID)
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Functions specific to stage instances
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
||||
// StageInstanceCreate creates and returns a new Stage instance associated to a Stage channel.
|
||||
// data : Parameters needed to create a stage instance.
|
||||
// data : The data of the Stage instance to create
|
||||
func (s *Session) StageInstanceCreate(data *StageInstanceParams) (si *StageInstance, err error) {
|
||||
body, err := s.RequestWithBucketID("POST", EndpointStageInstances, data, EndpointStageInstances)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = unmarshal(body, &si)
|
||||
return
|
||||
}
|
||||
|
||||
// StageInstance will retrieve a Stage instance by ID of the Stage channel.
|
||||
// channelID : The ID of the Stage channel
|
||||
func (s *Session) StageInstance(channelID string) (si *StageInstance, err error) {
|
||||
body, err := s.RequestWithBucketID("GET", EndpointStageInstance(channelID), nil, EndpointStageInstance(channelID))
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = unmarshal(body, &si)
|
||||
return
|
||||
}
|
||||
|
||||
// StageInstanceEdit will edit a Stage instance by ID of the Stage channel.
|
||||
// channelID : The ID of the Stage channel
|
||||
// data : The data to edit the Stage instance
|
||||
func (s *Session) StageInstanceEdit(channelID string, data *StageInstanceParams) (si *StageInstance, err error) {
|
||||
|
||||
body, err := s.RequestWithBucketID("PATCH", EndpointStageInstance(channelID), data, EndpointStageInstance(channelID))
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = unmarshal(body, &si)
|
||||
return
|
||||
}
|
||||
|
||||
// StageInstanceDelete will delete a Stage instance by ID of the Stage channel.
|
||||
// channelID : The ID of the Stage channel
|
||||
func (s *Session) StageInstanceDelete(channelID string) (err error) {
|
||||
_, err = s.RequestWithBucketID("DELETE", EndpointStageInstance(channelID), nil, EndpointStageInstance(channelID))
|
||||
return
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
6
vendor/github.com/bwmarrin/discordgo/state.go
generated
vendored
6
vendor/github.com/bwmarrin/discordgo/state.go
generated
vendored
@ -979,8 +979,9 @@ func (s *State) OnInterface(se *Session, i interface{}) (err error) {
|
||||
|
||||
err = s.GuildRemove(t.Guild)
|
||||
case *GuildMemberAdd:
|
||||
var guild *Guild
|
||||
// Updates the MemberCount of the guild.
|
||||
guild, err := s.Guild(t.Member.GuildID)
|
||||
guild, err = s.Guild(t.Member.GuildID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -995,8 +996,9 @@ func (s *State) OnInterface(se *Session, i interface{}) (err error) {
|
||||
err = s.MemberAdd(t.Member)
|
||||
}
|
||||
case *GuildMemberRemove:
|
||||
var guild *Guild
|
||||
// Updates the MemberCount of the guild.
|
||||
guild, err := s.Guild(t.Member.GuildID)
|
||||
guild, err = s.Guild(t.Member.GuildID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
122
vendor/github.com/bwmarrin/discordgo/structs.go
generated
vendored
122
vendor/github.com/bwmarrin/discordgo/structs.go
generated
vendored
@ -43,6 +43,9 @@ type Session struct {
|
||||
// Should the session reconnect the websocket on errors.
|
||||
ShouldReconnectOnError bool
|
||||
|
||||
// Should the session retry requests when rate limited.
|
||||
ShouldRetryOnRateLimit bool
|
||||
|
||||
// Identify is sent during initial handshake with the discord gateway.
|
||||
// https://discord.com/developers/docs/topics/gateway#identify
|
||||
Identify Identify
|
||||
@ -260,6 +263,7 @@ const (
|
||||
ChannelTypeGuildNewsThread ChannelType = 10
|
||||
ChannelTypeGuildPublicThread ChannelType = 11
|
||||
ChannelTypeGuildPrivateThread ChannelType = 12
|
||||
ChannelTypeGuildStageVoice ChannelType = 13
|
||||
)
|
||||
|
||||
// A Channel holds all data related to an individual Discord channel.
|
||||
@ -360,7 +364,7 @@ type ChannelEdit struct {
|
||||
UserLimit int `json:"user_limit,omitempty"`
|
||||
PermissionOverwrites []*PermissionOverwrite `json:"permission_overwrites,omitempty"`
|
||||
ParentID string `json:"parent_id,omitempty"`
|
||||
RateLimitPerUser int `json:"rate_limit_per_user,omitempty"`
|
||||
RateLimitPerUser *int `json:"rate_limit_per_user,omitempty"`
|
||||
|
||||
// NOTE: threads only
|
||||
|
||||
@ -552,6 +556,17 @@ const (
|
||||
ExplicitContentFilterAllMembers ExplicitContentFilterLevel = 2
|
||||
)
|
||||
|
||||
// GuildNSFWLevel type definition
|
||||
type GuildNSFWLevel int
|
||||
|
||||
// Constants for GuildNSFWLevel levels from 0 to 3 inclusive
|
||||
const (
|
||||
GuildNSFWLevelDefault GuildNSFWLevel = 0
|
||||
GuildNSFWLevelExplicit GuildNSFWLevel = 1
|
||||
GuildNSFWLevelSafe GuildNSFWLevel = 2
|
||||
GuildNSFWLevelAgeRestricted GuildNSFWLevel = 3
|
||||
)
|
||||
|
||||
// MfaLevel type definition
|
||||
type MfaLevel int
|
||||
|
||||
@ -675,6 +690,9 @@ type Guild struct {
|
||||
// The explicit content filter level
|
||||
ExplicitContentFilter ExplicitContentFilterLevel `json:"explicit_content_filter"`
|
||||
|
||||
// The NSFW Level of the guild
|
||||
NSFWLevel GuildNSFWLevel `json:"nsfw_level"`
|
||||
|
||||
// The list of enabled guild features
|
||||
Features []string `json:"features"`
|
||||
|
||||
@ -731,6 +749,9 @@ type Guild struct {
|
||||
|
||||
// Permissions of our user
|
||||
Permissions int64 `json:"permissions,string"`
|
||||
|
||||
// Stage instances in the guild
|
||||
StageInstances []*StageInstance `json:"stage_instances"`
|
||||
}
|
||||
|
||||
// A GuildPreview holds data related to a specific public Discord Guild, even if the user is not in the guild.
|
||||
@ -757,16 +778,31 @@ type GuildPreview struct {
|
||||
// The list of enabled guild features
|
||||
Features []string `json:"features"`
|
||||
|
||||
// Approximate number of members in this guild, returned from the GET /guild/<id> endpoint when with_counts is true
|
||||
// Approximate number of members in this guild
|
||||
// NOTE: this field is only filled when using GuildWithCounts
|
||||
ApproximateMemberCount int `json:"approximate_member_count"`
|
||||
|
||||
// Approximate number of non-offline members in this guild, returned from the GET /guild/<id> endpoint when with_counts is true
|
||||
// Approximate number of non-offline members in this guild
|
||||
// NOTE: this field is only filled when using GuildWithCounts
|
||||
ApproximatePresenceCount int `json:"approximate_presence_count"`
|
||||
|
||||
// the description for the guild
|
||||
Description string `json:"description"`
|
||||
}
|
||||
|
||||
// IconURL returns a URL to the guild's icon.
|
||||
func (g *GuildPreview) IconURL() string {
|
||||
if g.Icon == "" {
|
||||
return ""
|
||||
}
|
||||
|
||||
if strings.HasPrefix(g.Icon, "a_") {
|
||||
return EndpointGuildIconAnimated(g.ID, g.Icon)
|
||||
}
|
||||
|
||||
return EndpointGuildIcon(g.ID, g.Icon)
|
||||
}
|
||||
|
||||
// GuildScheduledEvent is a representation of a scheduled event in a guild. Only for retrieval of the data.
|
||||
// https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event
|
||||
type GuildScheduledEvent struct {
|
||||
@ -842,7 +878,7 @@ func (p GuildScheduledEventParams) MarshalJSON() ([]byte, error) {
|
||||
type guildScheduledEventParams GuildScheduledEventParams
|
||||
|
||||
if p.EntityType == GuildScheduledEventEntityTypeExternal && p.ChannelID == "" {
|
||||
return json.Marshal(struct {
|
||||
return Marshal(struct {
|
||||
guildScheduledEventParams
|
||||
ChannelID json.RawMessage `json:"channel_id"`
|
||||
}{
|
||||
@ -851,7 +887,7 @@ func (p GuildScheduledEventParams) MarshalJSON() ([]byte, error) {
|
||||
})
|
||||
}
|
||||
|
||||
return json.Marshal(guildScheduledEventParams(p))
|
||||
return Marshal(guildScheduledEventParams(p))
|
||||
}
|
||||
|
||||
// GuildScheduledEventEntityMetadata holds additional metadata for guild scheduled event.
|
||||
@ -1093,7 +1129,7 @@ func (t *TimeStamps) UnmarshalJSON(b []byte) error {
|
||||
End float64 `json:"end,omitempty"`
|
||||
Start float64 `json:"start,omitempty"`
|
||||
}{}
|
||||
err := json.Unmarshal(b, &temp)
|
||||
err := Unmarshal(b, &temp)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -1231,7 +1267,7 @@ func (t *TooManyRequests) UnmarshalJSON(b []byte) error {
|
||||
Message string `json:"message"`
|
||||
RetryAfter float64 `json:"retry_after"`
|
||||
}{}
|
||||
err := json.Unmarshal(b, &u)
|
||||
err := Unmarshal(b, &u)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -1566,6 +1602,15 @@ type UserGuildSettingsEdit struct {
|
||||
ChannelOverrides map[string]*UserGuildSettingsChannelOverride `json:"channel_overrides"`
|
||||
}
|
||||
|
||||
// GuildMemberParams stores data needed to update a member
|
||||
// https://discord.com/developers/docs/resources/guild#modify-guild-member
|
||||
type GuildMemberParams struct {
|
||||
// Value to set user's nickname to
|
||||
Nick string `json:"nick,omitempty"`
|
||||
// Array of role ids the member is assigned
|
||||
Roles *[]string `json:"roles,omitempty"`
|
||||
}
|
||||
|
||||
// An APIErrorMessage is an api error message returned from discord
|
||||
type APIErrorMessage struct {
|
||||
Code int `json:"code"`
|
||||
@ -1642,7 +1687,7 @@ func (activity *Activity) UnmarshalJSON(b []byte) error {
|
||||
Instance bool `json:"instance,omitempty"`
|
||||
Flags int `json:"flags,omitempty"`
|
||||
}{}
|
||||
err := json.Unmarshal(b, &temp)
|
||||
err := Unmarshal(b, &temp)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -1695,14 +1740,13 @@ const (
|
||||
// Identify is sent during initial handshake with the discord gateway.
|
||||
// https://discord.com/developers/docs/topics/gateway#identify
|
||||
type Identify struct {
|
||||
Token string `json:"token"`
|
||||
Properties IdentifyProperties `json:"properties"`
|
||||
Compress bool `json:"compress"`
|
||||
LargeThreshold int `json:"large_threshold"`
|
||||
Shard *[2]int `json:"shard,omitempty"`
|
||||
Presence GatewayStatusUpdate `json:"presence,omitempty"`
|
||||
GuildSubscriptions bool `json:"guild_subscriptions"`
|
||||
Intents Intent `json:"intents"`
|
||||
Token string `json:"token"`
|
||||
Properties IdentifyProperties `json:"properties"`
|
||||
Compress bool `json:"compress"`
|
||||
LargeThreshold int `json:"large_threshold"`
|
||||
Shard *[2]int `json:"shard,omitempty"`
|
||||
Presence GatewayStatusUpdate `json:"presence,omitempty"`
|
||||
Intents Intent `json:"intents"`
|
||||
}
|
||||
|
||||
// IdentifyProperties contains the "properties" portion of an Identify packet
|
||||
@ -1715,6 +1759,49 @@ type IdentifyProperties struct {
|
||||
ReferringDomain string `json:"$referring_domain"`
|
||||
}
|
||||
|
||||
// StageInstance holds information about a live stage.
|
||||
// https://discord.com/developers/docs/resources/stage-instance#stage-instance-resource
|
||||
type StageInstance struct {
|
||||
// The id of this Stage instance
|
||||
ID string `json:"id"`
|
||||
// The guild id of the associated Stage channel
|
||||
GuildID string `json:"guild_id"`
|
||||
// The id of the associated Stage channel
|
||||
ChannelID string `json:"channel_id"`
|
||||
// The topic of the Stage instance (1-120 characters)
|
||||
Topic string `json:"topic"`
|
||||
// The privacy level of the Stage instance
|
||||
// https://discord.com/developers/docs/resources/stage-instance#stage-instance-object-privacy-level
|
||||
PrivacyLevel StageInstancePrivacyLevel `json:"privacy_level"`
|
||||
// Whether or not Stage Discovery is disabled (deprecated)
|
||||
DiscoverableDisabled bool `json:"discoverable_disabled"`
|
||||
// The id of the scheduled event for this Stage instance
|
||||
GuildScheduledEventID string `json:"guild_scheduled_event_id"`
|
||||
}
|
||||
|
||||
// StageInstanceParams represents the parameters needed to create or edit a stage instance
|
||||
type StageInstanceParams struct {
|
||||
// ChannelID represents the id of the Stage channel
|
||||
ChannelID string `json:"channel_id,omitempty"`
|
||||
// Topic of the Stage instance (1-120 characters)
|
||||
Topic string `json:"topic,omitempty"`
|
||||
// PrivacyLevel of the Stage instance (default GUILD_ONLY)
|
||||
PrivacyLevel StageInstancePrivacyLevel `json:"privacy_level,omitempty"`
|
||||
// SendStartNotification will notify @everyone that a Stage instance has started
|
||||
SendStartNotification bool `json:"send_start_notification,omitempty"`
|
||||
}
|
||||
|
||||
// StageInstancePrivacyLevel represents the privacy level of a Stage instance
|
||||
// https://discord.com/developers/docs/resources/stage-instance#stage-instance-object-privacy-level
|
||||
type StageInstancePrivacyLevel int
|
||||
|
||||
const (
|
||||
// StageInstancePrivacyLevelPublic The Stage instance is visible publicly. (deprecated)
|
||||
StageInstancePrivacyLevelPublic StageInstancePrivacyLevel = 1
|
||||
// StageInstancePrivacyLevelGuildOnly The Stage instance is visible to only guild members.
|
||||
StageInstancePrivacyLevelGuildOnly StageInstancePrivacyLevel = 2
|
||||
)
|
||||
|
||||
// Constants for the different bit offsets of text channel permissions
|
||||
const (
|
||||
// Deprecated: PermissionReadMessages has been replaced with PermissionViewChannel for text and voice channels
|
||||
@ -1731,6 +1818,7 @@ const (
|
||||
PermissionManageThreads = 0x0000000400000000
|
||||
PermissionCreatePublicThreads = 0x0000000800000000
|
||||
PermissionCreatePrivateThreads = 0x0000001000000000
|
||||
PermissionUseExternalStickers = 0x0000002000000000
|
||||
PermissionSendMessagesInThreads = 0x0000004000000000
|
||||
)
|
||||
|
||||
@ -1745,6 +1833,7 @@ const (
|
||||
PermissionVoiceMoveMembers = 0x0000000001000000
|
||||
PermissionVoiceUseVAD = 0x0000000002000000
|
||||
PermissionVoiceRequestToSpeak = 0x0000000100000000
|
||||
PermissionUseActivities = 0x0000008000000000
|
||||
)
|
||||
|
||||
// Constants for general management.
|
||||
@ -1754,6 +1843,7 @@ const (
|
||||
PermissionManageRoles = 0x0000000010000000
|
||||
PermissionManageWebhooks = 0x0000000020000000
|
||||
PermissionManageEmojis = 0x0000000040000000
|
||||
PermissionManageEvents = 0x0000000200000000
|
||||
)
|
||||
|
||||
// Constants for the different bit offsets of general permissions
|
||||
|
47
vendor/github.com/bwmarrin/discordgo/types.go
generated
vendored
47
vendor/github.com/bwmarrin/discordgo/types.go
generated
vendored
@ -1,47 +0,0 @@
|
||||
// Discordgo - Discord bindings for Go
|
||||
// Available at https://github.com/bwmarrin/discordgo
|
||||
|
||||
// Copyright 2015-2016 Bruce Marriner <bruce@sqls.net>. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// This file contains custom types, currently only a timestamp wrapper.
|
||||
|
||||
package discordgo
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// RESTError stores error information about a request with a bad response code.
|
||||
// Message is not always present, there are cases where api calls can fail
|
||||
// without returning a json message.
|
||||
type RESTError struct {
|
||||
Request *http.Request
|
||||
Response *http.Response
|
||||
ResponseBody []byte
|
||||
|
||||
Message *APIErrorMessage // Message may be nil.
|
||||
}
|
||||
|
||||
func newRestError(req *http.Request, resp *http.Response, body []byte) *RESTError {
|
||||
restErr := &RESTError{
|
||||
Request: req,
|
||||
Response: resp,
|
||||
ResponseBody: body,
|
||||
}
|
||||
|
||||
// Attempt to decode the error and assume no message was provided if it fails
|
||||
var msg *APIErrorMessage
|
||||
err := json.Unmarshal(body, &msg)
|
||||
if err == nil {
|
||||
restErr.Message = msg
|
||||
}
|
||||
|
||||
return restErr
|
||||
}
|
||||
|
||||
func (r RESTError) Error() string {
|
||||
return "HTTP " + r.Response.Status + ", " + string(r.ResponseBody)
|
||||
}
|
3
vendor/github.com/bwmarrin/discordgo/util.go
generated
vendored
3
vendor/github.com/bwmarrin/discordgo/util.go
generated
vendored
@ -2,7 +2,6 @@ package discordgo
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"mime/multipart"
|
||||
@ -30,7 +29,7 @@ func MultipartBodyWithJSON(data interface{}, files []*File) (requestContentType
|
||||
body := &bytes.Buffer{}
|
||||
bodywriter := multipart.NewWriter(body)
|
||||
|
||||
payload, err := json.Marshal(data)
|
||||
payload, err := Marshal(data)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
63
vendor/github.com/bwmarrin/discordgo/wsapi.go
generated
vendored
63
vendor/github.com/bwmarrin/discordgo/wsapi.go
generated
vendored
@ -409,10 +409,13 @@ func (s *Session) UpdateStatusComplex(usd UpdateStatusData) (err error) {
|
||||
}
|
||||
|
||||
type requestGuildMembersData struct {
|
||||
GuildIDs []string `json:"guild_id"`
|
||||
Query string `json:"query"`
|
||||
Limit int `json:"limit"`
|
||||
Presences bool `json:"presences"`
|
||||
// TODO: Deprecated. Use string instead of []string
|
||||
GuildIDs []string `json:"guild_id"`
|
||||
Query *string `json:"query,omitempty"`
|
||||
UserIDs *[]string `json:"user_ids,omitempty"`
|
||||
Limit int `json:"limit"`
|
||||
Nonce string `json:"nonce,omitempty"`
|
||||
Presences bool `json:"presences"`
|
||||
}
|
||||
|
||||
type requestGuildMembersOp struct {
|
||||
@ -425,16 +428,21 @@ type requestGuildMembersOp struct {
|
||||
// guildID : Single Guild ID to request members of
|
||||
// query : String that username starts with, leave empty to return all members
|
||||
// limit : Max number of items to return, or 0 to request all members matched
|
||||
// nonce : Nonce to identify the Guild Members Chunk response
|
||||
// presences : Whether to request presences of guild members
|
||||
func (s *Session) RequestGuildMembers(guildID string, query string, limit int, presences bool) (err error) {
|
||||
data := requestGuildMembersData{
|
||||
GuildIDs: []string{guildID},
|
||||
Query: query,
|
||||
Limit: limit,
|
||||
Presences: presences,
|
||||
}
|
||||
err = s.requestGuildMembers(data)
|
||||
return
|
||||
func (s *Session) RequestGuildMembers(guildID, query string, limit int, nonce string, presences bool) error {
|
||||
return s.RequestGuildMembersBatch([]string{guildID}, query, limit, nonce, presences)
|
||||
}
|
||||
|
||||
// RequestGuildMembersList requests guild members from the gateway
|
||||
// The gateway responds with GuildMembersChunk events
|
||||
// guildID : Single Guild ID to request members of
|
||||
// userIDs : IDs of users to fetch
|
||||
// limit : Max number of items to return, or 0 to request all members matched
|
||||
// nonce : Nonce to identify the Guild Members Chunk response
|
||||
// presences : Whether to request presences of guild members
|
||||
func (s *Session) RequestGuildMembersList(guildID string, userIDs []string, limit int, nonce string, presences bool) error {
|
||||
return s.RequestGuildMembersBatchList([]string{guildID}, userIDs, limit, nonce, presences)
|
||||
}
|
||||
|
||||
// RequestGuildMembersBatch requests guild members from the gateway
|
||||
@ -442,12 +450,37 @@ func (s *Session) RequestGuildMembers(guildID string, query string, limit int, p
|
||||
// guildID : Slice of guild IDs to request members of
|
||||
// query : String that username starts with, leave empty to return all members
|
||||
// limit : Max number of items to return, or 0 to request all members matched
|
||||
// nonce : Nonce to identify the Guild Members Chunk response
|
||||
// presences : Whether to request presences of guild members
|
||||
func (s *Session) RequestGuildMembersBatch(guildIDs []string, query string, limit int, presences bool) (err error) {
|
||||
//
|
||||
// NOTE: this function is deprecated, please use RequestGuildMembers instead
|
||||
func (s *Session) RequestGuildMembersBatch(guildIDs []string, query string, limit int, nonce string, presences bool) (err error) {
|
||||
data := requestGuildMembersData{
|
||||
GuildIDs: guildIDs,
|
||||
Query: query,
|
||||
Query: &query,
|
||||
Limit: limit,
|
||||
Nonce: nonce,
|
||||
Presences: presences,
|
||||
}
|
||||
err = s.requestGuildMembers(data)
|
||||
return
|
||||
}
|
||||
|
||||
// RequestGuildMembersBatchList requests guild members from the gateway
|
||||
// The gateway responds with GuildMembersChunk events
|
||||
// guildID : Slice of guild IDs to request members of
|
||||
// userIDs : IDs of users to fetch
|
||||
// limit : Max number of items to return, or 0 to request all members matched
|
||||
// nonce : Nonce to identify the Guild Members Chunk response
|
||||
// presences : Whether to request presences of guild members
|
||||
//
|
||||
// NOTE: this function is deprecated, please use RequestGuildMembersList instead
|
||||
func (s *Session) RequestGuildMembersBatchList(guildIDs []string, userIDs []string, limit int, nonce string, presences bool) (err error) {
|
||||
data := requestGuildMembersData{
|
||||
GuildIDs: guildIDs,
|
||||
UserIDs: &userIDs,
|
||||
Limit: limit,
|
||||
Nonce: nonce,
|
||||
Presences: presences,
|
||||
}
|
||||
err = s.requestGuildMembers(data)
|
||||
|
Reference in New Issue
Block a user