mogbot

package
v0.0.0-...-1520e54 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 1, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LogTypeJoinLeave = iota
	LogTypeMemberUpdate
	LogTypeServerUpdate
	LogTypeMessageUpdate
	LogTypeChannelUpdate
	LogTypeModMail
	LogTypeMod
)
View Source
const (
	DiscordEpoch = 1420070400000
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BibleBook

type BibleBook struct {
	gorm.Model
	DefaultName string `gorm:"uniqueIndex"`
}

type BibleBookName

type BibleBookName struct {
	gorm.Model
	BibleBookID uint `gorm:"index"`
	BibleBook   BibleBook
	Name        string `gorm:"index"`
}

type BibleBookNameService

type BibleBookNameService interface {
	AddBibleBookName(name BibleBookName) (uint, error)
	AddBibleBookNames(names []BibleBookName) ([]uint, error)
	BibleBookName(id uint) (BibleBookName, error)
	BibleBookNamesByBook(bookID uint) ([]BibleBookName, error)
	UpdateBibleBookName(name BibleBookName) (uint, error)
	RemoveBibleBookName(id uint) (uint, error)
}

type BibleBookService

type BibleBookService interface {
	AddBibleBook(book BibleBook) (uint, error)
	AddBibleBooks(books []BibleBook) ([]uint, error)
	BibleBook(id uint) (BibleBook, error)
	BibleBookByAbbreviation(abbreviation string) (BibleBook, error)
	BibleBookByName(name string) (BibleBook, error)
	UpdateBibleBook(book BibleBook) (uint, error)
	RemoveBibleBook(id uint) (uint, error)
}

type BibleVerse

type BibleVerse struct {
	gorm.Model
	BibleVersionID uint `gorm:"index:idx_verse_info,unique"`
	BibleVersion   BibleVersion
	BibleBookID    uint `gorm:"index:idx_verse_info,unique"`
	BibleBook      BibleBook
	Chapter        int `gorm:"index:idx_verse_info,unique"`
	VerseNumber    int `gorm:"index:idx_verse_info,unique"`
	Content        string
}

func FilterBibleVerses

func FilterBibleVerses(vs []BibleVerse, f func(BibleVerse) bool) []BibleVerse

func (*BibleVerse) String

func (bv *BibleVerse) String() string

type BibleVerseService

type BibleVerseService interface {
	AddBibleVerse(verse BibleVerse) (uint, error)
	AddBibleVerses(verses []BibleVerse) ([]uint, error)
	BibleVerse(id uint) (BibleVerse, error)
	BibleVerseByNumber(version, book string, chapter, verseNum int) (BibleVerse, error)
	BibleVerseRange(version, book string, chapterStart, chapterEnd, verseStart, verseEnd int) ([]BibleVerse, error)
	BibleVersesByChapter(version, book string, chapter int) ([]BibleVerse, error)
	UpdateBibleVerse(verse BibleVerse) (uint, error)
	RemoveBibleVerse(id uint) (uint, error)
	RemoveBibleVerseByNumber(version, book string, chapter, verseNum int) (uint, error)
}

type BibleVersion

type BibleVersion struct {
	gorm.Model
	Name         string `gorm:"unique"`
	Abbreviation string `gorm:"unique"`
}

type BibleVersionService

type BibleVersionService interface {
	AddBibleVersion(version BibleVersion) (uint, error)
	AddBibleVersions(versions []BibleVersion) ([]uint, error)
	BibleVersion(id uint) (BibleVersion, error)
	BibleVersionByAbbreviation(abv string) (BibleVersion, error)
	BibleVersions() ([]BibleVersion, error)
	RemoveBibleVersion(id uint) (uint, error)
	RemoveBibleVersionByAbbreviation(abv string) (uint, error)
}

type Bot

type Bot struct {
	*discordgo.Session
	DB Database
	*slash.Router
	*router.Route
	Handlers []Handler
}

func NewBot

func NewBot(token string, db Database) *Bot

func (*Bot) Wait

func (b *Bot) Wait()

type Database

type Database interface {
	UserService
	GuildService
	MemberService
	RoleService
}

type Guild

type Guild struct {
	gorm.Model
	Snowflake               string `gorm:"unique"`
	GreetMsg                string
	LeaveMsg                string
	MsgXP                   int
	LevelMsg                string
	RankMsg                 string
	ModMailChannelSnowflake string
}

type GuildService

type GuildService interface {
	AddGuild(guild Guild) (uint, error)
	AddGuilds(guilds []Guild) ([]uint, error)
	Guild(id uint) (Guild, error)
	GuildBySnowflake(snowflake string) (Guild, error)
	Guilds() ([]Guild, error)
	UpdateGuild(guild Guild) (uint, error)
	RemoveGuild(id uint) (uint, error)
	RemoveGuildBySnowflake(snowflake string) (uint, error)
}

type Handler

type Handler func(*Bot) interface{}

type Log

type Log struct {
	gorm.Model
	GuildID   uint
	Guild     Guild
	Snowflake string    `gorm:"uniqueIndex"`
	LogTypes  []LogType `gorm:"many2many:log_log_types"`
}

type LogEntry

type LogEntry struct {
	gorm.Model
	LogID       uint
	Log         Log
	MessageID   string
	ModeratorID string
	Member      Member
}

type LogEntryService

type LogEntryService interface {
	AddLogEntry(entry LogEntry) (uint, error)
	LogEntry()
	RemoveLogEntry(id uint) (uint, error)
}

type LogService

type LogService interface {
	AddLog(log Log) (uint, error)
	Log(guildID uint, snowflake string) (Log, error)
	LogByID(logID uint) (Log, error)
	GuildLogs(snowflake string) ([]Log, error)
	GuildLogsByType(guildID uint, snowflake string, logTypes ...int) ([]Log, error)
	UpdateLog(log Log) (uint, error)
	RemoveLog(guildID uint, snowflake string) (uint, error)
}

type LogType

type LogType struct {
	ID uint `gorm:"primaryKey"`
}

type LogTypeService

type LogTypeService interface {
	AddLogType(logType LogType) (uint, error)
	LogType(logTypeID uint) (LogType, error)
	LogTypes() ([]LogType, error)
}

type Member

type Member struct {
	gorm.Model
	UserID  uint
	User    User
	GuildID uint
	Guild   Guild
	Roles   []Role
}

type MemberService

type MemberService interface {
	AddMember(*Member) error
	Member(string, string) (*Member, error)
	GuildMembers(string) ([]*Member, error)
	UpdateMember(*Member) error
	RemoveMember(string, string) error
}

type ModMailEntry

type ModMailEntry struct {
	ID        int64  `json:"id"`
	GuildID   string `json:"guild_id"`
	ChannelID string `json:"channel_id"`
	UserID    string `json:"user_id"`
}

type ModMailEntryService

type ModMailEntryService interface {
	AddModMailEntry(ModMailEntry) (int64, error)
	GetModMailEntry(int64) (*ModMailEntry, error)
	GetGuildModMailEntries(string) ([]ModMailEntry, error)
	GetAllModMailEntries() ([]ModMailEntry, error)
	UpdateModMailEntry(ModMailEntry) error
	RemoveModMailEntry(int64) error
}

type ReactionRole

type ReactionRole struct {
	ID        int64  `json:"id"`
	RoleID    string `json:"role_id"`
	GuildID   string `json:"guild_id"`
	ChannelID string `json:"channel_id"`
	MessageID string `json:"message_id"`
	Emoji     string `json:"emoji"`
}

type ReactionRoleService

type ReactionRoleService interface {
	AddReactionRole(*ReactionRole) error
	ReactionRole(string, string) (*ReactionRole, error)
	GuildReactionRoles(string) ([]*ReactionRole, error)
	MessageReactionRoles(guildID, channelID, messageID string) ([]*ReactionRole, error)
	UpdateReactionRole(string, int64) error
	RemoveReactionRole(string, int64) error
}

type Role

type Role struct {
	gorm.Model
	GuildID   uint
	Guild     Guild  `gorm:"uniqueIndex"`
	Snowflake string `gorm:"uniqueIndex"`
	Sticky    bool
	Auto      bool
	Mod       bool
}

func FindRole

func FindRole(roleID string, roles []*Role) (*Role, bool)

type RoleService

type RoleService interface {
	AddRole(role Role) (uint, error)
	Role(snowflake string) (Role, error)
	GuildRoles(guildSF string) ([]Role, error)
	UpdateRole(role Role) (uint, error)
	RemoveRole(string) (uint, error)
}

type Sound

type Sound struct {
	ID   int64
	Name string
	Path string
}

type SoundService

type SoundService interface {
	AddSound(*Sound) error
	GetSoundByID(id string) (*Sound, error)
	GetSoundByName(name string) (*Sound, error)
	GetAllSounds() ([]*Sound, error)
	UpdateSound(id string, fields map[string]interface{}) error
	RemoveSound(id string)
}

type Soundboard

type Soundboard struct {
	// contains filtered or unexported fields
}

func (*Soundboard) ClearBuffer

func (s *Soundboard) ClearBuffer()

func (*Soundboard) FillBuffer

func (s *Soundboard) FillBuffer(b [][]byte)

func (*Soundboard) PlayBuffer

func (s *Soundboard) PlayBuffer(ses *discordgo.Session, guildID, channelID string) error

type User

type User struct {
	gorm.Model
	Snowflake      string `gorm:"unique"`
	BibleVersionID uint
	BibleVersion   BibleVersion
}

type UserService

type UserService interface {
	AddUser(user User) (uint, error)
	AddUsers(users []User) ([]uint, error)
	User(id uint) (User, error)
	UserBySnowflake(snowflake string) (User, error)
	Users() ([]User, error)
	UpdateUser(user User) (uint, error)
	RemoveUser(id uint) (uint, error)
	RemoveUserBySnowflake(snowflake string) (uint, error)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL