Documentation ¶
Index ¶
- Constants
- Variables
- type BoltDb
- type CmdError
- type Db
- func (db *Db) AddNote(note *Note) (err error)
- func (db *Db) AddToModLog(entry *ModLogEntry) (out *ModLogEntry, err error)
- func (db *Db) AddToStarboardBlacklist(guildID, channelID string) (err error)
- func (db *Db) AddTrigger(t *Trigger) (*Trigger, error)
- func (db *Db) AllNotes(guildID string) (notes []*Note, err error)
- func (db *Db) DelNote(guildID string, id int) (err error)
- func (db *Db) DeleteStarboardEntry(messageID string) error
- func (db *Db) EditTrigger(guildID string, triggerID int, t *Trigger) (*Trigger, error)
- func (db *Db) GetAllLogs(guildID string) (out []*ModLogEntry, err error)
- func (db *Db) GetDBGuildSettings(g string) (s structs.GuildSettings, err error)
- func (db *Db) GetGuildSettings(g string) (s structs.GuildSettings, err error)
- func (db *Db) GetModLogs(guildID, userID string) (out []*ModLogEntry, err error)
- func (db *Db) GetOrigStarboardMessage(m string) (s string)
- func (db *Db) GetStarboardBlacklist(guildID string) (b []string, err error)
- func (db *Db) GetStarboardEntry(m string) (s string)
- func (db *Db) InStarboardBlacklist(guildID, channelID string) (b bool)
- func (db *Db) InitSettingsForGuild(guildID string) (err error)
- func (db *Db) InsertStarboardEntry(messageID, channelID, guildID, starboardMessageID string) error
- func (db *Db) Notes(guildID, userID string) (notes []*Note, err error)
- func (db *Db) RemoveFromGuildCache(g string) (err error)
- func (db *Db) RemoveFromStarboardBlacklist(guildID, channelID string) (err error)
- func (db *Db) RemoveTrigger(guildID string, triggerID int) (err error)
- func (db *Db) SetGatekeeperChannel(guildID, channelID string) (err error)
- func (db *Db) SetGatekeeperMsg(guildID, msg string) (err error)
- func (db *Db) SetGatekeeperRoles(guildID string, roles []string) (err error)
- func (db *Db) SetMemberRoles(guildID string, roles []string) (err error)
- func (db *Db) SetModLogChannel(guildID, channelID string) (err error)
- func (db *Db) SetStarboardChannel(channelID, guildID string) error
- func (db *Db) SetStarboardLimit(limit int, guildID string) error
- func (db *Db) SetWelcomeChannel(guildID, channelID string) (err error)
- func (db *Db) SetWelcomeMsg(guildID, msg string) (err error)
- func (db *Db) StarboardEmoji(g, e string) (err error)
- func (db *Db) ToggleSenderCanReact(g string) (err error)
- func (db *Db) Triggers(id string) (out []*Trigger, err error)
- type ModLogEntry
- type Note
- type Trigger
Constants ¶
const DBVersion = 7
DBVersion is the current database version
Variables ¶
var DBVersions []string = []string{
`create table if not exists notes (
id serial primary key,
guild_id text not null,
user_id text not null,
mod_id text not null,
note text not null,
created timestamp not null default (current_timestamp at time zone 'utc')
);
update public.info set schema_version = 2;`,
`create table if not exists mod_log (
id serial primary key,
guild_id text not null,
user_id text not null,
mod_id text not null,
type modaction not null,
reason text not null,
created timestamp not null default (current_timestamp at time zone 'utc')
);
update public.info set schema_version = 3;`,
`create table if not exists triggers (
id serial primary key,
guild_id text not null,
created_by text not null,
modified timestamp not null default (current_timestamp at time zone 'utc'),
trigger text not null,
response text not null
);
update public.info set schema_version = 4;`,
`create table if not exists yag_import (
guild_id text primary key references public.guild_settings (guild_id) on delete cascade,
log_channel text not null default '',
enabled boolean default false
);
update public.info set schema_version = 5;`,
`alter table public.mod_log add column yag_id int;
update public.info set schema_version = 6;`,
`drop table starboard_blacklisted_channels;
alter table public.guild_settings add column sb_blacklist text[] not null default array[]::text[];
alter table public.guild_settings add column cmd_blacklist text[] not null default array[]::text[];
update public.info set schema_version = 7;`,
}
DBVersions is a slice of schemas for every database version
Functions ¶
This section is empty.
Types ¶
type BoltDb ¶
BoltDb gives access to the bolt database
func (*BoltDb) InitForGuild ¶
InitForGuild initialises the buckets for a guild
type Db ¶
Db gives access to the database
func (*Db) AddToModLog ¶
func (db *Db) AddToModLog(entry *ModLogEntry) (out *ModLogEntry, err error)
AddToModLog adds the specified partial ModLogEntry to the moderation log, and returns the full object
func (*Db) AddToStarboardBlacklist ¶ added in v1.0.0
AddToStarboardBlacklist adds the given channelID to the blacklist for guildID
func (*Db) AddTrigger ¶ added in v1.0.0
AddTrigger ...
func (*Db) DeleteStarboardEntry ¶
DeleteStarboardEntry deletes an entry from the database
func (*Db) EditTrigger ¶ added in v1.0.0
EditTrigger ...
func (*Db) GetAllLogs ¶
func (db *Db) GetAllLogs(guildID string) (out []*ModLogEntry, err error)
GetAllLogs gets *all* the mod logs for a guild
func (*Db) GetDBGuildSettings ¶
func (db *Db) GetDBGuildSettings(g string) (s structs.GuildSettings, err error)
GetDBGuildSettings gets the guild settings from the database
func (*Db) GetGuildSettings ¶
func (db *Db) GetGuildSettings(g string) (s structs.GuildSettings, err error)
GetGuildSettings gets the guild settings for a specific guild
func (*Db) GetModLogs ¶
func (db *Db) GetModLogs(guildID, userID string) (out []*ModLogEntry, err error)
GetModLogs gets all the mod logs for a user
func (*Db) GetOrigStarboardMessage ¶
GetOrigStarboardMessage ...
func (*Db) GetStarboardBlacklist ¶ added in v1.0.0
GetStarboardBlacklist returns the channel blacklist for guildID
func (*Db) GetStarboardEntry ¶
GetStarboardEntry gets the starboard entry for the given ID
func (*Db) InStarboardBlacklist ¶ added in v1.0.0
InStarboardBlacklist checks if the given channelID is in the blacklist for guildID
func (*Db) InitSettingsForGuild ¶
InitSettingsForGuild initialises the settings for a guild iif it doesn't have any yet
func (*Db) InsertStarboardEntry ¶
InsertStarboardEntry inserts an entry into the database
func (*Db) RemoveFromGuildCache ¶
RemoveFromGuildCache removes a cache entry
func (*Db) RemoveFromStarboardBlacklist ¶ added in v1.0.0
RemoveFromStarboardBlacklist removes the given channelID from the blacklist for guildID
func (*Db) RemoveTrigger ¶ added in v1.0.0
RemoveTrigger ...
func (*Db) SetGatekeeperChannel ¶
SetGatekeeperChannel sets the gatekeeper channel for the given guild
func (*Db) SetGatekeeperMsg ¶
SetGatekeeperMsg sets the gatekeeper message for the given guild
func (*Db) SetGatekeeperRoles ¶
SetGatekeeperRoles sets the gatekeeper roles for the given guild
func (*Db) SetMemberRoles ¶
SetMemberRoles sets the gatekeeper roles for the given guild
func (*Db) SetModLogChannel ¶
SetModLogChannel sets the moderation log channel for the guild
func (*Db) SetStarboardChannel ¶
SetStarboardChannel sets the starboard channel for a guild
func (*Db) SetStarboardLimit ¶
SetStarboardLimit sets the starboard limit for a guild
func (*Db) SetWelcomeChannel ¶
SetWelcomeChannel sets the welcome channel for the given guild
func (*Db) SetWelcomeMsg ¶
SetWelcomeMsg sets the welcome message for the given guild
func (*Db) StarboardEmoji ¶
StarboardEmoji ...
func (*Db) ToggleSenderCanReact ¶
ToggleSenderCanReact ...
type ModLogEntry ¶
type ModLogEntry struct { ID int `json:"id"` GuildID string `json:"guild_id"` UserID string `json:"user_id"` ModID string `json:"mod_id"` Type string `json:"type"` Reason string `json:"reason"` Time time.Time `json:"timestamp"` }
ModLogEntry is an entry in the mod log