Documentation ¶
Index ¶
- Constants
- Variables
- type AniListUserData
- type Bot
- func (b *Bot) CanExecute(cmd Command, s *discordgo.Session, m *discordgo.MessageCreate, ...) bool
- func (b *Bot) CommandAllowed(c Command, cmdName string) bool
- func (b *Bot) FindLastMessageWithAttachOrEmbed(s *discordgo.Session, m *discordgo.MessageCreate, amount int) (result string, e error)
- func (b *Bot) GetAccountCreationDate(user *discordgo.User) (timestamp int64)
- func (b *Bot) GetCommandTarget(s *discordgo.Session, m *discordgo.MessageCreate, data *ServerData, ...) (target *discordgo.User)
- func (b *Bot) GetRoleByName(name string, roles []*discordgo.Role) (r discordgo.Role, e error)
- func (b *Bot) GetRolePermissions(id string, perms []*discordgo.PermissionOverwrite) (p discordgo.PermissionOverwrite, e error)
- func (b *Bot) GetRolePermissionsByName(ch *discordgo.Channel, sv *discordgo.Guild, name string) (p discordgo.PermissionOverwrite, e error)
- func (b *Bot) InitBot(m []Module, site Server, configPath string)
- func (b *Bot) IsBlocked(cmd string, data *ServerData) (isBlocked bool)
- func (b *Bot) ParseMention(tag string) (res string, err error)
- func (b *Bot) ServerDataFromChannel(s *discordgo.Session, channelID string) *ServerData
- func (b *Bot) ServerDataFromID(guildID string) *ServerData
- func (b *Bot) Usage(cmd Command, s *discordgo.Session, m *discordgo.MessageCreate, ...) *Embed
- type ChannelData
- type Command
- type CommandData
- type Config
- type Embed
- func (e *Embed) AddField(name, value string) *Embed
- func (e *Embed) AddInlineField(name, value string, inline bool) *Embed
- func (e *Embed) InlineAllFields() *Embed
- func (e *Embed) SetAuthor(args ...string) *Embed
- func (e *Embed) SetAuthorFromUser(author *discordgo.User) *Embed
- func (e *Embed) SetColor(clr int) *Embed
- func (e *Embed) SetColorFromUser(s *discordgo.Session, channelID string, author *discordgo.User) *Embed
- func (e *Embed) SetDescription(description string) *Embed
- func (e *Embed) SetFooter(args ...string) *Embed
- func (e *Embed) SetImage(args ...string) *Embed
- func (e *Embed) SetThumbnail(args ...string) *Embed
- func (e *Embed) SetTitle(name string) *Embed
- func (e *Embed) SetURL(URL string) *Embed
- func (e *Embed) Truncate() *Embed
- func (e *Embed) TruncateDescription() *Embed
- func (e *Embed) TruncateFields() *Embed
- func (e *Embed) TruncateFooter() *Embed
- func (e *Embed) TruncateTitle() *Embed
- type MeIrlData
- type Module
- type Server
- type ServerData
- func (data *ServerData) CreateCustomCommand(commandName, content string) (err error)
- func (data *ServerData) CreateMeIrl(meIrl MeIrlData) (err error)
- func (data *ServerData) DeleteCustomCommand(commandName string) (deleted bool, err error)
- func (data *ServerData) DeleteMeIrl(target string) (deleted bool, err error)
- func (data *ServerData) EditKey(key string) (err error)
- func (data *ServerData) UpdateBlockedCommand(commandName string, isBlocked bool) (err error)
- func (data *ServerData) UpdateCommander(userId string, isCommander bool) (err error)
- func (data *ServerData) WriteToDB() (err error)
- type UserData
Constants ¶
View Source
const ( EmbedLimitTitle = 256 EmbedLimitDescription = 2048 EmbedLimitFieldValue = 1024 EmbedLimitFieldName = 256 EmbedLimitField = 25 EmbedLimit = 4000 )
Constants for message embed character limits
Variables ¶
View Source
var ( ServerCollection *mongo.Collection RSSCollection *mongo.Collection UserCollection *mongo.Collection Log *logging.Logger )
Functions ¶
This section is empty.
Types ¶
type AniListUserData ¶
type Bot ¶
type Bot struct { ConfigPath string BotID string Config Config Modules []Module Server Server Session *discordgo.Session }
func (*Bot) CanExecute ¶
func (b *Bot) CanExecute(cmd Command, s *discordgo.Session, m *discordgo.MessageCreate, data *ServerData) bool
func (*Bot) FindLastMessageWithAttachOrEmbed ¶
func (*Bot) GetAccountCreationDate ¶
// discordgo.User helpers ////
func (*Bot) GetCommandTarget ¶
func (b *Bot) GetCommandTarget(s *discordgo.Session, m *discordgo.MessageCreate, data *ServerData, targetName string) (target *discordgo.User)
func (*Bot) GetRoleByName ¶
func (*Bot) GetRolePermissions ¶
func (b *Bot) GetRolePermissions(id string, perms []*discordgo.PermissionOverwrite) (p discordgo.PermissionOverwrite, e error)
Gets the permission override object from a role id.
func (*Bot) GetRolePermissionsByName ¶
func (*Bot) ServerDataFromChannel ¶
func (b *Bot) ServerDataFromChannel(s *discordgo.Session, channelID string) *ServerData
func (*Bot) ServerDataFromID ¶
func (b *Bot) ServerDataFromID(guildID string) *ServerData
func (*Bot) Usage ¶
func (b *Bot) Usage(cmd Command, s *discordgo.Session, m *discordgo.MessageCreate, data *ServerData) *Embed
type ChannelData ¶
type ChannelData struct { ID string `json:"id" bson:"id"` Albums []string `json:"albums" bson:"albums"` }
ChannelData is the data which is saved for every channel
type CommandData ¶
type CommandData struct { Name string `json:"name" bson:"name"` Content string `json:"content" bson:"content"` }
CommandData is the data which is saved for every command
type Config ¶
type Config struct { BotToken string `json:"bottoken"` OsuToken string `json:"osutoken"` ImgurToken string `json:"imgurtoken"` SauceNaoToken string `json:"saucenaotoken"` DataLocation string `json:"datalocation"` WebsiteUrl string `json:"websiteurl"` OwmToken string `json:"openweathermaptoken"` Mongo string `json:"mongo"` Database string `json:"database"` }
The Config of the bot
type Embed ¶
type Embed struct {
*discordgo.MessageEmbed
}
func (*Embed) AddInlineField ¶
AddField [name] [value]
func (*Embed) InlineAllFields ¶
InlineAllFields sets all fields in the embed to be inline
func (*Embed) SetColorFromUser ¶
func (e *Embed) SetColorFromUser(s *discordgo.Session, channelID string, author *discordgo.User) *Embed
SetColor ...
func (*Embed) SetDescription ¶
SetDescription [desc]
func (*Embed) TruncateDescription ¶
TruncateDescription ...
func (*Embed) TruncateFields ¶
TruncateFields truncates fields that are too long
type MeIrlData ¶
type MeIrlData struct { UserID string `json:"id" bson:"id"` Nickname string `json:"nickname" bson:"nickname"` Content string `json:"content" bson:"content"` }
MeIrlData is the data which is saved for every meIrlCommand
type Module ¶
type Module interface { Execute(*discordgo.Session, *discordgo.MessageCreate, *ServerData) HelpFields() (title string, content string) CommandInfo(name string, data *ServerData) (response *Embed, found bool) }
type ServerData ¶
type ServerData struct { ID string `json:"id" bson:"id"` Commanders map[string]bool `json:"commanders" bson:"commanders"` Channels map[string]*ChannelData `json:"channels" bson:"channels"` CustomCommands map[string]*CommandData `json:"commands" bson:"commands"` BlockedCommands map[string]bool `json:"blockedcommands" bson:"blockedcommands"` MeIrlData map[string]*MeIrlData `json:"me_irl" bson:"me_irl"` Key string `json:"Key" bson:"Key"` }
ServerData is the data which is saved for every server the bot is in.
func (*ServerData) CreateCustomCommand ¶
func (data *ServerData) CreateCustomCommand(commandName, content string) (err error)
func (*ServerData) CreateMeIrl ¶
func (data *ServerData) CreateMeIrl(meIrl MeIrlData) (err error)
func (*ServerData) DeleteCustomCommand ¶
func (data *ServerData) DeleteCustomCommand(commandName string) (deleted bool, err error)
func (*ServerData) DeleteMeIrl ¶
func (data *ServerData) DeleteMeIrl(target string) (deleted bool, err error)
func (*ServerData) EditKey ¶
func (data *ServerData) EditKey(key string) (err error)
func (*ServerData) UpdateBlockedCommand ¶
func (data *ServerData) UpdateBlockedCommand(commandName string, isBlocked bool) (err error)
func (*ServerData) UpdateCommander ¶
func (data *ServerData) UpdateCommander(userId string, isCommander bool) (err error)
func (*ServerData) WriteToDB ¶
func (data *ServerData) WriteToDB() (err error)
type UserData ¶
type UserData struct { UserId string `bson:"userid"` AniListData AniListUserData `bson:"anilistdata"` }
func UserDataFromID ¶
func UserDataFromMessage ¶
func UserDataFromMessage(m *discordgo.MessageCreate) (userData *UserData)
Click to show internal directories.
Click to hide internal directories.