Versions in this module Expand all Collapse all v1 v1.24.19 Mar 7, 2021 Changes in this version + const ServicesRedisKey + var AllowedMentionsParseUsers = discordgo.AllowedMentions + var Nouns = []string + var SQLX *sqlx.DB + var ServicePoller = &servicePoller + var ServiceTracker = newServiceTracker() + func AddCPLogEntryLegacy(user *discordgo.User, guild int64, args ...interface{}) + func CoreInit() error + func DiscordGatewayLogger(shardID int, connectionID int, msgL int, msgf string, args ...interface{}) + func GenLocalIncrIDPQ(tx *sql.Tx, guildID int64, key string) (int64, error) + func InitTestRedis() error + func LogLongCallTime(treshold time.Duration, isErr bool, logMsg string, extraData logrus.Fields, ...) + func ParseDuration(str string) (time.Duration, error) + func RandomNoun() string + func RegisterDBSchemas(name string, schemas ...string) + func RunCommonRunPlugins() + func SetShutdownFunc(f func()) + func Shutdown() + func TableExists(table string) (b bool, err error) + type BotServiceDetails struct + NodeID string + OrchestratorMode bool + RunningShards []int + TotalShards int + type CPLogEntryLegacy struct + Action string + Timestamp int64 + TimestampString string + func GetCPLogEntriesLegacy(guild int64) ([]*CPLogEntryLegacy, error) type ContextKey + const ContextKeyIsReadOnly + const ContextKeyYagToken + type DBSchema struct + Name string + Schemas []string + type PluginWithCommonRun interface + CommonRun func() + type Service struct + BotDetails *BotServiceDetails + Details string + Name string + Type ServiceType + type ServiceHost struct + Host string + InternalAPIAddress string + PID int + Services []*Service + Version string + type ServiceType string + const ServiceTypeBGWorker + const ServiceTypeBot + const ServiceTypeConfigService + const ServiceTypeFeed + const ServiceTypeFrontend + const ServiceTypeOrchestator v1.20.6 Sep 3, 2019 Changes in this version + const CoreServerConfDBSchema + const VERSIONMAJOR + const VERSIONMINOR + const VERSIONPATCH + var Adjectives = []string + var AllInviteSources = append([]*InviteSource{ ... }, ThirdpartyDiscordSites) + var BotOwners []int64 + var BotSession *discordgo.Session + var BotUser *discordgo.User + var Cache *ccache.Cache + var CacheKeyPrefix = "cache_" + var ConfBotToken = config.RegisterOption("yagpdb.bottoken", "Token of the bot user", nil) + var ConfClientID = config.RegisterOption("yagpdb.clientid", "Client ID of the discord application", nil) + var ConfClientSecret = config.RegisterOption("yagpdb.clientsecret", "Client Secret of the discord application", nil) + var ConfDisableKeepalives = config.RegisterOption("yagpdb.disable_keepalives", ...) + var ConfDogStatsdAddress = config.RegisterOption("yagpdb.dogstatsdaddress", "dogstatsd address", "") + var ConfEmail = config.RegisterOption("yagpdb.email", "Email used when fetching lets encrypt certificate", "") + var ConfHost = config.RegisterOption("yagpdb.host", ...) + var ConfMaxCCR = config.RegisterOption("yagpdb.max_ccr", "Maximum number of concurrent outgoing requests to discord", ...) + var ConfPQDB = config.RegisterOption("yagpdb.pqdb", "Postgres database", "yagpdb") + var ConfPQHost = config.RegisterOption("yagpdb.pqhost", "Postgres host", "localhost") + var ConfPQPassword = config.RegisterOption("yagpdb.pqpassword", "Postgres passoword", "") + var ConfPQUsername = config.RegisterOption("yagpdb.pqusername", "Postgres user", "postgres") + var ConfRedis = config.RegisterOption("yagpdb.redis", "Redis address", "localhost:6379") + var CoreServerConfigCache = rcache.NewInt(coreServerConfigCacheFetcher, time.Minute) + var CurrentRunCounter int64 + var DiscordInviteSource = &InviteSource + var ErrMaxLockAttemptsExceeded = errors.New("Max lock attempts exceeded") + var ErrNotFound = errors.New("Not found") + var GORM *gorm.DB + var LinkRegex = regexp.MustCompile(...) + var NodeID string + var PQ *sql.DB + var PluginCategoryCore = &PluginCategory + var PluginCategoryFeeds = &PluginCategory + var PluginCategoryMisc = &PluginCategory + var PluginCategoryModeration = &PluginCategory + var Plugins []Plugin + var RedisPool *basicredispool.Pool + var RedisPoolSize = 10 + var Statsd *statsd.Client + var StringPerms = map[int]string + var Testing = os.Getenv("YAGPDB_TESTING") != "" + var ThirdpartyDiscordSites = []*InviteSource + var VERSION = VERSIONNUMBER + var VERSIONNUMBER = fmt.Sprintf("%d.%d.%d", VERSIONMAJOR, VERSIONMINOR, VERSIONPATCH) + func AddCPLogEntry(user *discordgo.User, guild int64, args ...interface{}) + func AddLogHook(hook logrus.Hook) + func AddRole(member *discordgo.Member, role int64, guildID int64) error + func AddRoleDS(ms *dstate.MemberState, role int64) error + func BlockingLockRedisKey(key string, maxTryDuration time.Duration, maxLockDur int) error + func BotIsOnGuild(guildID int64) (bool, error) + func ConnectDatadog() + func ContainsInt64Slice(slice []int64, search int64) bool + func ContainsInt64SliceOneOf(slice []int64, search []int64) bool + func ContainsIntSlice(slice []int, search int) bool + func ContainsStringSlice(strs []string, search string) bool + func ContainsStringSliceFold(strs []string, search string) bool + func ContextCoreConf(ctx context.Context) *models.CoreConfig + func CoreConfigSave(ctx context.Context, m *models.CoreConfig) error + func CutStringShort(s string, l int) string + func DelayedMessageDelete(session *discordgo.Session, delay time.Duration, cID, mID int64) + func DiscordError(err error) (code int, msg string) + func ErrPQIsUniqueViolation(err error) bool + func ErrWithCaller(err error) error + func EscapeEveryoneHere(s string, escapeEveryone, escapeHere bool) string + func EscapeSpecialMentions(in string) string + func EscapeSpecialMentionsConditional(s string, allowEveryone, allowHere bool, allowRoles []int64) string + func FallbackEmbed(embed *discordgo.MessageEmbed) string + func GenLocalIncrID(guildID int64, key string) (int64, error) + func GetActiveNodes() ([]string, error) + func GetBotToken() string + func GetCacheData(key string) (data []byte, err error) + func GetCacheDataJson(key string, dest interface{}) error + func GetCoreServerConfCached(guildID int64) *models.CoreConfig + func GetFixedPrefixLogger(prefix string) *logrus.Logger + func GetGuild(guildID int64) (guild *discordgo.Guild, err error) + func GetGuildChannels(guildID int64) (channels []*discordgo.Channel, err error) + func GetJoinedServerCount() (int64, error) + func GetPluginLogger(plugin Plugin) *logrus.Logger + func GetRedisJson(key string, out interface{}) error + func HumanizeDuration(precision DurationFormatPrecision, in time.Duration) string + func HumanizePermissions(perms int64) (res []string) + func HumanizeTime(precision DurationFormatPrecision, in time.Time) string + func Init() error + func InitSchemas(name string, schemas ...string) + func InitTest() + func IsDiscordErr(err error, codes ...int) bool + func IsNumber(v interface{}) bool + func IsOwner(userID int64) bool + func KeyGuild(guildID int64) string + func KeyGuildChannels(guildID int64) string + func LoadConfig() (err error) + func LogIgnoreError(err error, msg string, data logrus.Fields) + func MultipleCmds(cmds ...radix.CmdAction) error + func MustParseInt(s string) int64 + func RandomAdjective() string + func RegisterPlugin(plugin Plugin) + func RemoveRole(member *discordgo.Member, role int64, guildID int64) error + func RemoveRoleDS(ms *dstate.MemberState, role int64) error + func ReplaceServerInvites(msg string, guildID int64, replacement string) string + func RetrySendMessage(channel int64, msg interface{}, maxTries int) error + func SendEmbedWithFallback(s *discordgo.Session, channelID int64, embed *discordgo.MessageEmbed) (*discordgo.Message, error) + func SendOwnerAlert(msgf string, args ...interface{}) + func SendTempMessage(session *discordgo.Session, duration time.Duration, cID int64, msg string) + func SetCacheData(key string, expire int, data []byte) error + func SetCacheDataJson(key string, expire int, data interface{}) error + func SetCacheDataJsonSimple(key string, data interface{}) error + func SetCacheDataSimple(key string, data []byte) error + func SetLogFormatter(formatter logrus.Formatter) + func SetLoggingLevel(level logrus.Level) + func SetRedisJson(key string, value interface{}) error + func SqlTX(f func(tx *sql.Tx) error) error + func TryLockRedisKey(key string, maxDur int) (bool, error) + func UnlockRedisKey(key string) + type CPLogEntry struct + Action string + Timestamp int64 + TimestampString string + func GetCPLogEntries(guild int64) ([]*CPLogEntry, error) + type ContextHook struct + func (hook ContextHook) Fire(entry *logrus.Entry) error + func (hook ContextHook) Levels() []logrus.Level + type ContextKey int + const ContextKeyBotMember + const ContextKeyBotPermissions + const ContextKeyCoreConfig + const ContextKeyCurrentGuild + const ContextKeyDiscordSession + const ContextKeyFormOk + const ContextKeyGuildRoles + const ContextKeyHighestBotRole + const ContextKeyIsAdmin + const ContextKeyIsPartial + const ContextKeyLogger + const ContextKeyMemberPermissions + const ContextKeyParsedForm + const ContextKeyRedis + const ContextKeyTemplateData + const ContextKeyUser + const ContextKeyUserMember + type DurationFormatPrecision int + const DurationPrecisionDays + const DurationPrecisionHours + const DurationPrecisionMinutes + const DurationPrecisionSeconds + const DurationPrecisionWeeks + const DurationPrecisionYears + func (d DurationFormatPrecision) FromSeconds(in int64) int64 + func (d DurationFormatPrecision) String() string + type GORMLogger struct + func (g *GORMLogger) Print(v ...interface{}) + type GuildWithConnected struct + Connected bool + func GetGuildsWithConnected(in []*discordgo.UserGuild) ([]*GuildWithConnected, error) + type InviteSource struct + Name string + Regex *regexp.Regexp + func ContainsInvite(s string, checkDiscordSource, checkThirdPartySources bool) *InviteSource + type LoggedExecutedCommand struct + ChannelID string + Command string + Error string + GuildID string + RawCommand string + ResponseTime int64 + TimeStamp time.Time + UserID string + func (l LoggedExecutedCommand) TableName() string + type LoggingTransport struct + Inner http.RoundTripper + func (t *LoggingTransport) RoundTrip(request *http.Request) (*http.Response, error) + type Plugin interface + PluginInfo func() *PluginInfo + type PluginCategory struct + Name string + Order int + type PluginInfo struct + Category *PluginCategory + Name string + SysName string + type PrefixedLogFormatter struct + Inner logrus.Formatter + Prefix string + func (p *PrefixedLogFormatter) Format(entry *logrus.Entry) ([]byte, error) + type STDLogProxy struct + func (p *STDLogProxy) Write(b []byte) (n int, err error) + type SmallModel struct + CreatedAt time.Time + ID uint + UpdatedAt time.Time