Documentation ¶
Index ¶
- Variables
- type State
- func (s *State) AllChannelIDs() (guildIDs []string, err error)
- func (s *State) AllChannelsCount() (int, error)
- func (s *State) AllGuildIDs() (guildIDs []string, err error)
- func (s *State) AllGuildsCount() (int, error)
- func (s *State) AllUserIDs() (userIDs []string, err error)
- func (s *State) AllUsersCount() (int, error)
- func (s *State) BotForChannel(channelID string, permissions ...interfaces.Permission) (botID string, err error)
- func (s *State) BotForGuild(guildID string, permissions ...int64) (botID string, err error)
- func (s *State) Channel(channelID string) (channel *discordgo.Channel, err error)
- func (s *State) ChannelFromMention(guildID, mention string) (*discordgo.Channel, error)
- func (s *State) ChannelFromMentionTypes(guildID, mention string, types ...discordgo.ChannelType) (*discordgo.Channel, error)
- func (s *State) ChannelFromMentionTypesEverywhere(mention string, types ...discordgo.ChannelType) (*discordgo.Channel, error)
- func (s *State) ChannelMessages(channelID string) (messages []discordgo.Message, err error)
- func (s *State) Emoji(guildID, emojiID string) (emoji *discordgo.Emoji, err error)
- func (s *State) Guild(guildID string) (guild *discordgo.Guild, err error)
- func (s *State) GuildBans(guildID string) (userIDs []string, err error)
- func (s *State) GuildInvites(guildID string) (invites []*discordgo.Invite, err error)
- func (s *State) GuildInvitesWithRefresh(guildID string, session *discordgo.Session) (invites []*discordgo.Invite, err error)
- func (s *State) GuildMembers(guildID string) (userIDs []string, err error)
- func (s *State) GuildWebhooks(guildID string) (webhooks []*discordgo.Webhook, err error)
- func (s *State) IsMember(guildID, userID string) (isMember bool, err error)
- func (s *State) Member(guildID, userID string) (member *discordgo.Member, err error)
- func (s *State) Presence(guildID, userID string) (presence *discordgo.Presence, err error)
- func (s *State) Role(guildID, roleID string) (role *discordgo.Role, err error)
- func (s *State) RoleFromMention(guildID string, mention string) (*discordgo.Role, error)
- func (s *State) SharedStateEventHandler(session *discordgo.Session, i interface{}) error
- func (s *State) User(userID string) (user *discordgo.User, err error)
- func (s *State) UserChannelPermissions(userID, channelID string) (apermissions int64, err error)
- func (s *State) UserFromMention(mention string) (*discordgo.User, error)
- func (s *State) UserPermissions(userID, guildID string) (apermissions int64, err error)
- func (s *State) Webhook(id string) (webhook *discordgo.Webhook, err error)
Constants ¶
This section is empty.
Variables ¶
var ( ErrPresenceStateNotFound = errors.New("presence not found in state cache") ErrRoleStateNotFound = errors.New("role not found in state cache") ErrEmojiStateNotFound = errors.New("emoji not found in state cache") ErrBotForGuildStateNotFound = errors.New("bot for guild not found in state cache") ErrTargetWrongServer = errors.New("target is on wrong server") ErrTargetWrongType = errors.New("target is of wrong type") ErrUserNotFound = errors.New("user not found") ErrChannelNotFound = errors.New("channel not found") ErrRoleNotFound = errors.New("role not found") )
defines various errors used
var ( // MentionRegex matches Discord User Mentions // Source: https://github.com/b1naryth1ef/disco/blob/master/disco/bot/command.py#L15, modified to accept IDs MentionRegex = regexp.MustCompile("(<@!?)?([0-9]+)(>)?") // RoleRegex matches Discord Role Mentions // Source: https://github.com/b1naryth1ef/disco/blob/master/disco/bot/command.py#L16, modified to accept IDs RoleRegex = regexp.MustCompile("(<@&)?([0-9]+)(>)?") // ChannelRegex matches Discord Channel Mentions // Source: https://github.com/b1naryth1ef/disco/blob/master/disco/bot/command.py#L17, modified to accept IDs ChannelRegex = regexp.MustCompile("(<#)?([0-9]+)(>)?") )
Functions ¶
This section is empty.
Types ¶
type State ¶
type State struct {
// contains filtered or unexported fields
}
func (*State) AllChannelIDs ¶
AllChannelIDs returns a list of all Channel IDs from the shared state
func (*State) AllChannelsCount ¶
func (*State) AllGuildIDs ¶
AllGuildIDs returns a list of all Guild IDs from the shared state
func (*State) AllGuildsCount ¶
func (*State) AllUserIDs ¶
AllUserIDs returns a list of all User IDs from the shared state
func (*State) AllUsersCount ¶
func (*State) BotForChannel ¶
func (s *State) BotForChannel( channelID string, permissions ...interfaces.Permission, ) ( botID string, err error, )
BotForChannel returns a Bot User ID for the given Channel ID matches the Permissions if specified
func (*State) BotForGuild ¶
BotForGuild returns a Bot User ID for the given Guild ID matches the Discord Permissions if specified if possible one should use BotForChannel with the specific permissions
func (*State) Channel ¶
Channel returns the specified Channel from the shard state, returns ErrStateNotFound if not found
func (*State) ChannelFromMention ¶
ChannelFromMention finds a text channel on the same server in an mention, can be direct ID input
func (*State) ChannelFromMentionTypes ¶
func (s *State) ChannelFromMentionTypes( guildID, mention string, types ...discordgo.ChannelType, ) (*discordgo.Channel, error)
ChannelFromMention finds a channel on the same server in an mention, can be direct ID input
func (*State) ChannelFromMentionTypesEverywhere ¶
func (s *State) ChannelFromMentionTypesEverywhere( mention string, types ...discordgo.ChannelType, ) (*discordgo.Channel, error)
ChannelFromMentionTypesEverywhere finds a channel on any server in an mention, can be direct ID input
func (*State) ChannelMessages ¶
ChannelMessages returns the messages of a channel
func (*State) Emoji ¶
Emoji returns the specified Emoji from the shard state, returns ErrStateNotFound if not found
func (*State) Guild ¶
Guild returns the specified Guild from the shard state, returns ErrStateNotFound if not found
func (*State) GuildBans ¶
GuildBans returns the banned user IDs of a server only contains items if the bot has the Ban Members or Administrator permission
func (*State) GuildInvites ¶
func (*State) GuildInvitesWithRefresh ¶
func (*State) GuildMembers ¶
GuildUserIDs returns a list of all User IDs in a specific Guild from the shared state
func (*State) GuildWebhooks ¶
func (*State) Member ¶
Member returns the specified Member from the shard state, returns ErrStateNotFound if not found
func (*State) Presence ¶
Presence returns the specified Presence from the shard state, returns ErrStateNotFound if not found
func (*State) Role ¶
Role returns the specified Role from the shard state, returns ErrStateNotFound if not found
func (*State) RoleFromMention ¶
RoleFromMention finds a role in the mention, can be direct ID input
func (*State) SharedStateEventHandler ¶
SharedStateEventHandler receives events from a discordgo Websocket and updates the shared state with them
func (*State) User ¶
User returns the specified User from the shard state, returns ErrStateNotFound if not found
func (*State) UserChannelPermissions ¶
UserChannelPermissions returns the permission of a user in a channel
func (*State) UserFromMention ¶
UserFromMention finds an user in a mention, can be direct ID input
func (*State) UserPermissions ¶
UserPermissions returns the permissions of a user in a guild