db

package
v0.12.3 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2023 License: GPL-3.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MessageSuffixRuleTypeWarning = iota
	MessageSuffixRuleTypeDelete
	MessageSuffixRuleTypeWebhook
)
View Source
const (
	MinecraftServerTypeJava    = "java"
	MinecraftServerTypeBedrock = "bedrock"
)
View Source
const (
	PollSettingShowTypeAlways = iota
	PollSettingShowTypeNever
	PollSettingShowTypeAfterVote
)
View Source
const (
	RolePanelV2TypeNone       = ""
	RolePanelV2TypeReaction   = "reaction"
	RolePanelV2TypeSelectMenu = "select_menu"
	RolePanelV2TypeButton     = "button"
)
View Source
const GuildDataVersion = 11
View Source
const (
	NoticeScheduleTypeBump = iota + 1
)
View Source
const UserDataVersion = 1

Variables

This section is empty.

Functions

func Address2Hash

func Address2Hash(address string, port int) (string, error)

func RolePanelV2EditMenuEmbed

func RolePanelV2EditMenuEmbed[T rolePanelV2MessageBuilder[T]](r *RolePanelV2, locale discord.Locale, edit *RolePanelV2Edit, message T) T

func RolePanelV2MessageButton

func RolePanelV2MessageButton[T rolePanelV2MessageBuilder[T]](r *RolePanelV2, locale discord.Locale, message T, config RolePanelV2Config) T

func RolePanelV2MessageReaction

func RolePanelV2MessageReaction[T rolePanelV2MessageBuilder[T]](r *RolePanelV2, locale discord.Locale, message T) T

func RolePanelV2MessageSelectMenu

func RolePanelV2MessageSelectMenu[T rolePanelV2MessageBuilder[T]](r *RolePanelV2, locale discord.Locale, message T, config RolePanelV2Config) T

func RolePanelV2PlaceMenuEmbed

func RolePanelV2PlaceMenuEmbed[T rolePanelV2MessageBuilder[T]](r *RolePanelV2, locale discord.Locale, place *RolePanelV2Place, message T) T

Types

type BumpStatus

type BumpStatus struct {
	BumpEnabled     bool          `json:"bump_enabled"`
	BumpChannel     *snowflake.ID `json:"bump_channel"`
	BumpRole        *snowflake.ID `json:"bump_role"`
	BumpMessage     [2]string     `json:"bump_message"`
	BumpRemind      [2]string     `json:"bump_remind"`
	LastBump        time.Time     `json:"last_bump"`
	LastBumpChannel *snowflake.ID `json:"last_bump_channel"`
	UpEnabled       bool          `json:"up_enabled"`
	UpChannel       *snowflake.ID `json:"up_channel"`
	UpRole          *snowflake.ID `json:"up_role"`
	UpMessage       [2]string     `json:"up_message"`
	UpRemind        [2]string     `json:"up_remind"`
	LastUp          time.Time     `json:"last_up"`
	LastUpChannel   *snowflake.ID `json:"last_up_channel"`

	BumpCountMap map[snowflake.ID]uint64 `json:"bump_count_map"`
	UpCountMap   map[snowflake.ID]uint64 `json:"up_count_map"`
}

type Calc

type Calc struct {
	Input string

	LastInput string

	Mode CalcMode
	// contains filtered or unexported fields
}

func NewCalc

func NewCalc() Calc

func (*Calc) Back

func (c *Calc) Back()

func (*Calc) CE

func (c *Calc) CE()

func (Calc) Component

func (c Calc) Component() []discord.ContainerComponent

func (*Calc) Divide

func (c *Calc) Divide()

func (*Calc) Do

func (c *Calc) Do()

func (Calc) ID

func (c Calc) ID() uuid.UUID

func (Calc) Indicator

func (c Calc) Indicator() CalcIndicator

func (*Calc) InputDo

func (c *Calc) InputDo()

func (Calc) MarshalJSON

func (c Calc) MarshalJSON() ([]byte, error)

func (*Calc) Message

func (c *Calc) Message(formatter func([]discord.Embed) []discord.Embed) (discord.MessageCreate, error)

func (*Calc) Minus

func (c *Calc) Minus()

func (*Calc) Multiple

func (c *Calc) Multiple()

func (*Calc) Plus

func (c *Calc) Plus()

func (*Calc) Reset

func (c *Calc) Reset()

func (*Calc) UnmarshalJSON

func (c *Calc) UnmarshalJSON(b []byte) error

type CalcDB

type CalcDB interface {
	Get(id uuid.UUID) (Calc, error)
	Set(id uuid.UUID, data Calc) error
	Del(id uuid.UUID) error
}

type CalcDBImpl

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

func (*CalcDBImpl) Del

func (c *CalcDBImpl) Del(id uuid.UUID) error

func (*CalcDBImpl) Get

func (c *CalcDBImpl) Get(id uuid.UUID) (Calc, error)

func (*CalcDBImpl) Set

func (c *CalcDBImpl) Set(id uuid.UUID, data Calc) error

type CalcIndicator

type CalcIndicator rune
const (
	CalcIndicatorNone     CalcIndicator = '_'
	CalcIndicatorPlus     CalcIndicator = '+'
	CalcIndicatorMinus    CalcIndicator = '-'
	CalcIndicatorMultiple CalcIndicator = '×'
	CalcIndicatorDivide   CalcIndicator = '÷'
	CalcIndicatorPercent  CalcIndicator = '%'
)

type CalcMode

type CalcMode int
const (
	CalcModeInput       CalcMode = 1 // 最初の入力 値が一つのみ
	CalcModeInputSecond CalcMode = 2 // 二つ目の入力 値が二つ
	CalcModeAnswer      CalcMode = 3 // 計算後の状態
	CalcModeTemp        CalcMode = 4 // 演算子入力後の状態
)

type DB

type DB interface {
	Close() error
	PollCreate() PollCreateDB
	Poll() PollDB
	RolePanelCreate() RolePanelCreateDB
	RolePanel() RolePanelDB
	GuildData() GuildDataDB
	Calc() CalcDB
	MessagePin() MessagePinDB
	EmbedDialog() EmbedDialogDB
	UserData() UserDataDB
	MinecraftServer() MinecraftServerDB
	MinecraftStatusPanel() MinecraftStatusPanelDB
	NoticeSchedule() NoticeScheduleDB
	RolePanelV2() RolePanelV2DB
	RolePanelV2Edit() RolePanelV2EditDB
	RolePanelV2Place() RolePanelV2PlaceDB
	Interactions() InteractionsDB
}

func SetupDatabase

func SetupDatabase(cfg DBConfig) (DB, error)

type DBConfig

type DBConfig struct {
	Host string `json:"host"`
	Port string `json:"port"`
	DB   int    `json:"db"`
}

type EmbedDialog

type EmbedDialog struct {
	ID                    uuid.UUID          `json:"id"`
	HandlerName           string             `json:"handler_name"`
	Locale                discord.Locale     `json:"locale"`
	InteractionToken      interactions.Token `json:"interaction_token"`
	*discord.EmbedBuilder `json:"embed"`
}

func NewEmbedDialog

func NewEmbedDialog(handler_name string, interaction_token interactions.Token, locale discord.Locale) *EmbedDialog

func (EmbedDialog) BaseMenu

func (e EmbedDialog) BaseMenu() (mes discord.MessageUpdate)

func (EmbedDialog) TitleDescriptionMenu

func (e EmbedDialog) TitleDescriptionMenu() (mes discord.MessageUpdate)

type EmbedDialogDB

type EmbedDialogDB interface {
	Set(id uuid.UUID, data EmbedDialog) error
	Get(id uuid.UUID) (*EmbedDialog, error)
	Del(id uuid.UUID) error
}

type GuildData

type GuildData struct {
	ID              snowflake.ID                            `json:"id"`
	RolePanel       map[uuid.UUID]GuildDataRolePanel        `json:"role_panel"`
	RolePanelLimit  int                                     `json:"role_panel_limit"`
	UserPermissions map[snowflake.ID]permissions.Permission `json:"user_permissions"`
	RolePermissions map[snowflake.ID]permissions.Permission `json:"role_permissions"`
	UserLevels      map[snowflake.ID]GuildDataUserLevel     `json:"user_levels"`
	Config          GuildDataConfig                         `json:"config"`
	BumpStatus      BumpStatus                              `json:"bump_status"`

	MCStatusPanel     map[uuid.UUID]string `json:"mc_status_panel"`
	MCStatusPanelName map[string]int       `json:"mc_status_panel_name"`
	MCStatusPanelMax  int                  `json:"mc_status_panel_max"`

	MessageSuffix map[snowflake.ID]MessageSuffix `json:"message_suffix"`

	UserLevelExcludeChannels map[snowflake.ID]string `json:"user_level_exclude_channels"`

	RolePanelV2             map[uuid.UUID]string         `json:"role_panel_v2"`
	RolePanelV2Name         map[string]int               `json:"role_panel_v2_name"`
	RolePanelV2Placed       map[string]uuid.UUID         `json:"role_panel_v2_placed"`
	RolePanelV2PlacedConfig map[string]RolePanelV2Config `json:"role_panel_v2_placed_config"`
	RolePanelV2Limit        int                          `json:"role_panel_v2_limit"`

	RolePanelV2Editing map[uuid.UUID]uuid.UUID `json:"role_panel_v2_editing"`

	RolePanelV2EditingEmoji map[uuid.UUID][2]snowflake.ID `json:"role_panel_v2_emoji"`

	DataVersion *int `json:"data_version,omitempty"`
}

func NewGuildData

func NewGuildData(id snowflake.ID) GuildData

func (*GuildData) UnmarshalJSON

func (g *GuildData) UnmarshalJSON(b []byte) error

type GuildDataConfig

type GuildDataConfig struct {
	LevelUpMessage        string        `json:"level_up_message"`
	LevelUpMessageChannel *snowflake.ID `json:"level_up_message_channel"`
}

type GuildDataDB

type GuildDataDB interface {
	Get(id snowflake.ID) (GuildData, error)
	Set(id snowflake.ID, data GuildData) error
	Del(id snowflake.ID) error
}

type GuildDataRolePanel

type GuildDataRolePanel struct {
	OnList bool `json:"on_list"`
}

type GuildDataUserLevel

type GuildDataUserLevel struct {
	UserDataLevel
	MessageCount    int64     `json:"message_count"`
	LastMessageTime time.Time `json:"last_message_time"`
}

func NewGuildDataUserLevel

func NewGuildDataUserLevel() GuildDataUserLevel

type GuildMessagePins

type GuildMessagePins struct {
	Enabled bool                        `json:"enabled"`
	Pins    map[snowflake.ID]MessagePin `json:"pins"`
}

func NewMessagePin

func NewMessagePin() *GuildMessagePins

type InteractionsDB

type InteractionsDB interface {
	Get(id uuid.UUID) (string, error)
	Set(id uuid.UUID, token string) error
	Del(id uuid.UUID) error
}

type Mee6Guild

type Mee6Guild struct {
	AllowJoin                  bool   `json:"allow_join"`
	ApplicationCommandsEnabled bool   `json:"application_commands_enabled"`
	CommandsPrefix             string `json:"commands_prefix"`
	Icon                       string `json:"icon"`
	ID                         string `json:"id"`
	InviteLeaderboard          bool   `json:"invite_leaderboard"`
	LeaderboardURL             string `json:"leaderboard_url"`
	Name                       string `json:"name"`
	Premium                    bool   `json:"premium"`
}

type Mee6LeaderBoard

type Mee6LeaderBoard struct {
	Admin             bool                `json:"admin"`
	BannerURL         *string             `json:"banner_url"`
	Country           string              `json:"country"`
	Guild             Mee6Guild           `json:"guild"`
	IsMember          bool                `json:"is_member"`
	MonetizeOptions   Mee6MonetizeOptions `json:"monetize_options"`
	Page              int                 `json:"page"`
	Player            *Mee6Player         `json:"player"`
	Players           []Mee6Player        `json:"players"`
	RoleRewards       []any               `json:"role_rewards"`
	UserGuildSettings any                 `json:"user_guild_settings"`
	XpPerMessage      []int               `json:"xp_per_message"`
	XpRate            float64             `json:"xp_rate"`
}

type Mee6MonetizeOptions

type Mee6MonetizeOptions struct {
	DisplayPlans        bool `json:"display_plans"`
	ShowcaseSubscribers bool `json:"showcase_subscribers"`
}

type Mee6Player

type Mee6Player struct {
	Avatar               string       `json:"avatar"`
	DetailedXp           []int64      `json:"detailed_xp"`
	Discriminator        string       `json:"discriminator"`
	GuildID              string       `json:"guild_id"`
	ID                   snowflake.ID `json:"id"`
	IsMonetizeSubscriber bool         `json:"is_monetize_subscriber"`
	Level                int64        `json:"level"`
	MessageCount         int64        `json:"message_count"`
	MonetizeXpBoost      int64        `json:"monetize_xp_boost"`
	Username             string       `json:"username"`
	Xp                   int64        `json:"xp"`
}

type MessagePin

type MessagePin struct {
	WebhookMessageCreate discord.WebhookMessageCreate `json:"webhook_message_create"`
	ChannelID            snowflake.ID                 `json:"channel_id"`
	LastMessageID        *snowflake.ID                `json:"last_message_id"`
	// contains filtered or unexported fields
}

func (*MessagePin) CheckLimit added in v0.12.3

func (m *MessagePin) CheckLimit() bool

func (*MessagePin) Update

func (self *MessagePin) Update(client bot.Client) error

type MessagePinDB

type MessagePinDB interface {
	Get(id snowflake.ID) (*GuildMessagePins, error)
	GetAll() (map[snowflake.ID]*GuildMessagePins, error)
	Set(id snowflake.ID, data *GuildMessagePins) error
	Del(id snowflake.ID) error
}

type MessageSuffix

type MessageSuffix struct {
	Target   snowflake.ID          `json:"target"`
	Suffix   string                `json:"suffix"`
	RuleType MessageSuffixRuleType `json:"rule_type"`
}

func NewMessageSuffix

func NewMessageSuffix(target snowflake.ID, suffix string, rule MessageSuffixRuleType) MessageSuffix

type MessageSuffixRuleType

type MessageSuffixRuleType int

type MinecraftPingResponse

type MinecraftPingResponse struct {
	ping.Infos
	Latency int64
	Type    MinecraftServerType `json:"type"`
	Succeed bool                `json:"succeed"`
}

func (MinecraftPingResponse) AnsiDescription

func (r MinecraftPingResponse) AnsiDescription() string

type MinecraftServer

type MinecraftServer struct {
	Hash             string                 `json:"hash"`
	Type             MinecraftServerType    `json:"type"`
	Address          string                 `json:"address"`
	Port             uint16                 `json:"port"`
	WatchingGuilds   []snowflake.ID         `json:"watching_guilds"`
	LastResponseTime time.Time              `json:"last_response_time"`
	LastResponse     *MinecraftPingResponse `json:"last_response"`
}

func NewMinecraftServer

func NewMinecraftServer(hash, address string, port uint16, s_type MinecraftServerType) MinecraftServer

func (*MinecraftServer) Fetch

func (ms *MinecraftServer) Fetch() (r *MinecraftPingResponse, err error)

func (MinecraftServer) String

func (m MinecraftServer) String() string

type MinecraftServerDB

type MinecraftServerDB interface {
	Set(hash string, server MinecraftServer) error
	Get(hash string) (MinecraftServer, error)
	GetAll() ([]MinecraftServer, error)
	Del(hash string) error
}

type MinecraftServerType

type MinecraftServerType string

type MinecraftStatusPanel

type MinecraftStatusPanel struct {
	ID            uuid.UUID    `json:"id"`
	Name          string       `json:"name"`
	Hash          string       `json:"hash"`
	IsShowAddress bool         `json:"is_show_address"`
	GuildID       snowflake.ID `json:"guild_id"`
	ChannelID     snowflake.ID `json:"channel_id"`
	MessageID     snowflake.ID `json:"message_id"`
}

func NewMinecraftStatusPanel

func NewMinecraftStatusPanel(name string, guildID, channelID, messageID snowflake.ID, hash string, showAddress bool) MinecraftStatusPanel

func (MinecraftStatusPanel) Components

func (MinecraftStatusPanel) Embed

func (m MinecraftStatusPanel) Embed(address string, response *MinecraftPingResponse) discord.Embed

type MinecraftStatusPanelDB

type MinecraftStatusPanelDB interface {
	Set(id uuid.UUID, panel MinecraftStatusPanel) error
	Get(id uuid.UUID) (MinecraftStatusPanel, error)
	Del(id uuid.UUID) error
}

type NoticeSchedule

type NoticeSchedule interface {
	Type() NoticeScheduleType
	ID() uuid.UUID
}

func NewNoticeScheduleBump

func NewNoticeScheduleBump(is_up bool, guildID, channelID snowflake.ID, schedule_time time.Time) NoticeSchedule

type NoticeScheduleBump

type NoticeScheduleBump struct {
	IsUp          bool         `json:"is_up"`
	GuildID       snowflake.ID `json:"guild_id"`
	ChannelID     snowflake.ID `json:"channel_id"`
	ScheduledTime time.Time    `json:"scheduled_time"`
	// contains filtered or unexported fields
}

func (NoticeScheduleBump) ID

func (n NoticeScheduleBump) ID() uuid.UUID

func (NoticeScheduleBump) MarshalJSON

func (n NoticeScheduleBump) MarshalJSON() ([]byte, error)

func (NoticeScheduleBump) Type

func (*NoticeScheduleBump) UnmarshalJSON

func (n *NoticeScheduleBump) UnmarshalJSON(data []byte) error

type NoticeScheduleDB

type NoticeScheduleDB interface {
	Set(id uuid.UUID, data NoticeSchedule) error
	Get(id uuid.UUID) (NoticeSchedule, error)
	GetAll() ([]NoticeSchedule, error)
	GetByType(t NoticeScheduleType) ([]NoticeSchedule, error)
	Del(id uuid.UUID) error
}

type NoticeScheduleType

type NoticeScheduleType int

func (NoticeScheduleType) String

func (t NoticeScheduleType) String() string

type Poll

type Poll struct {
	Username    string                `json:"username"`
	UserAvatar  string                `json:"user_avatar"`
	Users       map[snowflake.ID]bool `json:"users"`
	ID          uuid.UUID             `json:"id"`
	MessageID   snowflake.ID          `json:"message_id"`
	GuildId     snowflake.ID          `json:"guild_id"`
	ChannelID   snowflake.ID
	Title       string                   `json:"title"`
	Description string                   `json:"description"`
	EndAt       int64                    `json:"end_at"`
	MaxChoice   int                      `json:"max"`
	MinChoice   int                      `json:"min"`
	Choices     map[uuid.UUID]PollChoice `json:"choices"`

	Locale   discord.Locale `json:"locale"`
	Settings PollSettings   `json:"settings"`
	Finished bool           `json:"finished"`
}

func (*Poll) MessageComponent

func (p *Poll) MessageComponent() []discord.ContainerComponent

func (*Poll) MessageEmbed

func (p *Poll) MessageEmbed() []discord.Embed

func (*Poll) SeeInfoComponent

func (p *Poll) SeeInfoComponent(tokenID uuid.UUID) []discord.ContainerComponent

func (*Poll) SeeResultComponent

func (p *Poll) SeeResultComponent(tokenID uuid.UUID) []discord.ContainerComponent

func (*Poll) VoteComponent

func (p *Poll) VoteComponent(tokenID uuid.UUID) []discord.ContainerComponent

type PollChoice

type PollChoice struct {
	Users       map[snowflake.ID]bool   `json:"users"`
	ID          uuid.UUID               `json:"id"`
	Position    int                     `json:"position"`
	Name        string                  `json:"name"`
	Description string                  `json:"description"`
	Emoji       *discord.ComponentEmoji `json:"emoji"`
}

type PollCreate

type PollCreate struct {
	ID          uuid.UUID                      `json:"id"`
	Title       string                         `json:"title"`
	Description string                         `json:"description"`
	EndAt       int64                          `json:"time_limit"`
	MaxChoice   int                            `json:"max"`
	MinChoice   int                            `json:"min"`
	Choices     map[uuid.UUID]PollCreateChoice `json:"choices"`

	Locale   discord.Locale `json:"locale"`
	Settings PollSettings   `json:"settings"`
}

func (*PollCreate) ChangeSettingsMenuComponent

func (p *PollCreate) ChangeSettingsMenuComponent(t PollSettingsType) []discord.ContainerComponent

func (*PollCreate) Components

func (v *PollCreate) Components() []discord.ContainerComponent

func (*PollCreate) ConfigEmbed

func (v *PollCreate) ConfigEmbed() []discord.Embed

