Documentation
¶
Index ¶
- Constants
- type ActivityAssets
- type ActivityButtons
- type ActivityEmoji
- type ActivityOptions
- type ActivityParty
- type ActivitySecrets
- type ActivityStructure
- type ActivityTimestamps
- type AvatarDecorationData
- type Bot
- type Channel
- type DefaultReaction
- type DiscordMessage
- type Emoji
- type Friend
- type Guild
- type GuildInvite
- type GuildInviteOptions
- type GuildManager
- func (g *GuildManager) BanUser(b *Bot, GuildID, User string) error
- func (g *GuildManager) CreateChannel(b *Bot, GuildID, CategoryID, Name string) (Channel, error)
- func (g *GuildManager) CreateChannelNoCategory(b *Bot, GuildID, Name string) (Channel, error)
- func (g *GuildManager) CreateInvite(b *Bot, ChannelID string, options GuildInviteOptions) (GuildInvite, error)
- func (g *GuildManager) CreateTimeout(b *Bot, GuildID, UserID string, Options TimeoutOptions) error
- func (g *GuildManager) GetChannel(b *Bot, ChannelID string) (Channel, error)
- func (g *GuildManager) GetGuild(b *Bot, GuildID string) (Guild, error)
- func (g *GuildManager) GetGuildChannels(b *Bot, GuildID string) ([]Channel, error)
- func (g *GuildManager) GetGuildMember(b *Bot, GuildID, UserID string) (GuildMember, error)
- func (g *GuildManager) GetInvite(b *Bot, Invite string) (GuildInvite, error)
- func (g *GuildManager) GetRolesForUser(b *Bot, GuildID, UserID string) ([]Role, error)
- func (g *GuildManager) HasRole(b *Bot, GuildID, RoleID, UserID string) bool
- func (g *GuildManager) KickUser(b *Bot, GuildID, User string) error
- func (g *GuildManager) PinMessage(b *Bot, ChannelID, MessageID string) error
- func (g *GuildManager) RemoveMessageFromPins(b *Bot, ChannelID, MessageID string) error
- func (g *GuildManager) RemoveTimeout(b *Bot, GuildID, UserID string) error
- func (g *GuildManager) SetChannelTopic(b *Bot, ChannelID, Topic string) error
- func (g *GuildManager) SetUserNickname(b *Bot, GuildID, Member, Nickname string) (User, error)
- type GuildMember
- type HeartbeatPayloadData
- type Message
- type MessageReference
- type Overwrite
- type Permission
- type Role
- type RoleTags
- type StatusOptions
- type Sticker
- type StickerPack
- type StickerPacks
- type Tag
- type ThreadMember
- type ThreadMetadata
- type TimeoutOptions
- type User
- type UserManager
- func (u *UserManager) ChangeStatus(b *Bot, Options StatusOptions) error
- func (u *UserManager) CreateFriendInvite(b *Bot) (GuildInvite, error)
- func (u *UserManager) DeleteMessage(b *Bot, ChannelID, MessageID string) error
- func (u *UserManager) EditMessage(b *Bot, ChannelID, MessageID string, Content string) (Message, error)
- func (u *UserManager) GetFriends(b *Bot) ([]Friend, error)
- func (u *UserManager) SendMessage(b *Bot, ChannelID, Content string) (Message, error)
- func (u *UserManager) SendMessageWithReply(b *Bot, ChannelID, MessageID, Content string) (Message, error)
- func (u *UserManager) SendTyping(b *Bot, ChannelID string) error
- func (u *UserManager) SetPresence(b *Bot, activity ActivityStructure) error
- type Webhook
- type WebhookManager
- type WelcomeScreen
- type WelcomeScreenChannel
Constants ¶
const ( Online = "online" Idle = "idle" DoNotDisturb = "dnd" Invisible = "invisible" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActivityAssets ¶
type ActivityButtons ¶
type ActivityEmoji ¶
type ActivityOptions ¶
type ActivityOptions struct { Since *int64 `json:"since,omitempty"` Activities []ActivityStructure `json:"activities"` Status string `json:"status"` AFK bool `json:"afk"` }
Gateway presence update structure
type ActivityParty ¶
type ActivitySecrets ¶
type ActivityStructure ¶
type ActivityStructure struct { Name string `json:"name"` Type int `json:"type"` Url string `json:"url,omitempty"` CreatedAt int64 `json:"created_at"` Timestamps ActivityTimestamps `json:"timestamps,omitempty"` ApplicationID string `json:"application_id,omitempty"` Details string `json:"details,omitempty"` State string `json:"state,omitempty"` Emoji ActivityEmoji `json:"emoji,omitempty"` Party ActivityParty `json:"party,omitempty"` Assets ActivityAssets `json:"assets,omitempty"` Secrets ActivitySecrets `json:"secrets,omitempty"` Instance bool `json:"instance,omitempty"` Flags int `json:"flags,omitempty"` Buttons []ActivityButtons `json:"buttons,omitempty"` }
type ActivityTimestamps ¶
type AvatarDecorationData ¶
type Bot ¶
type Bot struct { Token string Client User Conn *websocket.Conn User UserManager Webhooks WebhookManager Guild GuildManager // contains filtered or unexported fields }
Discord bot.
type Channel ¶
type Channel struct { ID string `json:"id"` Type int `json:"type"` GuildID string `json:"guild_id,omitempty"` Position int `json:"position,omitempty"` PermissionOverwrites []Overwrite Name string `json:"name,omitempty"` Topic string `json:"topic,omitempty"` NSFW bool `json:"nsfw,omitempty"` LastMessageID string `json:"last_message_id,omitempty"` Bitrate int `json:"bitrate,omitempty"` UserLimit int `json:"user_limit,omitempty"` RateLimitPerUser int `json:"rate_limit_per_user,omitempty"` Recipients []User Icon string `json:"icon,omitempty"` OwnerID string `json:"owner_id,omitempty"` ApplicationID string `json:"application_id,omitempty"` Managed bool `json:"managed,omitempty"` ParentID string `json:"parent_id,omitempty"` LastPinTimestamp string `json:"last_pin_timestamp,omitempty"` RTCRegion string `json:"rtc_region,omitempty"` VideoQualityMode int `json:"video_quality_mode,omitempty"` MessageCount int `json:"message_count,omitempty"` MemberCount int `json:"member_count,omitempty"` ThreadMetadata ThreadMetadata Member ThreadMember DefaultAutoArchiveDur int `json:"default_auto_archive_duration,omitempty"` Permissions string `json:"permissions,omitempty"` Flags int `json:"flags,omitempty"` TotalMessagesSent int `json:"total_message_sent,omitempty"` AvailableTags []Tag AppliedTags []string `json:"applied_tags,omitempty"` DefaultReactionEmoji DefaultReaction DefaultThreadRateLimit int `json:"default_thread_rate_limit_per_user,omitempty"` DefaultSortOrder int `json:"default_sort_order,omitempty"` DefaultForumLayout int `json:"default_forum_layout,omitempty"` }
type DefaultReaction ¶
type DiscordMessage ¶
type DiscordMessage struct { Op int `json:"op"` D json.RawMessage `json:"d"` T string `json:"t"` }
type Emoji ¶
type Emoji struct { ID *string `json:"id,omitempty"` Name *string `json:"name,omitempty"` Roles []string `json:"roles,omitempty"` User *User `json:"user,omitempty"` RequireColons bool `json:"require_colons,omitempty"` Managed bool `json:"managed,omitempty"` Animated bool `json:"animated,omitempty"` Available bool `json:"available,omitempty"` }
type Friend ¶
type Friend struct { ID string `json:"id"` Type int `json:"type"` Nickname *string `json:"nickname,omitempty"` User struct { ID string `json:"id"` Username string `json:"username"` GlobalName string `json:"global_name"` Avatar string `json:"avatar"` AvatarDecorationData *AvatarDecorationData `json:"avatar_decoration_data,omitempty"` Discriminator string `json:"discriminator"` PublicFlags int `json:"public_flags"` } `json:"user"` Since string `json:"since"` }
type Guild ¶
type Guild struct { ID string `json:"id"` Name string `json:"name"` Icon *string `json:"icon,omitempty"` Splash *string `json:"splash,omitempty"` DiscoverySplash *string `json:"discovery_splash,omitempty"` Owner *bool `json:"owner,omitempty"` OwnerID string `json:"owner_id"` Permissions *string `json:"permissions,omitempty"` Region *string `json:"region,omitempty"` AfkChannelID *string `json:"afk_channel_id,omitempty"` AfkTimeout int `json:"afk_timeout"` WidgetEnabled *bool `json:"widget_enabled,omitempty"` WidgetChannelID *string `json:"widget_channel_id,omitempty"` VerificationLevel int `json:"verification_level"` DefaultMessageNotifications int `json:"default_message_notifications"` ExplicitContentFilter int `json:"explicit_content_filter"` Roles []Role `json:"roles"` Emojis []Emoji `json:"emojis"` Features []string `json:"features"` MfaLevel int `json:"mfa_level"` ApplicationID *string `json:"application_id,omitempty"` SystemChannelID *string `json:"system_channel_id,omitempty"` SystemChannelFlags int `json:"system_channel_flags"` RulesChannelID *string `json:"rules_channel_id,omitempty"` MaxPresences *int `json:"max_presences,omitempty"` MaxMembers int `json:"max_members"` VanityURLCode *string `json:"vanity_url_code,omitempty"` Description *string `json:"description,omitempty"` Banner *string `json:"banner,omitempty"` PremiumTier int `json:"premium_tier"` PremiumSubscriptionCount *int `json:"premium_subscription_count,omitempty"` PreferredLocale string `json:"preferred_locale"` PublicUpdatesChannelID *string `json:"public_updates_channel_id,omitempty"` MaxVideoChannelUsers *int `json:"max_video_channel_users,omitempty"` MaxStageVideoChannelUsers *int `json:"max_stage_video_channel_users,omitempty"` ApproximateMemberCount *int `json:"approximate_member_count,omitempty"` ApproximatePresenceCount *int `json:"approximate_presence_count,omitempty"` WelcomeScreen *WelcomeScreen `json:"welcome_screen,omitempty"` NSFWLevel int `json:"nsfw_level"` Stickers []Sticker `json:"stickers,omitempty"` PremiumProgressBarEnabled *bool `json:"premium_progress_bar_enabled,omitempty"` SafetyAlertsChannelID *string `json:"safety_alerts_channel_id,omitempty"` }
type GuildInvite ¶
type GuildInvite struct { Type int `json:"type"` Code string `json:"code"` Inviter User `json:"inviter"` MaxAge int `json:"max_age"` CreatedAt string `json:"created_at"` ExpiresAt string `json:"expires_at"` Guild Guild `json:"guild"` GuildID string `json:"guild_id"` Channel Channel `json:"channel"` Uses int `json:"uses"` MaxUses int `json:"max_uses"` Temporary bool `json:"temporary"` }
type GuildInviteOptions ¶
type GuildManager ¶
type GuildManager struct{}
This contains all of the guild functions.
func (*GuildManager) BanUser ¶
func (g *GuildManager) BanUser(b *Bot, GuildID, User string) error
Bans an user.
func (*GuildManager) CreateChannel ¶
func (g *GuildManager) CreateChannel(b *Bot, GuildID, CategoryID, Name string) (Channel, error)
Creates a new channel. Returns a Channel object.
func (*GuildManager) CreateChannelNoCategory ¶
func (g *GuildManager) CreateChannelNoCategory(b *Bot, GuildID, Name string) (Channel, error)
Creates a new channel, with no category. Returns a Channel object.
func (*GuildManager) CreateInvite ¶
func (g *GuildManager) CreateInvite(b *Bot, ChannelID string, options GuildInviteOptions) (GuildInvite, error)
Creates a Discord invite to the given channel. Returns a GuildInvite object. The invite options are specified using GuildInviteOptions.
MaxAge is specified in miliseconds.
func (*GuildManager) CreateTimeout ¶
func (g *GuildManager) CreateTimeout(b *Bot, GuildID, UserID string, Options TimeoutOptions) error
Creates a timeout. The timeout duration is specified using TimeoutOpt ions.
func (*GuildManager) GetChannel ¶
func (g *GuildManager) GetChannel(b *Bot, ChannelID string) (Channel, error)
Returns a Channel object.
func (*GuildManager) GetGuild ¶
func (g *GuildManager) GetGuild(b *Bot, GuildID string) (Guild, error)
Returns a Guild object.
func (*GuildManager) GetGuildChannels ¶
func (g *GuildManager) GetGuildChannels(b *Bot, GuildID string) ([]Channel, error)
Returns an array of Channel objects.
func (*GuildManager) GetGuildMember ¶
func (g *GuildManager) GetGuildMember(b *Bot, GuildID, UserID string) (GuildMember, error)
Returns a GuildMember object. Not fully functional.
func (*GuildManager) GetInvite ¶
func (g *GuildManager) GetInvite(b *Bot, Invite string) (GuildInvite, error)
Returns a GuildInvite object.
func (*GuildManager) GetRolesForUser ¶
func (g *GuildManager) GetRolesForUser(b *Bot, GuildID, UserID string) ([]Role, error)
Returns an array of role IDs.
func (*GuildManager) HasRole ¶
func (g *GuildManager) HasRole(b *Bot, GuildID, RoleID, UserID string) bool
Checks if an user has the specified role, in the given guild.
func (*GuildManager) KickUser ¶
func (g *GuildManager) KickUser(b *Bot, GuildID, User string) error
Kicks an user.
func (*GuildManager) PinMessage ¶
func (g *GuildManager) PinMessage(b *Bot, ChannelID, MessageID string) error
Pins a message.
func (*GuildManager) RemoveMessageFromPins ¶
func (g *GuildManager) RemoveMessageFromPins(b *Bot, ChannelID, MessageID string) error
Unpins a message.
func (*GuildManager) RemoveTimeout ¶
func (g *GuildManager) RemoveTimeout(b *Bot, GuildID, UserID string) error
Removes a timeout.
func (*GuildManager) SetChannelTopic ¶
func (g *GuildManager) SetChannelTopic(b *Bot, ChannelID, Topic string) error
Sets a channel's topic.
func (*GuildManager) SetUserNickname ¶
func (g *GuildManager) SetUserNickname(b *Bot, GuildID, Member, Nickname string) (User, error)
Sets an user's nickname. Returns an User object.
type GuildMember ¶
type GuildMember struct { User *User `json:"user,omitempty"` Nick *string `json:"nick,omitempty"` Avatar *string `json:"avatar,omitempty"` Roles []string `json:"roles"` JoinedAt string `json:"joined_at"` PremiumSince *string `json:"premium_since,omitempty"` Deaf bool `json:"deaf"` Mute bool `json:"mute"` Flags int `json:"flags"` Pending *bool `json:"pending,omitempty"` Permissions *string `json:"permissions,omitempty"` CommunicationDisabledUntil *string `json:"communication_disabled_until,omitempty"` }
type HeartbeatPayloadData ¶
type HeartbeatPayloadData struct {
HeartbeatInterval int `json:"heartbeat_interval"`
}
type Message ¶
type Message struct { ID string `json:"id"` Type int `json:"type"` Content string `json:"content"` ChannelID string `json:"channel_id"` GuildID string `json:"guild_id,omitempty"` Author struct { ID string `json:"id"` Username string `json:"username"` Avatar string `json:"avatar"` Discriminator string `json:"discriminator"` } `json:"author"` MentionEveryone bool `json:"mention_everyone"` Mentions []User `json:"mentions"` Timestamp string `json:"timestamp"` MessageReference *MessageReference `json:"message_reference,omitempty"` ReferencedMessage *Message `json:"referenced_message,omitempty"` TTS bool `json:"tts"` }
type MessageReference ¶
type Permission ¶
type Permission int64
const ( CreateInstantInvite Permission = 1 << iota KickMembers BanMembers Administrator ManageChannels ManageGuild AddReactions ViewAuditLog PrioritySpeaker Stream ViewChannel SendMessages SendTTSMessage ManageMessages EmbedLinks AttachFiles ReadMessageHistory MentionEveryone UseExternalEmojis ViewGuildInsights Connect Speak MuteMembers DeafenMembers MoveMembers UseVAD ChangeNickname ManageNicknames ManageRoles ManageWebhooks ManageGuildExpressions UseApplicationCommands RequestToSpeak ManageEvents ManageThreads CreatePublicThreads CreatePrivateThreads UseExternalStickers SendMessagesInThreads UseEmbeddedActivities ModerateMembers ViewCreatorMonetizationAnalytics UseSoundboard CreateGuildExpressions CreateEvents UseExternalSounds SendVoiceMessages )
type Role ¶
type Role struct { ID string `json:"id"` Name string `json:"name"` Color int `json:"color"` Hoist bool `json:"hoist"` Icon *string `json:"icon,omitempty"` UnicodeEmoji *string `json:"unicode_emoji,omitempty"` Position int `json:"position"` Permissions string `json:"permissions"` Managed bool `json:"managed"` Mentionable bool `json:"mentionable"` Tags *RoleTags `json:"tags,omitempty"` Flags int `json:"flags"` }
func (*Role) HasPermission ¶
func (r *Role) HasPermission(permission Permission) bool
type RoleTags ¶
type RoleTags struct { BotID string `json:"bot_id,omitempty"` IntegrationID string `json:"integration_id,omitempty"` PremiumSubscriber *bool `json:"premium_subscriber,omitempty"` SubscriptionListingID string `json:"subscription_listing_id,omitempty"` AvailableForPurchase *bool `json:"available_for_purchase,omitempty"` GuildConnections *bool `json:"guild_connections,omitempty"` }
type StatusOptions ¶
type StickerPack ¶
type StickerPacks ¶
type ThreadMember ¶
type ThreadMember struct { ID *string `json:"id,omitempty"` UserID *string `json:"user_id,omitempty"` JoinTimestamp string `json:"join_timestamp"` Flags int `json:"flags"` Member *GuildMember `json:"member,omitempty"` }
type ThreadMetadata ¶
type TimeoutOptions ¶
type User ¶
type User struct { ID string `json:"id"` Username string `json:"username"` Discriminator string `json:"discriminator"` GlobalName *string `json:"global_name,omitempty"` Avatar *string `json:"avatar,omitempty"` Bot *bool `json:"bot,omitempty"` System *bool `json:"system,omitempty"` MFAEnabled *bool `json:"mfa_enabled,omitempty"` Banner *string `json:"banner,omitempty"` AccentColor *int `json:"accent_color,omitempty"` Locale string `json:"locale"` Verified *bool `json:"verified,omitempty"` Email *string `json:"email,omitempty"` Flags *int `json:"flags,omitempty"` PremiumType *int `json:"premium_type,omitempty"` PublicFlags *int `json:"public_flags,omitempty"` AvatarDecoration *string `json:"avatar_decoration,omitempty"` }
type UserManager ¶
type UserManager struct{}
This contains all of the user functions.
func (*UserManager) ChangeStatus ¶
func (u *UserManager) ChangeStatus(b *Bot, Options StatusOptions) error
Changes status.
func (*UserManager) CreateFriendInvite ¶
func (u *UserManager) CreateFriendInvite(b *Bot) (GuildInvite, error)
Creates a Friend Invite. Returns a GuildInvite object
func (*UserManager) DeleteMessage ¶
func (u *UserManager) DeleteMessage(b *Bot, ChannelID, MessageID string) error
Deletes a Discord message.
func (*UserManager) EditMessage ¶
func (u *UserManager) EditMessage(b *Bot, ChannelID, MessageID string, Content string) (Message, error)
Edits a Discord message. Returns a Message object.
func (*UserManager) GetFriends ¶
func (u *UserManager) GetFriends(b *Bot) ([]Friend, error)
Returns an array of Friend objects.
func (*UserManager) SendMessage ¶
func (u *UserManager) SendMessage(b *Bot, ChannelID, Content string) (Message, error)
Sends a Discord message. Returns a Message object.
func (*UserManager) SendMessageWithReply ¶
func (u *UserManager) SendMessageWithReply(b *Bot, ChannelID, MessageID, Content string) (Message, error)
Replies to a Discord message. Returns a Message object.
func (*UserManager) SendTyping ¶
func (u *UserManager) SendTyping(b *Bot, ChannelID string) error
Post a typing indicator for the specified channel.
func (*UserManager) SetPresence ¶
func (u *UserManager) SetPresence(b *Bot, activity ActivityStructure) error
type Webhook ¶
type Webhook struct { ID string `json:"id"` Type int `json:"type"` GuildID string `json:"guild_id,omitempty"` ChannelID string `json:"channel_id,omitempty"` User User `json:"user,omitempty"` Name string `json:"name,omitempty"` Avatar string `json:"avatar,omitempty"` Token string `json:"token,omitempty"` ApplicationID string `json:"application_id,omitempty"` SourceGuild Guild `json:"source_guild,omitempty"` SourceChannel Channel `json:"source_channel,omitempty"` URL string `json:"url,omitempty"` }
type WebhookManager ¶
type WebhookManager struct{}
This contains all of the webhook functions.
func (*WebhookManager) CreateWebhook ¶
func (w *WebhookManager) CreateWebhook(b *Bot, ChannelID, Name string) (Webhook, error)
Creates a new Discord webhook. Returns a Webhook object.
func (*WebhookManager) DeleteWebhook ¶
func (w *WebhookManager) DeleteWebhook(b *Bot, WebhookID string) error
Deletes a Discord webhook. Requires MANAGE_WEBHOOKS.
func (*WebhookManager) GetChannelWebhooks ¶
func (w *WebhookManager) GetChannelWebhooks(b *Bot, ChannelID string) ([]Webhook, error)
Returns all of the webhooks from the specified channel.
type WelcomeScreen ¶
type WelcomeScreen struct { Description *string `json:"description,omitempty"` WelcomeChannels []WelcomeScreenChannel `json:"welcome_channels,omitempty"` }