Documentation ¶
Overview ¶
Copyright (C) 2022-2023 sabafly
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
Index ¶
- Variables
- func ActivitiesNameString(locale discord.Locale, activity discord.Activity) (str string)
- func ErrorMessageEmbed(locale discord.Locale, t string, opts ...ReturnErrOption) []discord.Embed
- func ErrorTraceEmbed(locale discord.Locale, err error) []discord.Embed
- func FormatComponentEmoji(e discord.ComponentEmoji) string
- func GetCustomEmojis(str string) []discord.Emoji
- func GetHighestRolePosition(role map[snowflake.ID]discord.Role) (int, snowflake.ID)
- func GetWebhook(client bot.Client, channelID snowflake.ID) (id snowflake.ID, token string, err error)
- func Number2Emoji(n int) string
- func ParseComponentEmoji(str string) discord.ComponentEmoji
- func ReactionComponentEmoji(e discord.ComponentEmoji) string
- func ReturnErr(interaction responsibleInteraction, err error, opts ...ReturnErrOption) error
- func ReturnErrMessage(interaction responsibleInteraction, tr string, opts ...ReturnErrOption) error
- func SendWebhook(client bot.Client, channelID snowflake.ID, data discord.WebhookMessageCreate) (st *discord.Message, err error)
- func SetEmbedProperties(embed discord.Embed) discord.Embed
- func SetEmbedsProperties(embeds []discord.Embed) []discord.Embed
- func StatusString(status discord.OnlineStatus) (str string)
- type Bot
- type Config
- type DislogConfig
- type ReturnErrCfg
- type ReturnErrOption
Constants ¶
This section is empty.
Variables ¶
var ( Color int = 0xffffff BotName string = "developer bot" )
Functions ¶
func ActivitiesNameString ¶
アクティビティ名をアクティビティの種類によって渡された言語に翻訳して返す
func ErrorMessageEmbed ¶
エラーメッセージ埋め込みを作成する
func ErrorTraceEmbed ¶
エラートレース埋め込みを作成する
func FormatComponentEmoji ¶
func FormatComponentEmoji(e discord.ComponentEmoji) string
func GetCustomEmojis ¶
func GetHighestRolePosition ¶
func GetWebhook ¶ added in v2.1.0
func Number2Emoji ¶
func ParseComponentEmoji ¶
func ParseComponentEmoji(str string) discord.ComponentEmoji
func ReactionComponentEmoji ¶ added in v2.6.0
func ReactionComponentEmoji(e discord.ComponentEmoji) string
func ReturnErr ¶
func ReturnErr(interaction responsibleInteraction, err error, opts ...ReturnErrOption) error
func ReturnErrMessage ¶
func ReturnErrMessage(interaction responsibleInteraction, tr string, opts ...ReturnErrOption) error
func SendWebhook ¶
func SetEmbedProperties ¶
埋め込みの色、フッター、タイムスタンプを設定する
func SetEmbedsProperties ¶
埋め込みの色、フッター、タイムスタンプを設定する
Types ¶
type Bot ¶
type Bot[T any] struct { Logger log.Logger Client bot.Client OAuth oauth2.Client Config Config Version string Handler *handler.Handler Self T }
func (*Bot[DB]) CheckDevGuild ¶
func (*Bot[DB]) CheckDevUser ¶
func (*Bot[T]) SetupBot ¶
func (b *Bot[T]) SetupBot(listeners ...bot.EventListener)
type Config ¶
type Config struct { DevMode bool `json:"dev_mode"` DevOnly bool `json:"dev_only"` DevGuildIDs []snowflake.ID `json:"dev_guild_id"` DevUserIDs []snowflake.ID `json:"dev_user_id"` LogLevel string `json:"log_level"` Token string `json:"token"` DMPermission bool `json:"dm_permission"` ShouldSyncCommands bool `json:"sync_commands"` ASyncEventHandler bool `json:"async_event_handler"` Dislog DislogConfig `json:"dislog"` ClientID snowflake.ID `json:"client_id"` Secret string `json:"secret"` HttpIp string `json:"http_ip"` RedirectLink string `json:"redirect_link"` RootUri string `json:"root_uri"` }
func LoadConfig ¶
type DislogConfig ¶
type ReturnErrCfg ¶
type ReturnErrOption ¶
type ReturnErrOption func(*ReturnErrCfg)
func WithEphemeral ¶
func WithEphemeral(enabled bool) ReturnErrOption
func WithFallBackDescription ¶
func WithFallBackDescription(desc string) ReturnErrOption
func WithFallbackTitle ¶
func WithFallbackTitle(title string) ReturnErrOption
func WithTranslateData ¶
func WithTranslateData(data ...any) ReturnErrOption
func WithUpdate ¶ added in v2.6.1
func WithUpdate(enabled bool, client bot.Client) ReturnErrOption