func (*PollCreate) CreatePoll

func (p *PollCreate) CreatePoll(user discord.User) Poll

func (*PollCreate) EditChoiceComponent

func (p *PollCreate) EditChoiceComponent(choiceID uuid.UUID) []discord.ContainerComponent

func (*PollCreate) EditChoiceEmbed

func (p *PollCreate) EditChoiceEmbed(choiceID uuid.UUID) []discord.Embed

func (*PollCreate) EditSettingsComponent

func (p *PollCreate) EditSettingsComponent() []discord.ContainerComponent

func (*PollCreate) EditSettingsEmbed

func (p *PollCreate) EditSettingsEmbed() []discord.Embed

type PollCreateChoice

type PollCreateChoice struct {
	ID          uuid.UUID               `json:"id"`
	Position    int                     `json:"position"`
	Name        string                  `json:"name"`
	Description string                  `json:"description"`
	Emoji       *discord.ComponentEmoji `json:"emoji"`
}

type PollCreateDB

type PollCreateDB interface {
	Get(id uuid.UUID) (PollCreate, error)
	Set(id uuid.UUID, data PollCreate) error
	Del(id uuid.UUID) error
}

type PollDB

type PollDB interface {
	GetAll() ([]Poll, error)
	Get(id uuid.UUID) (Poll, error)
	Set(id uuid.UUID, poll Poll) error
	Del(id uuid.UUID) error
}

type PollSettingShowType

type PollSettingShowType int

func (PollSettingShowType) String

func (p PollSettingShowType) String(locale discord.Locale) string

type PollSettings

type PollSettings struct {
	ShowUser         PollSettingShowType `json:"show_user"`
	ShowCount        PollSettingShowType `json:"show_count"`
	ShowTotalCount   PollSettingsBool    `json:"show_total_count"`
	ShowUserInResult PollSettingsBool    `json:"show_user_in_result"`
	CanChangeTarget  PollSettingsBool    `json:"can_change_target"`
}

type PollSettingsBool

type PollSettingsBool bool

func (PollSettingsBool) EmojiString

func (p PollSettingsBool) EmojiString() string

type PollSettingsType

type PollSettingsType int
const (
	PollSettingsTypeShowUser PollSettingsType = iota + 1
	PollSettingsTypeShowCount
	PollSettingsTypeShowTotalCount
	PollSettingsTypeShowUserInResult
	PollSettingsTypeCanChangeTarget
)

type RolePanel

type RolePanel struct {
	*RolePanelCreate `json:"role_data"`
	ChannelID        snowflake.ID `json:"channel_id"`
	MessageID        snowflake.ID `json:"message_id"`
	GuildID          snowflake.ID `json:"guild_id"`
}

func NewRolePanel

func NewRolePanel(panel RolePanelCreate) RolePanel

func (*RolePanel) BuildMessage

func (r *RolePanel) BuildMessage(format func([]discord.Embed) []discord.Embed) discord.MessageCreate

func (RolePanel) MarshalJSON

func (r RolePanel) MarshalJSON() ([]byte, error)

func (*RolePanel) UnmarshalJSON

func (r *RolePanel) UnmarshalJSON(data []byte) error

func (*RolePanel) UseMessage

func (r *RolePanel) UseMessage(format func([]discord.Embed) []discord.Embed, member discord.Member) discord.MessageCreate

type RolePanelCreate

type RolePanelCreate struct {
	Name        string
	Description string

	Max int
	Min int
	// contains filtered or unexported fields
}

func NewRolePanelCreate

func NewRolePanelCreate(name, description string, locale discord.Locale) RolePanelCreate

func (*RolePanelCreate) AddRoleMenuComponent

func (r *RolePanelCreate) AddRoleMenuComponent() []discord.ContainerComponent

func (*RolePanelCreate) AddRoleMenuEmbed

func (r *RolePanelCreate) AddRoleMenuEmbed() []discord.Embed

func (RolePanelCreate) BackMainMenuButton

func (r RolePanelCreate) BackMainMenuButton() discord.ButtonComponent

func (RolePanelCreate) BaseMenuComponent

func (r RolePanelCreate) BaseMenuComponent() []discord.ContainerComponent

func (RolePanelCreate) BaseMenuEmbed

