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 ErrorRespond(locale discord.Locale, err error) discord.MessageCreate
- 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 MessageLogDetails(m []MessageLog) (day, week, all int, channelID snowflake.ID)
- func Number2Emoji(n int) string
- func ParseComponentEmoji(str string) discord.ComponentEmoji
- func ReturnErr(interaction responsibleInteraction, err error, opts ...ReturnErrOption) error
- func ReturnErrMessage(interaction responsibleInteraction, tr string, opts ...ReturnErrOption) error
- func ReturnErrMessageEphemeral(interaction responsibleInteraction, ...) errordeprecated
- 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
- func (b *Bot[DB]) CheckDev(id snowflake.ID) bool
- func (b *Bot[DB]) OnGuildJoin(g *events.GuildJoin)
- func (b *Bot[DB]) OnGuildLeave(g *events.GuildLeave)
- func (b *Bot[DB]) OnGuildMemberJoin(m *events.GuildMemberJoin)
- func (b *Bot[DB]) OnGuildMemberLeave(m *events.GuildMemberLeave)
- func (b *Bot[DB]) RefreshPresence()
- func (b *Bot[DB]) SetupBot(listeners ...bot.EventListener)
- type Config
- type DislogConfig
- type MessageLog
- type ReturnErrCfg
- type ReturnErrOption
Constants ¶
This section is empty.
Variables ¶
var ( Color int = 0xffffff BotName string = "developer bot" )
var EmojiRegex = regexp.MustCompile(`<(a|):[A-z0-9_~]+:[0-9]{18,20}>`)
Functions ¶
func ActivitiesNameString ¶
アクティビティ名をアクティビティの種類によって渡された言語に翻訳して返す
func ErrorMessageEmbed ¶
エラーメッセージ埋め込みを作成する
func ErrorRespond ¶
func ErrorRespond(locale discord.Locale, err error) discord.MessageCreate
エラーが発生したことを返すレスポンスを作成する Deprecated: use ErrorTraceEmbed()
func ErrorTraceEmbed ¶
エラートレース埋め込みを作成する
func FormatComponentEmoji ¶
func FormatComponentEmoji(e discord.ComponentEmoji) string
func GetCustomEmojis ¶
func GetHighestRolePosition ¶
func MessageLogDetails ¶
func MessageLogDetails(m []MessageLog) (day, week, all int, channelID snowflake.ID)
func Number2Emoji ¶
func ParseComponentEmoji ¶
func ParseComponentEmoji(str string) discord.ComponentEmoji
func ReturnErr ¶
func ReturnErr(interaction responsibleInteraction, err error, opts ...ReturnErrOption) error
func ReturnErrMessage ¶
func ReturnErrMessage(interaction responsibleInteraction, tr string, opts ...ReturnErrOption) error
func ReturnErrMessageEphemeral
deprecated
func SendWebhook ¶
func SetEmbedProperties ¶
埋め込みの色、フッター、タイムスタンプを設定する
func SetEmbedsProperties ¶
埋め込みの色、フッター、タイムスタンプを設定する
Types ¶
type Bot ¶
type Bot[DB db.DB] struct { Logger log.Logger Client bot.Client OAuth oauth2.Client Paginator *paginator.Manager Config Config Version string Handler *handler.Handler DB DB }
func (*Bot[DB]) OnGuildJoin ¶
func (*Bot[DB]) OnGuildLeave ¶
func (b *Bot[DB]) OnGuildLeave(g *events.GuildLeave)
func (*Bot[DB]) OnGuildMemberJoin ¶
func (b *Bot[DB]) OnGuildMemberJoin(m *events.GuildMemberJoin)
func (*Bot[DB]) OnGuildMemberLeave ¶
func (b *Bot[DB]) OnGuildMemberLeave(m *events.GuildMemberLeave)
func (*Bot[DB]) RefreshPresence ¶
func (b *Bot[DB]) RefreshPresence()
func (*Bot[DB]) SetupBot ¶
func (b *Bot[DB]) 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"` DBConfig db.DBConfig `json:"db_config"` 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 MessageLog ¶
type ReturnErrCfg ¶ added in v1.5.0
type ReturnErrOption ¶ added in v1.5.0
type ReturnErrOption func(*ReturnErrCfg)
func WithEphemeral ¶ added in v1.5.0
func WithEphemeral(enabled bool) ReturnErrOption
func WithFallBackDescription ¶ added in v1.5.0
func WithFallBackDescription(desc string) ReturnErrOption
func WithFallbackTitle ¶ added in v1.5.0
func WithFallbackTitle(title string) ReturnErrOption
func WithTranslateData ¶ added in v1.5.0
func WithTranslateData(data ...any) ReturnErrOption