Documentation ¶
Index ¶
- Constants
- func AddNonEmpty[T any](m map[string]T, name string, value T)
- func AppendCommand(cmds []*discordgo.ApplicationCommand, cmdData [2]string, ...) (string, []*discordgo.ApplicationCommand)
- func AuthorizedCmd(s *discordgo.Session, i *discordgo.InteractionCreate, infos GuildAndConfInfo, ...)
- func BuildMsgWithNameValueList(baseMsg string, nameToValue map[string]string) string
- func CleanMessage(msg string) string
- func ExtractNick(member *discordgo.Member) (nick string)
- func IdInSet(ids []string, idSet StringSet) bool
- func InitChecker(rule string) func(string) bool
- func LaunchTickers(number int, interval time.Duration) []chan time.Time
- func LogBeforeShutdown()
- func MembersCmd(s *discordgo.Session, i *discordgo.InteractionCreate, ...)
- func ProcessMembers(guildMembers []*discordgo.Member, userMonitor *IdMonitor, ...) int
- func SendTick(tickSender chan<- bool, interval time.Duration)
- func UpdateGameStatus(session *discordgo.Session, games []string, interval time.Duration)
- type ChannelSenderManager
- type Config
- func (c Config) GetChatResponsesConfig() (string, map[string]string)
- func (c Config) GetCommandConfig() map[string][2]string
- func (c Config) GetDelayMins(valuesConfName string) []time.Duration
- func (c Config) GetDurationSec(valueConfName string) time.Duration
- func (c Config) GetIdSet(namesConfName string, nameToId map[string]string) StringSet
- func (c Config) GetPath(pathConfName string) string
- func (c Config) GetPrefixConfig() (map[string]string, []string, [][2]string, []string)
- func (c Config) GetSlice(valuesConfName string) []any
- func (c Config) GetString(valueConfName string) string
- func (c Config) GetStringSlice(valuesConfName string) []string
- func (c Config) Require(valueConfName string) string
- type Empty
- type GuildAndConfInfo
- type IdMonitor
- type Messages
- type MultipartMessage
- type StringSet
Constants ¶
View Source
const ( CmdPlaceHolder = "{{cmd}}" NumErrorPlaceHolder = "{{numError}}" RolePlaceHolder = "{{role}}" )
View Source
const MemberCallLimit = 1000
max number of members returned by Discord API (as stated in Session.GuildMembers documentation)
Variables ¶
This section is empty.
Functions ¶
func AddNonEmpty ¶
func AppendCommand ¶
func AppendCommand(cmds []*discordgo.ApplicationCommand, cmdData [2]string, options []*discordgo.ApplicationCommandOption) (string, []*discordgo.ApplicationCommand)
func AuthorizedCmd ¶ added in v1.4.0
func AuthorizedCmd(s *discordgo.Session, i *discordgo.InteractionCreate, infos GuildAndConfInfo, cmdEffect func() string)
func CleanMessage ¶ added in v1.4.0
Remove "{{cmd}}" place holder and replace multiple space in row by one space
func ExtractNick ¶
func InitChecker ¶
func LogBeforeShutdown ¶ added in v1.4.0
func LogBeforeShutdown()
func MembersCmd ¶
func MembersCmd(s *discordgo.Session, i *discordgo.InteractionCreate, messageSender chan<- MultipartMessage, infos GuildAndConfInfo, msgs Messages, userMonitor *IdMonitor, cmdEffect func(*discordgo.Member) int)
func ProcessMembers ¶ added in v1.4.0
Types ¶
type ChannelSenderManager ¶
type ChannelSenderManager struct {
// contains filtered or unexported fields
}
func MakeChannelSenderManager ¶
func MakeChannelSenderManager(session *discordgo.Session) ChannelSenderManager
func (ChannelSenderManager) AddChannel ¶
func (m ChannelSenderManager) AddChannel(channelId string)
func (ChannelSenderManager) Get ¶
func (m ChannelSenderManager) Get(channelId string) chan<- MultipartMessage
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
func ReadConfig ¶
func ReadConfig() Config
func (Config) GetChatResponsesConfig ¶ added in v1.5.0
func (Config) GetCommandConfig ¶ added in v1.4.0
func (Config) GetPrefixConfig ¶
func (Config) GetStringSlice ¶
type GuildAndConfInfo ¶
type GuildAndConfInfo struct { GuildId string OwnerId string DefaultRoleId string AuthorizedRoleIds StringSet ForbiddenRoleIds StringSet IgnoredRoleIds StringSet ForbiddenAndignoredRoleIds StringSet AdminitrativeRoleIds StringSet CmdRoleIds StringSet SpecialRoleIds StringSet RoleIdToPrefix map[string]string Prefixes []string RoleIdToDisplayName map[string]string Msgs Messages }
type IdMonitor ¶
type IdMonitor struct {
// contains filtered or unexported fields
}
func MakeIdMonitor ¶
func MakeIdMonitor() IdMonitor
func (*IdMonitor) StartProcessing ¶
func (*IdMonitor) StopProcessing ¶
type Messages ¶ added in v1.4.0
type Messages struct { Ok string ErrGlobalCmd string ErrPartialCmd string Count string Prefix string NoChange string EndedCmd string Owner string ErrGlobal string ErrPartial string }
func (Messages) ReplaceCmdPlaceHolder ¶ added in v1.4.0
type MultipartMessage ¶
Click to show internal directories.
Click to hide internal directories.