func (r RolePanelCreate) BaseMenuEmbed() []discord.Embed

func (*RolePanelCreate) DeleteRole

func (r *RolePanelCreate) DeleteRole(id snowflake.ID)

func (*RolePanelCreate) EditPanelSettingsComponent

func (r *RolePanelCreate) EditPanelSettingsComponent() []discord.ContainerComponent

func (*RolePanelCreate) EditPanelSettingsEmbed

func (r *RolePanelCreate) EditPanelSettingsEmbed() []discord.Embed

func (*RolePanelCreate) EditRoleMenuComponent

func (r *RolePanelCreate) EditRoleMenuComponent(id snowflake.ID) discord.ContainerComponent

func (*RolePanelCreate) EditRoleMenuEmbed

func (r *RolePanelCreate) EditRoleMenuEmbed(id snowflake.ID) []discord.Embed

func (RolePanelCreate) GetRole

func (r RolePanelCreate) GetRole(id snowflake.ID) (RolePanelCreateRole, bool)

func (RolePanelCreate) GetRoles

func (r RolePanelCreate) GetRoles() map[snowflake.ID]RolePanelCreateRole

func (RolePanelCreate) MarshalJSON

func (r RolePanelCreate) MarshalJSON() ([]byte, error)

func (*RolePanelCreate) SetRole

func (r *RolePanelCreate) SetRole(label, description string, roleID snowflake.ID, emoji *discord.ComponentEmoji)

func (*RolePanelCreate) UUID

func (r *RolePanelCreate) UUID() uuid.UUID

func (*RolePanelCreate) UnmarshalJSON

func (r *RolePanelCreate) UnmarshalJSON(b []byte) error

func (*RolePanelCreate) Validate

func (r *RolePanelCreate) Validate()

type RolePanelCreateDB

type RolePanelCreateDB interface {
	Get(uuid.UUID) (RolePanelCreate, error)
	Set(RolePanelCreate) error
	Del(uuid.UUID) error
}

type RolePanelCreateRole

type RolePanelCreateRole struct {
	Label       string
	Description string
	RoleID      snowflake.ID
	Emoji       discord.ComponentEmoji
	// contains filtered or unexported fields
}

func (RolePanelCreateRole) MarshalJSON

func (r RolePanelCreateRole) MarshalJSON() ([]byte, error)

func (RolePanelCreateRole) Position

func (r RolePanelCreateRole) Position() int

func (*RolePanelCreateRole) UnmarshalJSON

func (r *RolePanelCreateRole) UnmarshalJSON(b []byte) error

type RolePanelDB

type RolePanelDB interface {
	Get(uuid.UUID) (RolePanel, error)
	Set(RolePanel) error
	Del(uuid.UUID) error
}

type RolePanelV2

type RolePanelV2 struct {
	ID          uuid.UUID         `json:"uuid"`
	Name        string            `json:"name"`
	Description string            `json:"description"`
	Roles       []RolePanelV2Role `json:"roles"`
}

func NewRolePanelV2

func NewRolePanelV2(name, description string) *RolePanelV2

func (*RolePanelV2) AddRole

func (r *RolePanelV2) AddRole(id snowflake.ID, name string, emoji *discord.ComponentEmoji) bool

type RolePanelV2Config

type RolePanelV2Config struct {
	PanelType        RolePanelV2Type     `json:"panel_type"`
	ButtonStyle      discord.ButtonStyle `json:"button_style"`
	ButtonShowName   bool                `json:"show_name"`
	SimpleSelectMenu bool                `json:"simple_select_menu"`
}

func NewRolePanelV2Config

func NewRolePanelV2Config() RolePanelV2Config

type RolePanelV2DB

type RolePanelV2DB interface {
	Get(id uuid.UUID) (*RolePanelV2, error)
	Set(id uuid.UUID, data *RolePanelV2) error
	Del(id uuid.UUID) error
}

type RolePanelV2Edit

type RolePanelV2Edit struct {
	ID        uuid.UUID `json:"id"`
	CreatedAt time.Time `json:"created_at"`

	RolePanelID uuid.UUID `json:"role_panel_id"`

	GuildID          snowflake.ID       `json:"guild_id"`
	ChannelID        snowflake.ID       `json:"channel_id"`
	MessageID        snowflake.ID       `json:"message_id"`
	InteractionToken interactions.Token `json:"interaction_token"`
	EmojiMode        bool               `json:"emoji_mode"`
	EmojiLocale      discord.Locale     `json:"emoji_locale"`

	SelectedID *snowflake.ID
}

