Documentation ¶
Index ¶
- type ArchiveEvent
- type ArchiverBot
- func (bot *ArchiverBot) BotReadyHandler(s *discordgo.Session, r *discordgo.Ready)
- func (bot *ArchiverBot) GuildCreateHandler(s *discordgo.Session, gc *discordgo.GuildCreate)
- func (bot *ArchiverBot) GuildDeleteHandler(s *discordgo.Session, gd *discordgo.GuildDelete)
- func (bot *ArchiverBot) InteractionHandler(s *discordgo.Session, i *discordgo.InteractionCreate)
- func (bot *ArchiverBot) SettingsIntegrationResponse(sc ServerConfig) *discordgo.InteractionResponseData
- func (b ArchiverBot) StartHealthAPI()
- type ArchiverBotConfig
- type ServerConfig
- type ServerRegistration
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ArchiveEvent ¶
type ArchiveEvent struct { CreatedAt time.Time UUID string `gorm:"primaryKey;uniqueIndex"` ArchiveEventEventUUID string ServerID string `gorm:"index"` ServerName string RequestURL string RequestDomainName string `gorm:"index"` ResponseURL string ResponseDomainName string `gorm:"index"` Cached bool }
This is the representation of request and response URLs from users or the Archiver API
type ArchiverBot ¶
type ArchiverBot struct { DB *gorm.DB DG *discordgo.Session Config ArchiverBotConfig }
Handlers ArchiverBot is the main type passed around throughout the code It has many functions for overall bot management
func (*ArchiverBot) BotReadyHandler ¶
func (bot *ArchiverBot) BotReadyHandler(s *discordgo.Session, r *discordgo.Ready)
BotReadyHandler is called when the bot is considered ready to use the Discord session
func (*ArchiverBot) GuildCreateHandler ¶
func (bot *ArchiverBot) GuildCreateHandler(s *discordgo.Session, gc *discordgo.GuildCreate)
GuildCreateHandler is called whenever the bot joins a new guild.
func (*ArchiverBot) GuildDeleteHandler ¶
func (bot *ArchiverBot) GuildDeleteHandler(s *discordgo.Session, gd *discordgo.GuildDelete)
GuildDeleteHandler is called whenever the bot leaves a guild.
func (*ArchiverBot) InteractionHandler ¶
func (bot *ArchiverBot) InteractionHandler(s *discordgo.Session, i *discordgo.InteractionCreate)
InteractionInit configures all interactive commands
func (*ArchiverBot) SettingsIntegrationResponse ¶
func (bot *ArchiverBot) SettingsIntegrationResponse(sc ServerConfig) *discordgo.InteractionResponseData
SettingsIntegrationResponse returns server settings in a *discordgo.InteractionResponseData
func (ArchiverBot) StartHealthAPI ¶
func (b ArchiverBot) StartHealthAPI()
type ArchiverBotConfig ¶
type ArchiverBotConfig struct { AdminIds []string `env:"ADMINISTRATOR_IDS"` DBHost string `env:"DB_HOST"` DBName string `env:"DB_NAME"` DBPassword string `env:"DB_PASSWORD"` DBUser string `env:"DB_USER"` LogLevel string `env:"LOG_LEVEL"` Token string `env:"TOKEN"` Cookie string `env:"COOKIE"` }
ArchiverBotConfig is attached to ArchiverBot so config settings can be accessed easily
type ServerConfig ¶
type ServerConfig struct { DiscordId string `gorm:"primaryKey;uniqueIndex" pretty:"Server ID"` Name string `pretty:"Server Name" gorm:"default:default"` ArchiveEnabled sql.NullBool `pretty:"Bot enabled" gorm:"default:true"` AlwaysArchiveFirst sql.NullBool `pretty:"Archive the page first (slower)" gorm:"default:false"` ShowDetails sql.NullBool `pretty:"Show extra details" gorm:"default:true"` RetryAttempts sql.NullInt32 `pretty:"Number of times to retry calling archive.org" gorm:"default:1"` RemoveRetriesDelay sql.NullInt32 `pretty:"Seconds to wait to remove retry button" gorm:"default:30"` UTCOffset sql.NullInt32 `pretty:"UTC Offset" gorm:"default:4"` UTCSign sql.NullString `pretty:"UTC Sign (Negative if west of Greenwich)" gorm:"default:-"` UpdatedAt time.Time }