Documentation ¶
Index ¶
- Variables
- func AttachRoleSelectButtons(b *ken.ComponentBuilder, roles []*discordgo.Role) ([]string, error)
- func CheckForUpdate() (isOld bool, current, latest versioncheck.Semver)
- func FlushAllGuildData(s *discordgo.Session, db database.Database, st storage.Storage, ...) (err error)
- func FlushAllUserData(db database.Database, state *dgrs.State, userID string) (res map[string]int, err error)
- func GetAllPermissions(cmdHandler *ken.Ken) sop.Enumerable[string]
- func GetEnv(key, def string) string
- func GetInviteLink(selfID string) string
- func OnRoleSelect(roleID string) func(ctx ken.ComponentContext) bool
- func Pluralize(n int, s string) string
- func UpdateGuildMemberStats(st dgrs.IState, s discordutil.ISession) error
- type EmbedMessage
- func SendEmbed(s discordutil.ISession, chanID, content string, title string, color int) *EmbedMessage
- func SendEmbedError(s discordutil.ISession, chanID, content string, title ...string) *EmbedMessage
- func SendEmbedRaw(s discordutil.ISession, chanID string, emb *discordgo.MessageEmbed) *EmbedMessage
Constants ¶
This section is empty.
Variables ¶
var ( StatsStartupTime = time.Now() StatsCommandsExecuted uint64 = 0 StatsMessagesAnalysed uint64 = 0 )
var (
ConnectedState int32
)
var (
DevModeEnabled = false
)
Functions ¶
func AttachRoleSelectButtons ¶
func CheckForUpdate ¶
func CheckForUpdate() (isOld bool, current, latest versioncheck.Semver)
func FlushAllGuildData ¶
func FlushAllUserData ¶
func GetAllPermissions ¶
func GetAllPermissions(cmdHandler *ken.Ken) sop.Enumerable[string]
func GetEnv ¶
GetEnv returns a value from environment variables or the given default value, if not existent.
func GetInviteLink ¶
GetInviteLink returns the invite link for the bot's account with the specified permissions.
func OnRoleSelect ¶
func OnRoleSelect(roleID string) func(ctx ken.ComponentContext) bool
func UpdateGuildMemberStats ¶
func UpdateGuildMemberStats(st dgrs.IState, s discordutil.ISession) error
Types ¶
type EmbedMessage ¶
EmbedMessage extends a discordgo.MessageEmbedMessage with extra utilities.
func SendEmbed ¶
func SendEmbed(s discordutil.ISession, chanID, content string, title string, color int) *EmbedMessage
SendEmbed creates an discordgo.MessageEmbed from the passed content, title and color and sends it to the specified channel.
If color == 0, static.ColorEmbedDefault will be set as color.
Occured errors are set to the internal error.
func SendEmbedError ¶
func SendEmbedError(s discordutil.ISession, chanID, content string, title ...string) *EmbedMessage
SendEmbedError is shorthand for SendEmbed with static.ColorEmbedError as color and title "Error" if no title was passed.
func SendEmbedRaw ¶
func SendEmbedRaw(s discordutil.ISession, chanID string, emb *discordgo.MessageEmbed) *EmbedMessage
SendEmbedRaw sends the passed emb to the passed channel and sets occured errors to the internal error.
func (*EmbedMessage) DeleteAfter ¶
func (emb *EmbedMessage) DeleteAfter(d time.Duration) *EmbedMessage
DeleteAfter deletes the message after the specified duration when the message still exists and sets occured error to the EmbedMessage.
func (*EmbedMessage) Edit ¶
func (emb *EmbedMessage) Edit(content string, title string, color int) *EmbedMessage
Edit updates the current embed message with the given content replacing the internal message and error of this embed instance.
func (*EmbedMessage) EditRaw ¶
func (emb *EmbedMessage) EditRaw(newEmb *discordgo.MessageEmbed) *EmbedMessage
EditRaw updates the current embed message with the given raw embed replacing the internal message and error of this embed instance.
func (*EmbedMessage) Error ¶
func (emb *EmbedMessage) Error() error
Error returns the embedded error.