func NewRolePanelV2Edit

func NewRolePanelV2Edit(rolePanelID uuid.UUID, guildID, channelID snowflake.ID, token interactions.Token) *RolePanelV2Edit

func (RolePanelV2Edit) HasSelectedRole

func (r RolePanelV2Edit) HasSelectedRole() bool

func (RolePanelV2Edit) IsSelected

func (r RolePanelV2Edit) IsSelected(id snowflake.ID) bool

type RolePanelV2EditDB

type RolePanelV2EditDB interface {
	Get(id uuid.UUID) (data *RolePanelV2Edit, err error)
	Set(id uuid.UUID, data *RolePanelV2Edit) (err error)
	Del(id uuid.UUID) (err error)
}

type RolePanelV2Place

type RolePanelV2Place struct {
	ID               uuid.UUID          `json:"id"`
	CreatedAt        time.Time          `json:"created_at"`
	GuildID          snowflake.ID       `json:"guild_id"`
	PanelID          uuid.UUID          `json:"panel_id"`
	Config           RolePanelV2Config  `json:"config"`
	InteractionToken interactions.Token `json:"interaction_token"`
}

func NewRolePanelV2Place

func NewRolePanelV2Place(guild_id snowflake.ID, panel_id uuid.UUID, interaction_token interactions.Token) *RolePanelV2Place

type RolePanelV2PlaceDB

type RolePanelV2PlaceDB interface {
	Get(id uuid.UUID) (data *RolePanelV2Place, err error)
	Set(id uuid.UUID, data *RolePanelV2Place) (err error)
	Del(id uuid.UUID) (err error)
}

type RolePanelV2Role

type RolePanelV2Role struct {
	RoleID   snowflake.ID            `json:"role_id"`
	RoleName string                  `json:"role_name"`
	Emoji    *discord.ComponentEmoji `json:"emoji"`
}

type RolePanelV2Type

type RolePanelV2Type string

type UserData

type UserData struct {
	ID snowflake.ID `json:"id"`

	CreatedAt time.Time      `json:"created_at"`
	BirthDay  [2]int         `json:"birth_day"`
	Location  UserLocation   `json:"location"`
	Locale    discord.Locale `json:"locale"`

	LastMessageTime    time.Time     `json:"last_message_time"`
	MessageCount       int64         `json:"message_count"`
	GlobalLevel        UserDataLevel `json:"global_level"`
	GlobalMessageLevel UserDataLevel `json:"global_message_level"`
	GlobalVoiceLevel   UserDataLevel `json:"global_voice_level"`

	DataVersion int `json:"data_version"`
}

func NewUserData

func NewUserData(id snowflake.ID) (*UserData, error)

func (*UserData) UnmarshalJSON

func (u *UserData) UnmarshalJSON(b []byte) error

type UserDataDB

type UserDataDB interface {
	Get(id snowflake.ID) (*UserData, error)
	Set(id snowflake.ID, data *UserData) error
	Del(id snowflake.ID) error
}

type UserDataLevel

type UserDataLevel struct {
	Point *big.Int `json:"point"`
}

func NewUserDataLevel

func NewUserDataLevel() UserDataLevel

func (*UserDataLevel) Add

func (u *UserDataLevel) Add(i *big.Int)

func (*UserDataLevel) AddRandom

func (u *UserDataLevel) AddRandom()

func (UserDataLevel) Level

func (u UserDataLevel) Level() *big.Int

func (UserDataLevel) ReqPoint

func (u UserDataLevel) ReqPoint() *big.Int

func (UserDataLevel) SumReqPoint

func (u UserDataLevel) SumReqPoint() *big.Int

type UserLocation

type UserLocation struct {
	*time.Location
}

func NewUserLocation

func NewUserLocation(str string) (UserLocation, error)

func (UserLocation) MarshalJSON

func (u UserLocation) MarshalJSON() ([]byte, error)

func (*UserLocation) UnmarshalJSON

func (u *UserLocation) UnmarshalJSON(b []byte) error

Jump to

Keyboard shortcuts

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