Documentation ¶
Index ¶
- func Decrypt(ciphertext []byte, key [32]byte) (plaintext []byte, err error)
- func Encrypt(plaintext []byte, key [32]byte) (ciphertext []byte, err error)
- func RunMigrations(postgres string) (err error)
- type Channels
- type DB
- func (db *DB) Channels(guildID discord.GuildID) (chs Channels, err error)
- func (db *DB) CreateGuild(id discord.GuildID) (alreadyExists bool, err error)
- func (db *DB) DeleteMessage(id discord.MessageID) error
- func (db *DB) GetMessage(id discord.MessageID) (m *Message, err error)
- func (db *DB) HasPKInfo(msgID discord.MessageID) (exists bool)
- func (db *DB) IgnoreMessage(id discord.MessageID) error
- func (db *DB) InsertMessage(m Message) (err error)
- func (db *DB) IsMessageIgnored(id discord.MessageID) (isIgnored bool, err error)
- func (db *DB) SetChannels(guildID discord.GuildID, chs Channels) error
- func (db *DB) UpdatePKInfo(msgID, originalID discord.MessageID, userID pkgo.Snowflake, ...) (err error)
- func (db *DB) UpdateUserID(msgID discord.MessageID, userID discord.UserID) (err error)
- type Ignores
- type LogChannels
- type Message
- type Metadata
- type Redirects
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Decrypt ¶
Decrypt decrypts data using 256-bit AES-GCM. This both hides the content of the data and provides a check that it hasn't been altered. Expects input form nonce|ciphertext|tag where '|' indicates concatenation.
func Encrypt ¶
Encrypt encrypts data using 256-bit AES-GCM. This both hides the content of the data and provides a check that it hasn't been altered. Output takes the form nonce|ciphertext|tag where '|' indicates concatenation.
func RunMigrations ¶
RunMigrations runs all of the migrations in migrations/.
Types ¶
type Channels ¶
type Channels struct { Channels LogChannels Redirects Redirects Ignores Ignores }
type DB ¶
func (*DB) CreateGuild ¶
func (*DB) DeleteMessage ¶
DeleteMessage deletes a message from the database
func (*DB) GetMessage ¶
GetMessage gets a single message
func (*DB) InsertMessage ¶
InsertMessage inserts a message
func (*DB) IsMessageIgnored ¶
type LogChannels ¶
type LogChannels struct { GuildUpdate discord.ChannelID `json:"GUILD_UPDATE"` GuildEmojisUpdate discord.ChannelID `json:"GUILD_EMOJIS_UPDATE"` GuildRoleCreate discord.ChannelID `json:"GUILD_ROLE_CREATE"` GuildRoleUpdate discord.ChannelID `json:"GUILD_ROLE_UPDATE"` GuildRoleDelete discord.ChannelID `json:"GUILD_ROLE_DELETE"` ChannelCreate discord.ChannelID `json:"CHANNEL_CREATE"` ChannelUpdate discord.ChannelID `json:"CHANNEL_UPDATE"` ChannelDelete discord.ChannelID `json:"CHANNEL_DELETE"` GuildMemberAdd discord.ChannelID `json:"GUILD_MEMBER_ADD"` GuildMemberUpdate discord.ChannelID `json:"GUILD_MEMBER_UPDATE"` GuildKeyRoleUpdate discord.ChannelID `json:"GUILD_KEY_ROLE_UPDATE"` GuildMemberNickUpdate discord.ChannelID `json:"GUILD_MEMBER_NICK_UPDATE"` GuildMemberAvatarUpdate discord.ChannelID `json:"GUILD_MEMBER_AVATAR_UPDATE"` GuildMemberRemove discord.ChannelID `json:"GUILD_MEMBER_REMOVE"` GuildMemberKick discord.ChannelID `json:"GUILD_MEMBER_KICK"` GuildBanAdd discord.ChannelID `json:"GUILD_BAN_ADD"` GuildBanRemove discord.ChannelID `json:"GUILD_BAN_REMOVE"` InviteCreate discord.ChannelID `json:"INVITE_CREATE"` InviteDelete discord.ChannelID `json:"INVITE_DELETE"` MessageUpdate discord.ChannelID `json:"MESSAGE_UPDATE"` MessageDelete discord.ChannelID `json:"MESSAGE_DELETE"` MessageDeleteBulk discord.ChannelID `json:"MESSAGE_DELETE_BULK"` }
LogChannels is the map of log channels stored per server
type Message ¶
type Message struct { ID discord.MessageID OriginalID *discord.MessageID UserID discord.UserID ChannelID discord.ChannelID GuildID discord.GuildID Content string `db:"-"` Username string `db:"-"` EncryptedContent []byte `db:"content"` EncryptedUsername []byte `db:"username"` // These are only filled if the message was proxied by PluralKit Member *string System *string Metadata *Metadata `db:"-"` RawMetadata *[]byte `db:"metadata"` AttachmentSize uint64 }
Message is a single message