db

package
v0.0.0-...-1928642 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2024 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Configuration

type Configuration struct {
	GuildID          string   `json:"guildID"`
	WelcomeChannelID string   `json:"welcomeChannelID"`
	WelcomeText      string   `json:"welcomeText"`
	WelcomeDM        []string `json:"welcomeDM"`

	RoleManagement RoleManagementConfiguration `json:"roleManagement"`

	Hives             []HiveConfiguration              `json:"hives"`
	LookingForPlayers []LookingForPlayersConfiguration `json:"lookingForPlayers"`
	Schedules         []ScheduleConfiguration          `json:"schedules"`
}

type Database

type Database interface {
	ConfigForGuild(guildID string) (*Configuration, error)
	GetAllConfigurations() ([]Configuration, error)
}

func NewLocalDB

func NewLocalDB(path string) (Database, error)

func NewMongoDB

func NewMongoDB(url, db string) (Database, error)

type HiveConfiguration

type HiveConfiguration struct {
	RequestChannelIDs  []string `json:"requestChannelIDs"`
	JunkyardCategoryID string   `json:"junkyardCategoryID"`
	TextCategoryID     string   `json:"textCategoryID"`
	VoiceCategoryID    string   `json:"voiceCategoryID"`
	Prefix             string   `json:"prefix"`
	VoiceBitrate       int      `json:"voiceBitrate"`
}

type LocalDatabase

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

func (*LocalDatabase) ConfigForGuild

func (l *LocalDatabase) ConfigForGuild(guildID string) (*Configuration, error)

func (*LocalDatabase) GetAllConfigurations

func (l *LocalDatabase) GetAllConfigurations() ([]Configuration, error)

type LookingForPlayersConfiguration

type LookingForPlayersConfiguration struct {
	RequestChannelIDs  []string `json:"requestChannelIDs"`
	AdvertiseChannelID string   `json:"advertiseChannelID"`
	HiveChannelID      string   `json:"hiveChannelID"`
}

type MongoDatabase

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

func (*MongoDatabase) ConfigForGuild

func (m *MongoDatabase) ConfigForGuild(guildID string) (*Configuration, error)

TODO: Add cache!

func (*MongoDatabase) GetAllConfigurations

func (m *MongoDatabase) GetAllConfigurations() ([]Configuration, error)

type Role

type Role struct {
	ID          string `json:"id"`
	Emoji       string `json:"emoji"`
	AutoApprove bool   `json:"autoApprove"`
}

type RoleManagementConfiguration

type RoleManagementConfiguration struct {
	RoleAdminChannelID string `json:"roleAdminChannelID"`
	DefaultRole        string `json:"defaultRole"`

	RoleSets []RoleSet `json:"roleSets"`
}

type RoleSet

type RoleSet struct {
	Message string `json:"message"`
	Roles   []Role `json:"roles"`
}

type ScheduleConfiguration

type ScheduleConfiguration struct {
	ClassName string `json:"className"`
	URL       string `json:"url"`
}

Jump to

Keyboard shortcuts

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