Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Amputation ¶
type Amputation struct { CreatedAt time.Time UUID string `gorm:"primaryKey"` AmputationEventUUID string ServerID string RequestURL string RequestDomainName string ResponseURL string ResponseDomainName string Cached bool }
This is the representation of request and response URLs from users or the Amputator API.
type AmputationEvent ¶
type AmputationEvent struct { CreatedAt time.Time UUID string `gorm:"primaryKey"` AuthorId string AuthorUsername string ChannelId string MessageId string ServerID string Amputations []Amputation `gorm:"foreignKey:AmputationEventUUID"` }
Every successful AmputationEvent will come from a message.
type AmputatorBot ¶
type AmputatorBot struct { DB *gorm.DB DG *discordgo.Session Config AmputatorBotConfig StartingUp bool }
func (*AmputatorBot) BotReady ¶
func (bot *AmputatorBot) BotReady(s *discordgo.Session, r *discordgo.Ready)
BotReady is called when the bot is considered ready to use the Discord session.
func (*AmputatorBot) GuildCreate ¶
func (bot *AmputatorBot) GuildCreate(s *discordgo.Session, gc *discordgo.GuildCreate)
GuildCreate is called whenever the bot joins a new guild. It is also lazily called upon initial connection to Discord.
func (*AmputatorBot) MessageCreate ¶
func (bot *AmputatorBot) MessageCreate(s *discordgo.Session, m *discordgo.MessageCreate)
This function will be called (due to AddHandler above) every time a new message is created on any channel that the authenticated bot has access to.
func (AmputatorBot) StartHealthAPI ¶
func (b AmputatorBot) StartHealthAPI()
type AmputatorBotConfig ¶
type MessageEvent ¶
type MessageEvent struct { CreatedAt time.Time UUID string `gorm:"primaryKey"` AuthorId string AuthorUsername string MessageId string Command string ChannelId string ServerID string AmputationEvents []AmputationEvent `gorm:"foreignKey:UUID"` }
A MessageEvent is created when we receive a message that requires our attention
type ServerConfig ¶
type ServerConfig struct { DiscordId string `gorm:"primaryKey" pretty:"Server ID"` Name string `pretty:"Server Name"` AmputationEnabled bool `pretty:"Amputation Enabled"` ReplyToOriginalMessage bool `pretty:"Reply to original message"` UseEmbed bool `pretty:"Use embed to reply"` GuessAndCheck bool `pretty:"Guess at AMP URLs if they are difficult"` MaxDepth int `pretty:"How many links deep to go to try to find the non-AMP link"` }
type ServerRegistration ¶
type ServerRegistration struct { DiscordId string `gorm:"primaryKey"` Name string UpdatedAt time.Time Config ServerConfig `gorm:"foreignKey:DiscordId"` }
Click to show internal directories.
Click to hide internal directories.