mogbot

package
v0.0.0-...-b906e08 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

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

Variables

This section is empty.

Functions

func SetField

func SetField(obj interface{}, name string, value interface{}) error

Types

type Bot

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

func New

func New(token string, db Database) *Bot

func (*Bot) Wait

func (b *Bot) Wait()

type Database

type Database interface {
	UserService
}

type Guild

type Guild struct {
	ID       string
	GreetMsg string
	LeaveMsg string
	MsgXP    int
	LevelMsg string
	RankMsg  string
	//ModLogID       string
	//ServerLogID    string
	//MemberLogID    string
	//VoiceLogID     string
	//MessageLogID   string
	//JoinLeaveLogID string
	//ModMailLogID   string
	Prefixes []string
}

type GuildService

type GuildService interface {
	AddGuild(*Guild) error
	GetGuild(string) (*Guild, error)
	GetAllGuilds() ([]Guild, error)
	UpdateGuild(string, map[string]interface{}) (*Guild, error)
	RemoveGuild(string) error
}

type Handler

type Handler func(*Bot) interface{}

type Log

type Log struct {
	ID    string
	Types []int
}

type LogService

type LogService interface {
	AddLog(*Log) error
	GetLogByID(string) (*Log, error)
	GetLogsByType(int) ([]*Log, error)
	UpdateLog(string, map[string]interface{}) (*Log, error)
	RemoveLog(string) error
}

type Member

type Member struct {
	ID      int64
	UserID  string `gorm:"primaryKey"`
	GuildID string `gorm:"primaryKey"`
	Roles   []Role
}

func (*Member) FillStruct

func (m *Member) FillStruct(f map[string]interface{}) error

type MemberService

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

type ModMailEntry

type ModMailEntry struct {
	ID        int64  `gorm:"primaryKey"`
	GuildID   string `gorm:"foreignKey"`
	ChannelID string
	UserID    string `gorm:"foreignKey"`
}

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 Plugin

type Plugin interface {
	RegisterPlugin(Bot)
	PluginInfo() PluginInfo
}

type PluginInfo

type PluginInfo struct {
	Name string
}

type ReactionRole

type ReactionRole struct {
	ID        int64  `db:"id"`
	RoleID    string `db:"role_id"`
	MessageID string `db:"message_id"`
	Emoji     string `db:"emoji"`
}

type ReactionRoleService

type ReactionRoleService interface {
	AddReactionRole(ReactionRole) error
	GetReactionRole(string, string) (*ReactionRole, error)
	GetReactionRoles() ([]ReactionRole, error)
	UpdateReactionRole(int) (int, error)
	RemoveReactionRole(int) (int, error)
}

type Role

type Role struct {
	ID      string `gorm:"primaryKey"`
	GuildID string `gorm:"primaryKey"`
	Sticky  bool
	Auto    bool
	Mod     bool
}

func FindRole

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

type RoleService

type RoleService interface {
	AddRole(Role) error
	GetRole(string) (*Role, error)
	GetAllRoles() ([]*Role, error)
	UpdateRole(*Role) error
	RemoveRole(string) 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 {
	ID string
}

type UserService

type UserService interface {
	AddUser(*User) error
	GetUser(string) (*User, error)
	GetAllUsers() ([]*User, error)
	UpdateUser(string, map[string]interface{}) (*User, error)
	RemoveUser(string) error
}

Jump to

Keyboard shortcuts

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