helpers

package
v0.0.0-...-07de05f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 20, 2022 License: AGPL-3.0 Imports: 65 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DISCORD_EPOCH                     int64 = 1420070400000
	DISCORD_DARK_THEME_BACKGROUND_HEX       = "#36393F"
)
View Source
const (
	PROXIES_KEY       = "robyul-discord:gimmeproxy:proxies"
	NUMBER_OF_PROXIES = 240
)
View Source
const (
	ModulePermStats          models.ModulePermissionsModule = 1 << iota // stats.go, uptime.go
	ModulePermTranslator                                                // translator.go
	ModulePermUrban                                                     // urbandict.go
	ModulePermWeather                                                   // weather.go
	ModulePermVLive                                                     // vlive.go
	ModulePermInstagram                                                 // instagram/
	ModulePermFacebook                                                  // facebook.go
	ModulePermWolframAlpha                                              // wolframalpha.go
	ModulePermLastFm                                                    // lastfm.go
	ModulePermTwitch                                                    // twitch.go
	ModulePermCharts                                                    // charts.go
	ModulePermChoice                                                    // choice.go
	ModulePermOsu                                                       // osu.go
	ModulePermReminders                                                 // reminders.go
	ModulePermGfycat                                                    // gfycat.go
	ModulePermRandomPictures                                            // randompictures.go
	ModulePermYouTube                                                   // youtube/
	ModulePermSpoiler                                                   // spoiler.go
	ModulePermAnimals                                                   // random_cat.go, dog.go
	ModulePermGames                                                     // rps.go, biasgame, nugugame/
	ModulePermDig                                                       // dig.go
	ModulePermStreamable                                                // streamable.go
	ModulePermLyrics                                                    // lyrics.go
	ModulePermMisc
	ModulePermReddit             // reddit.go
	ModulePermColor              // color.go
	ModulePermSteam              // dog.go
	ModulePermGoogle             // google/
	ModulePermWhois              // whois.go
	ModulePermIsup               // isup.go
	ModulePermLevels             // levels.go
	ModulePermCustomCommands     // customcommands.go
	ModulePermReactionPolls      // reactionpolls.go
	ModulePermTwitter            // twitter.go
	ModulePermStarboard          // starboard.go
	ModulePermAutoRole           // autorole.go
	ModulePermBias               // bias.go
	ModulePermDiscordmoney       // discordmoney.go
	ModulePermGallery            // gallery.go
	ModulePermGuildAnnouncements // guildannouncements.go
	ModulePermMirror             // mirror.go
	ModulePermMod                // mod.go
	ModulePermNotifications      // notifications.go
	ModulePermNuke               // nuke.go
	ModulePermPersistency        // persistency.go
	ModulePermPing               // ping.go
	ModulePermTroublemaker       // troublemaker.go
	ModulePermVanityInvite       // vanityinvite.go
	ModulePerm8ball              // 8ball.go
	ModulePermAllPlaceholder
	ModulePermFeedback  // feedback.go
	ModulePermEmbedPost // embedpost.go
	ModulePermEventlog  // eventlog/
	ModulePermCrypto    // crypto.go
	ModulePermImgur     // imgur.go

	ModulePermAll = ModulePermStats | ModulePermTranslator | ModulePermUrban | ModulePermWeather | ModulePermVLive |
		ModulePermInstagram | ModulePermFacebook | ModulePermWolframAlpha | ModulePermLastFm | ModulePermTwitter |
		ModulePermTwitch | ModulePermCharts | ModulePermChoice | ModulePermOsu | ModulePermReminders |
		ModulePermGfycat | ModulePermRandomPictures | ModulePermYouTube | ModulePermSpoiler | ModulePermAnimals |
		ModulePermGames | ModulePermDig | ModulePermStreamable | ModulePermLyrics | ModulePermMisc | ModulePermReddit |
		ModulePermColor | ModulePermSteam | ModulePermGoogle | ModulePermWhois | ModulePermIsup | ModulePermLevels |
		ModulePermCustomCommands | ModulePermReactionPolls | ModulePermTwitter | ModulePermStarboard |
		ModulePermAutoRole | ModulePermBias | ModulePermDiscordmoney | ModulePermGallery |
		ModulePermGuildAnnouncements | ModulePermMirror | ModulePermMirror | ModulePermMod | ModulePermNotifications |
		ModulePermNuke | ModulePermPersistency | ModulePermPing | ModulePermTroublemaker | ModulePermVanityInvite |
		ModulePerm8ball | ModulePermFeedback | ModulePermEmbedPost | ModulePermEventlog | ModulePermCrypto | ModulePermImgur
)
View Source
const (
	LEFT_ARROW_EMOJI  = "⬅"
	RIGHT_ARROW_EMOJI = "➡"
	X_EMOJI           = "🇽"
	NAV_NUMBERS       = "🔢"

	FIELD_MESSAGE_TYPE = iota
	IMAGE_MESSAGE_TYPE
)
View Source
const (
	SettingLevelMod   models.SettingLevel = "mod"
	SettingLevelAdmin models.SettingLevel = "admin"
)
View Source
const ElasticIndexTimeout = "5s"
View Source
const (
	ServerLimitPerFriend = 95
)
View Source
const (
	ZERO_WIDTH_SPACE = "\u200B"
)

Variables

View Source
var (
	// UserRegexStrict matches Discord User Mentions
	// Source: https://github.com/b1naryth1ef/disco/blob/master/disco/bot/command.py#L15
	UserRegexStrict = regexp.MustCompile(`<@!?(\d+)>`)

	// RoleRegexStrict matches Discord Role Mentions
	// Source: https://github.com/b1naryth1ef/disco/blob/master/disco/bot/command.py#L16
	RoleRegexStrict = regexp.MustCompile(`<#(\d+)>`)

	// ChannelRegexStrict matches Discord Channel Mentions
	// Source: https://github.com/b1naryth1ef/disco/blob/master/disco/bot/command.py#L17
	ChannelRegexStrict = regexp.MustCompile(`<#(\d+)>`)

	// MentionRegexStrict matches Discord Emoji
	// Source: Discord API Server => ?tag discordregex
	MentionRegexStrict = regexp.MustCompile(`<a?:(\w+):(\d+)>`)

	// URLRege matches a URL on Discord
	URLRegex = regexp.MustCompile(`((?:https?|steam):\/\/[^\s<]+[^<.,:;"'\]\s])`)
)
View Source
var (
	AuditLogBackfillRequestsLock = sync.Mutex{}
)
View Source
var BasicInspectRoleIDs = []string{
	"345209098100277248",
}
View Source
var Blacklisted = []string{
	"171883318386753536",
	"502156053597782027",
	"466007709322444800",
	"430514716243263498",
}
View Source
var BlacklistedGuildIDs = []string{
	"586923572392493061",
}
View Source
var (
	// DEBUG_MODE is queried by a lot of functions to alter behaviour under new circumstances.
	// Search globally for it to see what it does.
	DEBUG_MODE = false
)
View Source
var DEFAULT_UA = "Robyul2/" + version.BOT_VERSION + " (https://robyul.chat)"
View Source
var DefaultClient = &http.Client{
	Timeout: time.Duration(15 * time.Second),
}
View Source
var ExtendedInspectRoleIDs = []string{
	"345209385821274113",
	"345209098100277248",
}
View Source
var LimitedGuildIDs = []string{
	"264445053596991498",
}

No Level gaining, No Elastic Search features

View Source
var (
	Modules = []ModulePermissionsModuleInfo{
		{Names: []string{"stats"}, Permission: ModulePermStats},
		{Names: []string{"translator"}, Permission: ModulePermTranslator},
		{Names: []string{"urbandict", "urban"}, Permission: ModulePermUrban},
		{Names: []string{"weather"}, Permission: ModulePermWeather},
		{Names: []string{"vlive"}, Permission: ModulePermVLive},
		{Names: []string{"instagram"}, Permission: ModulePermInstagram},
		{Names: []string{"facebook"}, Permission: ModulePermFacebook},
		{Names: []string{"wolframalpha", "wolfram"}, Permission: ModulePermWolframAlpha},
		{Names: []string{"lastfm"}, Permission: ModulePermLastFm},
		{Names: []string{"twitch"}, Permission: ModulePermTwitch},
		{Names: []string{"charts"}, Permission: ModulePermCharts},
		{Names: []string{"choice"}, Permission: ModulePermChoice},
		{Names: []string{"osu"}, Permission: ModulePermOsu},
		{Names: []string{"reminders"}, Permission: ModulePermReminders},
		{Names: []string{"gfycat"}, Permission: ModulePermGfycat},
		{Names: []string{"randompictures"}, Permission: ModulePermRandomPictures},
		{Names: []string{"youtube"}, Permission: ModulePermYouTube},
		{Names: []string{"spoiler"}, Permission: ModulePermSpoiler},
		{Names: []string{"animals", "cat", "randomcat", "dog"}, Permission: ModulePermAnimals},
		{Names: []string{"games", "rps", "biasgame", "nugugame"}, Permission: ModulePermGames},
		{Names: []string{"dig"}, Permission: ModulePermDig},
		{Names: []string{"streamable"}, Permission: ModulePermStreamable},
		{Names: []string{"lyrics"}, Permission: ModulePermLyrics},
		{Names: []string{"misc"}, Permission: ModulePermMisc},
		{Names: []string{"reddit"}, Permission: ModulePermReddit},
		{Names: []string{"color"}, Permission: ModulePermColor},
		{Names: []string{"steam"}, Permission: ModulePermSteam},

		{Names: []string{"whois"}, Permission: ModulePermWhois},
		{Names: []string{"isup"}, Permission: ModulePermIsup},
		{Names: []string{"levels"}, Permission: ModulePermLevels},
		{Names: []string{"customcommands"}, Permission: ModulePermCustomCommands},
		{Names: []string{"reactionpolls"}, Permission: ModulePermReactionPolls},
		{Names: []string{"twitter"}, Permission: ModulePermTwitter},
		{Names: []string{"starboard"}, Permission: ModulePermStarboard},
		{Names: []string{"autorole"}, Permission: ModulePermAutoRole},
		{Names: []string{"bias"}, Permission: ModulePermBias},
		{Names: []string{"discordmoney"}, Permission: ModulePermDiscordmoney},
		{Names: []string{"gallery"}, Permission: ModulePermGallery},
		{Names: []string{"serverannouncements", "guildannouncements"}, Permission: ModulePermGuildAnnouncements},
		{Names: []string{"mirror"}, Permission: ModulePermMirror},
		{Names: []string{"mod", "names"}, Permission: ModulePermMod},
		{Names: []string{"notifications"}, Permission: ModulePermNotifications},
		{Names: []string{"nuke"}, Permission: ModulePermNuke},
		{Names: []string{"persistency"}, Permission: ModulePermPersistency},
		{Names: []string{"ping"}, Permission: ModulePermPing},
		{Names: []string{"troublemaker"}, Permission: ModulePermTroublemaker},
		{Names: []string{"custominvite", "vanityinvite"}, Permission: ModulePermVanityInvite},
		{Names: []string{"8ball"}, Permission: ModulePerm8ball},
		{Names: []string{"feedback"}, Permission: ModulePermFeedback},
		{Names: []string{"embed", "embedpost"}, Permission: ModulePermEmbedPost},
		{Names: []string{"eventlog"}, Permission: ModulePermEventlog},
		{Names: []string{"crypto"}, Permission: ModulePermCrypto},
		{Names: []string{"imgur"}, Permission: ModulePermImgur},
	}
)
View Source
var NukeMods = []string{
	"116620585638821891",
	"134298438559858688",
	"68661361537712128",
}
View Source
var (
	PROXY_CHECK_URLS = []string{"https://robyul.chat"}
)
View Source
var RobyulMod = []string{
	"273639623324991489",
}
View Source
var (
	// UnleashInitialised will be set to true when it has been initialised
	UnleashInitialised = false
)

Functions

func AddAutoleaverGuildID

func AddAutoleaverGuildID(s string) bool

func AddFile

func AddFile(name string, data []byte, metadata AddFileMetadata, source string, public bool) (objectName string, err error)

TODO: prevent duplicates Stores a file name : the name of the new object, can be empty to generate an unique name data : the file data metadata : metadata attached to the object source : the source name for the file, for example the module name, can not be empty public : if true file will be available via the website proxy

func AddMutePersistency

func AddMutePersistency(guildID, userID string) (err error)

func AddMuteRole

func AddMuteRole(guildID string, userID string) (err error)

func AddNoPermissionsReaction

func AddNoPermissionsReaction(channelID, messageID string)

func AllGuilds

func AllGuilds() []*discordgo.Guild

func AutoPagify

func AutoPagify(text string) (pages []string)

func BtoA

func BtoA(s string) string

BtoA is a polyfill for javascript's window#btoa()

func CachedProxiesHealthcheck

func CachedProxiesHealthcheck()

func CachedProxiesHealthcheckLoop

func CachedProxiesHealthcheckLoop()

func CalculateFullEmbedLength

func CalculateFullEmbedLength(embed *discordgo.MessageEmbed) (count int)

func CanInspectBasic

func CanInspectBasic(msg *discordgo.Message) bool

func CanInspectExtended

func CanInspectExtended(msg *discordgo.Message) bool

func CanRevert

func CanRevert(item models.ElasticEventlog) bool

func ChannelOverwritesMatch

func ChannelOverwritesMatch(aOverwrites, bOverwrites []*discordgo.PermissionOverwrite) (match bool)

func ChannelPermissionsInSync

func ChannelPermissionsInSync(childChannelID string) (inSync bool)

func CleanDiscordContent

func CleanDiscordContent(content string) (output string)

func CleanEmbedValue

func CleanEmbedValue(input string) (output string)

func CollageFromBytes

func CollageFromBytes(imageDataArray [][]byte, descriptions []string, width, height, tileWidth, tileHeight int, backgroundColour string) (collageBytes []byte)

Creates a Collage PNG Image from image []byte (PNG or JPEG). imageDataArray : a slice of all image []byte data descriptions : a slice with text that will be written on each tile. Can be empty. width : the width of the result collage image. height : the height of the result collage image. tileWidth : the width of each tile image. tileHeight : the height of each tile image. backgroundColour : the background colour as a hex string.

func CollageFromUrls

func CollageFromUrls(imageUrls, descriptions []string, width, height, tileWidth, tileHeight int, backgroundColour string) (collageBytes []byte)

Creates a Collage PNG Image from internet image urls (PNG or JPEG). imageUrls : a slice with all image URLs. Empty strings will create an empty space in the collage. descriptions : a slice with text that will be written on each tile. Can be empty. width : the width of the result collage image. height : the height of the result collage image. tileWidth : the width of each tile image. tileHeight : the height of each tile image. backgroundColour : the background colour as a hex string.

func CombineTwoImages

func CombineTwoImages(img1 image.Image, img2 image.Image) image.Image

CombineTwoImages combines two images with img1 being on the left and img2 on the right. returns the resulting image

func CommandExists

func CommandExists(name string) bool

func ConfirmEmbed

func ConfirmEmbed(guildID, channelID string, author *discordgo.User, confirmMessageText string, confirmEmojiID string, abortEmojiID string) bool

func ConnectMDB

func ConnectMDB(url string, database string)

ConnectDB connects to mongodb and stores the session

func CreatePendingUnmute

func CreatePendingUnmute(guildID string, userID string, unmuteAt time.Time) (err error)

func DecodeImage

func DecodeImage(r io.ReadCloser) (image.Image, error)

decodeImage decodes the image with retry.

func DecodeImageBytes

func DecodeImageBytes(imageBytes []byte) (image.Image, string, error)

DecodeImageBytes

func DeleteFile

func DeleteFile(objectName string) (err error)

Deletes a file objectName : the name of the object

func DeleteMessageWithDelay

func DeleteMessageWithDelay(msg *discordgo.Message, delay time.Duration) (err error)

DeleteMessageWithDelay will delete the given message after a given time duration

func DeletePagedMessage

func DeletePagedMessage(messageID string)

func DrawTable

func DrawTable(headers []string, rows [][]string) string

DrawTable draws a fancy ASCII table Inspired by MySQL

func EditComplex

func EditComplex(data *discordgo.MessageEdit) (message *discordgo.Message, err error)

func EditEmbed

func EditEmbed(channelID, messageID string, embed *discordgo.MessageEmbed) (message *discordgo.Message, err error)

func EditMessage

func EditMessage(channelID, messageID, content string) (message *discordgo.Message, err error)

func ElasticAddEventlog

func ElasticAddEventlog(createdAt time.Time, guildID, targetID, targetType, userID, actionType, reason string,
	changes []models.ElasticEventlogChange, options []models.ElasticEventlogOption, waitingForAuditLogBackfill bool, messageIDs []string) (id string, err error)

func ElasticAddJoin

func ElasticAddJoin(member *discordgo.Member, usedInvite, usedVanityName string) error

func ElasticAddLeave

func ElasticAddLeave(member *discordgo.Member) error

func ElasticAddMessage

func ElasticAddMessage(message *discordgo.Message) error

func ElasticAddPresenceUpdate

func ElasticAddPresenceUpdate(presence *discordgo.Presence) error

func ElasticAddVanityInviteClick

func ElasticAddVanityInviteClick(vanityInvite models.VanityInviteEntry, referer string) error

func ElasticAddVoiceSession

func ElasticAddVoiceSession(guildID, channelID, userID string, joinTime, leaveTime time.Time) (err error)

func ElasticDeleteMessage

func ElasticDeleteMessage(message *discordgo.Message) error

func ElasticGetEventlog

func ElasticGetEventlog(eventlogID string) (eventlogItem *models.ElasticEventlog, err error)

func ElasticOnGuildMemberRemove

func ElasticOnGuildMemberRemove(session *discordgo.Session, member *discordgo.GuildMemberRemove)

func ElasticOnMessageCreate

func ElasticOnMessageCreate(session *discordgo.Session, message *discordgo.MessageCreate)

func ElasticOnMessageDelete

func ElasticOnMessageDelete(session *discordgo.Session, message *discordgo.MessageDelete)

func ElasticOnMessageUpdate

func ElasticOnMessageUpdate(session *discordgo.Session, message *discordgo.MessageUpdate)

func ElasticOnPresenceUpdate

func ElasticOnPresenceUpdate(session *discordgo.Session, presence *discordgo.PresenceUpdate)

func ElasticUpdateEventLog

func ElasticUpdateEventLog(elasticID string, UserID string,
	options []models.ElasticEventlogOption, changes []models.ElasticEventlogChange,
	reason string, auditLogBackfilled bool, reverted bool, logMessageIDs []string) (eventlogItem *models.ElasticEventlog, err error)

func ElasticUpdateMessage

func ElasticUpdateMessage(message *discordgo.Message) error

func EmojIURL

func EmojIURL(emojiID string, animated bool) string

func EscapeLinkForMarkdown

func EscapeLinkForMarkdown(input string) (result string)

func EventlogLog

func EventlogLog(createdAt time.Time, guildID, targetID, targetType, userID, actionType, reason string,
	changes []models.ElasticEventlogChange, options []models.ElasticEventlogOption, waitingForAuditLogBackfill bool) (added bool, err error)

func EventlogLogUpdate

func EventlogLogUpdate(elasticID string, UserID string,
	options []models.ElasticEventlogOption, changes []models.ElasticEventlogChange,
	reason string, auditLogBackfilled, reverted bool) (err error)

func ExtractInviteCodes

func ExtractInviteCodes(input string) (inviteCodes []string)

Extracts ALL invites codes from the given message (message can contain multiple invites) (e.g. discord.gg/foo => [foo])

func FeatureEnabled

func FeatureEnabled(feature string, fallback bool) bool

func FillProxies

func FillProxies()

func FriendRequest

func FriendRequest(friend *discordgo.Session, method string, endpoint string) (result []byte, err error)
func GeneratePublicFileLink(filename, filehash string) (link string)

Gets a public link for a file filename : the name of the file filetype : the type of the file

func GetAllPagedMessages

func GetAllPagedMessages() map[string]*pagedEmbedMessage

func GetAllPermissions

func GetAllPermissions(guild *discordgo.Guild, member *discordgo.Member) int64

func GetAllowedForChannel

func GetAllowedForChannel(guildID, channelID string) (permissions models.ModulePermissionsModule)

func GetAllowedForRole

func GetAllowedForRole(guildID, roleID string) (permissions models.ModulePermissionsModule)

func GetAvatarUrl

func GetAvatarUrl(user *discordgo.User) string

func GetAvatarUrlWithSize

func GetAvatarUrlWithSize(user *discordgo.User, size uint16) string

func GetBotConfig

func GetBotConfig(key string, value interface{}) (err error)

TODO: cache

func GetBotConfigString

func GetBotConfigString(key string) (value string, err error)

func GetChannel

func GetChannel(channelID string) (*discordgo.Channel, error)

func GetChannelFromMention

func GetChannelFromMention(msg *discordgo.Message, mention string) (*discordgo.Channel, error)

func GetChannelOfAnyTypeFromMention

func GetChannelOfAnyTypeFromMention(msg *discordgo.Message, mention string) (*discordgo.Channel, error)

func GetChannelOrCategoryFromMention

func GetChannelOrCategoryFromMention(msg *discordgo.Message, mention string) (*discordgo.Channel, error)

func GetChannelWithoutApi

func GetChannelWithoutApi(channelID string) (*discordgo.Channel, error)

func GetConfig

func GetConfig() *gabs.Container

GetConfig is a config getter

func GetDeniedForChannel

func GetDeniedForChannel(guildID, channelID string) (permissions models.ModulePermissionsModule)

func GetDeniedForRole

func GetDeniedForRole(guildID, roleID string) (permissions models.ModulePermissionsModule)

func GetDisabledModules

func GetDisabledModules(guildID string) (disabledModules []models.ModulePermissionsModule)

func GetDiscordColorFromHex

func GetDiscordColorFromHex(hex string) int

func GetDiscordEmojiFromName

func GetDiscordEmojiFromName(guildID string, name string) (emoji *discordgo.Emoji, err error)

func GetDiscordEmojiFromText

func GetDiscordEmojiFromText(guildID string, text string) (emoji *discordgo.Emoji, err error)

func GetDiscordInviteByVanityInvite

func GetDiscordInviteByVanityInvite(vanityInviteEntry models.VanityInviteEntry) (code string, err error)

func GetEmbedCode

func GetEmbedCode(targetMessage *discordgo.Message) (embedCode string)
func GetFileLink(objectName string) (url string, err error)

Retrieves a file's public url, returns an error if file is not public objectName : the name of the object

func GetGlobalChannelFromMention

func GetGlobalChannelFromMention(mention string) (*discordgo.Channel, error)

func GetGuild

func GetGuild(guildID string) (*discordgo.Guild, error)

func GetGuildDefaultChannel

func GetGuildDefaultChannel(guildID string) (channelID string, err error)

Returns an channelID for bot announcements, if possible the default channel when a guild got created, if not the first channel from the top with chat permission guildID : the target Guild to get the channel for

func GetGuildMember

func GetGuildMember(guildID string, userID string) (*discordgo.Member, error)

func GetGuildMemberWithoutApi

func GetGuildMemberWithoutApi(guildID string, userID string) (*discordgo.Member, error)

func GetGuildWithoutApi

func GetGuildWithoutApi(guildID string) (*discordgo.Guild, error)

func GetHexFromDiscordColor

func GetHexFromDiscordColor(colour int) (hex string)

func GetImageHash

func GetImageHash(img image.Image) (*goimagehash.ImageHash, error)

GetImageHash returns the average image hash

note: use helpers.GetImageHash(img).ToString() to get the string value

func GetImageHashString

func GetImageHashString(img image.Image) (string, error)

GetImageHash returns the average image hash

note: use helpers.GetImageHash(img).ToString() to get the string value

func GetIsInGuild

func GetIsInGuild(guildID string, userID string) bool

func GetJSON

func GetJSON(url string) *gabs.Container

GetJSON sends a GET request to $url, parses it and returns the JSON

func GetLastFmClient

func GetLastFmClient() (client *lastfm.Api)

Gets the LastFM client from cache. If there is no LastFM client in cache yet it will create a new instance

func GetLastFmUsername

func GetLastFmUsername(userID string) (username string)

Gets the LastFM Username for a Discord User, returns an empty string if no username has been set userID : the ID of the discord user

func GetLastPresenceUpdate

func GetLastPresenceUpdate(userID string, elasticsearch bool) (*models.ElasticPresenceUpdate, error)

GetLastPresenceUpdate gets the last presence of an user, either from local cache, or ElasticSearch

func GetMD5Hash

func GetMD5Hash(text string) string

func GetMDb

func GetMDb() *mgo.Database

GetDB is a simple getter for the mongodb database.

func GetMDbSession

func GetMDbSession() *mgo.Session

GetDB is a simple getter for the mongodb session.

func GetMaxBadgesForGuild

func GetMaxBadgesForGuild(guildID string) (maxBadges int)

func GetMemberPermissions

func GetMemberPermissions(guildID, userID string) (apermissions int)

func GetMessage

func GetMessage(channelID string, messageID string) (*discordgo.Message, error)

func GetMinTimeForInterval

func GetMinTimeForInterval(interval string, count int) (minTime time.Time)

func GetModuleNameById

func GetModuleNameById(id models.ModulePermissionsModule) (name string)

func GetModulePermissionEntries

func GetModulePermissionEntries(guildID string) (entries []models.ModulePermissionEntry)

func GetMuteRole

func GetMuteRole(guildID string) (*discordgo.Role, error)

func GetPagedMessage

func GetPagedMessage(messageID string) *pagedEmbedMessage

GetPagedMessage will return the paged message if there is one, otherwill will return nil

func GetPermissionsText

func GetPermissionsText(permissions int) string

func GetPrefixForServer

func GetPrefixForServer(guildID string) string

GetPrefixForServer gets the prefix for $guild

func GetRandomProxy

func GetRandomProxy() (proxy http.Transport, err error)

func GetStaffUsernamesText

func GetStaffUsernamesText() (text string)

func GetStringAsBool

func GetStringAsBool(input string) bool

func GetText

func GetText(id string) string

func GetTextF

func GetTextF(id string, replacements ...interface{}) string

func GetTimeFromSnowflake

func GetTimeFromSnowflake(id string) time.Time

func GetUser

func GetUser(userID string) (*discordgo.User, error)

func GetUserConfig

func GetUserConfig(userID, key string, value interface{}) (err error)

TODO: cache

func GetUserConfigInt

func GetUserConfigInt(userID, key string, placeholder int) (value int)

func GetUserConfigString

func GetUserConfigString(userID, key, placeholder string) (value string)

func GetUserFromMention

func GetUserFromMention(mention string) (*discordgo.User, error)

func GetUserUserdata

func GetUserUserdata(userID string) (userdata models.ProfileUserdataEntry, err error)

func GetUserWithoutAPI

func GetUserWithoutAPI(userID string) (*discordgo.User, error)

func GetVanityUrlByGuildID

func GetVanityUrlByGuildID(guildID string) (entryBucket models.VanityInviteEntry, err error)

func GetVanityUrlByVanityName

func GetVanityUrlByVanityName(vanityName string) (entryBucket models.VanityInviteEntry, err error)

func GetWebhook

func GetWebhook(guildID, channelID string) (webhook *discordgo.Webhook, err error)

Gets a webhook for a channel (checks for permission, and uses cache) guildID : the guild from which to get the webhook channelID : the channel for which to get the webhook

func GimmeProxy

func GimmeProxy() (proxyUrl string, err error)

func GuildFriendRequest

func GuildFriendRequest(guildID string, method string, endpoint string) (result []byte, err error)

func GuildIsOnWhitelist

func GuildIsOnWhitelist(guildID string) bool

func GuildSettingsGet

func GuildSettingsGet(guild string) (models.Config, error)

GuildSettingsGet returns all config values for the guild or a default object

func GuildSettingsGetCached

func GuildSettingsGetCached(id string) models.Config

func GuildSettingsSet

func GuildSettingsSet(guild string, config models.Config) error

GuildSettingsSet writes all $config into the db

func GuildSettingsUpdater

func GuildSettingsUpdater()

func HasPermissionByID

func HasPermissionByID(guildID string, userID string, permission int) bool

func HumanToMdbId

func HumanToMdbId(text string) (id bson.ObjectId)

Returns an ObjectID from a human readable ID text : the human readable ID

func HumanizeDuration

func HumanizeDuration(d time.Duration) (result string)

func HumanizeNumber

func HumanizeNumber(num int) string

HumanizeNumber takes an int and turns it into a word

func HumanizedTimesSince

func HumanizedTimesSince(a time.Time) (year, month, day, hour, min, sec int)

http://stackoverflow.com/a/36531443

func HumanizedTimesSinceText

func HumanizedTimesSinceText(since time.Time) string

func ImageByteComparison

func ImageByteComparison(imgByte1, imgByte2 []byte) (int, error)

ImageHashComparison does an image comparison using the average hash

0 is perfect match

func ImageComparison

func ImageComparison(img1, img2 image.Image) (int, error)

ImageHashComparison does an image comparison using the average hash

0 is perfect match

func ImageHashStringComparison

func ImageHashStringComparison(imgHashString1, imgHashString2 string) (int, error)

ImageHashComparison does a comparison of the given hashes and returns value indicating their difference

0 is perfect match

func ImageToReader

func ImageToReader(sourceImage image.Image) *bytes.Reader

ImageToReader will take the given image and return a reader of the bytes

func InviteFriend

func InviteFriend() (*discordgo.Session, error)

func IsAdmin

func IsAdmin(msg *discordgo.Message) bool

func IsAdminByID

func IsAdminByID(guildID string, userID string) bool

func IsBlacklisted

func IsBlacklisted(id string) bool

func IsBlacklistedGuild

func IsBlacklistedGuild(guildID string) bool

func IsBotAdmin

func IsBotAdmin(id string) bool

IsBotAdmin checks if $id is in $botAdmins

func IsDiscordEmoji

func IsDiscordEmoji(text string) (isEmoji bool)

returns true if text is a discord custom emoji, returns false for everything else

func IsEmbedCode

func IsEmbedCode(embedText string) (isCode bool)

func IsEmoji

func IsEmoji(text string) (isEmoji bool)

returns true if text is an unicode emoji or a discord custom emoji, returns false for everything else

func IsLimitedGuild

func IsLimitedGuild(guildID string) bool

func IsMdbNotFound

func IsMdbNotFound(err error) (notFound bool)

Returns true if the given error is a not found error from MongoDB includes errors from invalid object IDs

func IsMod

func IsMod(msg *discordgo.Message) bool

func IsModByID

func IsModByID(guildID string, userID string) bool

func IsNukeMod

func IsNukeMod(id string) bool

func IsRobyulMod

func IsRobyulMod(id string) bool

func IsSnowflake

func IsSnowflake(input string) (snowflake bool)

func IsUnicodeEmoji

func IsUnicodeEmoji(text string) (isEmoji bool)

returns true if text is an unicode emoji, returns false for everything else

func LoadConfig

func LoadConfig(path string)

LoadConfig loads the config from $path into $config

func LoadTranslations

func LoadTranslations()

func LogMachineryError

func LogMachineryError(errorMessage string) (err error)

func MDbDelete

func MDbDelete(collection models.MongoDbCollection, id bson.ObjectId) (err error)

func MDbDeleteWithoutLogging

func MDbDeleteWithoutLogging(collection models.MongoDbCollection, id bson.ObjectId) (err error)

func MDbInsert

func MDbInsert(collection models.MongoDbCollection, data interface{}) (rid bson.ObjectId, err error)

func MDbInsertWithoutLogging

func MDbInsertWithoutLogging(collection models.MongoDbCollection, data interface{}) (rid bson.ObjectId, err error)

func MDbIter

func MDbIter(query *mgo.Query) (iter *mgo.Iter)

func MDbIterWithoutLogging

func MDbIterWithoutLogging(query *mgo.Query) (iter *mgo.Iter)

func MDbUpdate

func MDbUpdate(collection models.MongoDbCollection, id bson.ObjectId, data interface{}) (err error)

func MDbUpdateQuery

func MDbUpdateQuery(collection models.MongoDbCollection, selector interface{}, data interface{}) (err error)

func MDbUpdateQueryWithoutLogging

func MDbUpdateQueryWithoutLogging(collection models.MongoDbCollection, selector interface{}, data interface{}) (err error)

func MDbUpdateWithoutLogging

func MDbUpdateWithoutLogging(collection models.MongoDbCollection, id bson.ObjectId, data interface{}) (err error)

func MDbUpsert

func MDbUpsert(collection models.MongoDbCollection, selector interface{}, data interface{}) (err error)

func MDbUpsertID

func MDbUpsertID(collection models.MongoDbCollection, id bson.ObjectId, data interface{}) (err error)

func MDbUpsertIDWithoutLogging

func MDbUpsertIDWithoutLogging(collection models.MongoDbCollection, id bson.ObjectId, data interface{}) (err error)

func MDbUpsertWithoutLogging

func MDbUpsertWithoutLogging(collection models.MongoDbCollection, selector interface{}, data interface{}) (err error)

func MapToSliceOfSlices

func MapToSliceOfSlices(m map[string]string) [][]string

MapToSliceOfSlices converts a map to [][]string

func MdbCollection

func MdbCollection(collection models.MongoDbCollection) (query *mgo.Collection)

func MdbCount

func MdbCount(collection models.MongoDbCollection, query interface{}) (count int, err error)

func MdbCountWithoutLogging

func MdbCountWithoutLogging(collection models.MongoDbCollection, query interface{}) (count int, err error)

func MdbDeleteQuery

func MdbDeleteQuery(collection models.MongoDbCollection, selector interface{}) (err error)

func MdbDeleteQueryWithoutLogging

func MdbDeleteQueryWithoutLogging(collection models.MongoDbCollection, selector interface{}) (err error)

func MdbIdToHuman

func MdbIdToHuman(id bson.ObjectId) (text string)

Returns a human readable ID version of a ObjectID id : the ObjectID to convert

func MdbOne

func MdbOne(query *mgo.Query, object interface{}) (err error)

func MdbOneWithoutLogging

func MdbOneWithoutLogging(query *mgo.Query, object interface{}) (err error)

func MdbPipeOne

func MdbPipeOne(collection models.MongoDbCollection, pipeline interface{}, object interface{}) (err error)

func MdbPipeOneWithoutLogging

func MdbPipeOneWithoutLogging(collection models.MongoDbCollection, pipeline interface{}, object interface{}) (err error)
func MessageDeeplink(channelID, messageID string) string

MessageDeeplink returns a direct link to a discord message

func ModuleIsAllowed

func ModuleIsAllowed(channelID, msgID, userID string, module models.ModulePermissionsModule) (isAllowed bool)

func ModuleIsAllowedSilent

func ModuleIsAllowedSilent(channelID, msgID, userID string, module models.ModulePermissionsModule) (isAllowed bool)

func MuteUser

func MuteUser(guildID string, userID string, unmuteAt time.Time) (err error)

func NetGet

func NetGet(url string) []byte

NetGet executes a GET request to url with the Karen/Discord-Bot user-agent

func NetGetUA

func NetGetUA(url string, useragent string) []byte

NetGetUA performs a GET request with a custom user-agent

func NetGetUAWithError

func NetGetUAWithError(url string, useragent string) ([]byte, error)

func NetGetUAWithErrorAndTimeout

func NetGetUAWithErrorAndTimeout(url string, useragent string, timeout time.Duration) ([]byte, error)

func NetGetUAWithErrorAndTransport

func NetGetUAWithErrorAndTransport(url string, useragent string, transport http.Transport) ([]byte, error)

func NetPost

func NetPost(url string, data string) []byte

func NetPostUA

func NetPostUA(url string, data string, useragent string) []byte

func NetPostUAWithError

func NetPostUAWithError(url string, data string, useragent string) (result []byte, err error)

func ObjectExists

func ObjectExists(objectName string) bool

Checks if an object exists by checking cache for a file or requested metadata from minio objectName : the name of the file to retrieve

func OnEventlogChannelUpdate

func OnEventlogChannelUpdate(guildID string, oldChannel, newChannel *discordgo.Channel)

func OnEventlogEmojiCreate

func OnEventlogEmojiCreate(guildID string, emoji *discordgo.Emoji)

func OnEventlogEmojiDelete

func OnEventlogEmojiDelete(guildID string, emoji *discordgo.Emoji)

func OnEventlogEmojiUpdate

func OnEventlogEmojiUpdate(guildID string, oldEmoji, newEmoji *discordgo.Emoji)

func OnEventlogGuildUpdate

func OnEventlogGuildUpdate(guildID string, oldGuild, newGuild *discordgo.Guild)

func OnEventlogMemberUpdate

func OnEventlogMemberUpdate(guildID string, oldMember, newMember *discordgo.Member)

func OnEventlogRoleUpdate

func OnEventlogRoleUpdate(guildID string, oldRole, newRole *discordgo.Role)

func Pagify

func Pagify(text string, delimiter string) []string

func ParseCustomEmoji

func ParseCustomEmoji(text string) (emojiID, emojiName string, animated bool)

gathers the emoji ID and the animation status from a custom emoji posted on discord text : the custom emoji string, example: <a:anayoungSCREAM:394044148438794240>

func ParseEmbedCode

func ParseEmbedCode(embedText string) (ptext string, embed *discordgo.MessageEmbed, err error)

func ParseKeyValueString

func ParseKeyValueString(text string) (data map[string]string)

source: https://stackoverflow.com/a/44282136

func PictureIsSafe

func PictureIsSafe(reader io.Reader) (safe bool)

func Recover

func Recover()

Recover recover()s and prints the error to console

func RecoverDiscord

func RecoverDiscord(msg *discordgo.Message)

RecoverDiscord recover()s and sends a message to discord

func RefreshModulePermissionsCache

func RefreshModulePermissionsCache() (err error)

func Relax

func Relax(err error)

Relax is a helper to reduce if-checks if panicking is allowed If $err is nil this is a no-op. Panics otherwise.

func RelaxAssertEqual

func RelaxAssertEqual(a interface{}, b interface{}, err error)

RelaxAssertEqual panics if a is not b

func RelaxAssertUnequal

func RelaxAssertUnequal(a interface{}, b interface{}, err error)

RelaxAssertUnequal panics if a is b

func RelaxEmbed

func RelaxEmbed(err error, channelID string, commandMessageID string)

RelaxEmbed does nothing if $err is nil, prints a notice if there are no permissions to embed, else sends it to Relax()

func RelaxLog

func RelaxLog(err error)

func RelaxMessage

func RelaxMessage(err error, channelID string, commandMessageID string)

RelaxEmbed does nothing if $err is nil or if there are no permissions to send a message, else sends it to Relax()

func RemoveAutoleaverGuildID

func RemoveAutoleaverGuildID(s string) bool

func RemoveMuteDatabase

func RemoveMuteDatabase(guildID string, userID string) (err error)

func RemoveMutePersistency

func RemoveMutePersistency(guildID string, userID string) (err error)

func RemoveMuteRole

func RemoveMuteRole(guildID string, userID string) (err error)

func RemovePendingUnmutes

func RemovePendingUnmutes(guildID string, userID string) (err error)

func RemoveReactionsFromPagedEmbeds

func RemoveReactionsFromPagedEmbeds()

will remove all reactions from all paged embed messages.

mainly used on bot uninit to clean embeds

func RemoveVanityUrl

func RemoveVanityUrl(vanityInviteEntry models.VanityInviteEntry) error

func ReplaceEmojis

func ReplaceEmojis(content string) (result string)

ReplaceEmojis, replaces emoji mentions with text

func ReplaceMessageSend

func ReplaceMessageSend(message *discordgo.MessageSend, replace []*ReplaceValues) *discordgo.MessageSend

ReplaceMessageSend replaces all values in the message with the replace values

func RequestAuditLogBackfill

func RequestAuditLogBackfill(guildID string, backfillType models.AuditLogBackfillType, userID string) (err error)

requests an audit log backfill guildID and backfillType fields are required

func RequireAdmin

func RequireAdmin(msg *discordgo.Message, cb Callback)

RequireAdmin only calls $cb if the author is an admin or has MANAGE_SERVER permission

func RequireAdminOrStaff

func RequireAdminOrStaff(msg *discordgo.Message, cb Callback)

RequireAdmin only calls $cb if the author is an admin or has MANAGE_SERVER permission

func RequireBotAdmin

func RequireBotAdmin(msg *discordgo.Message, cb Callback)

RequireBotAdmin only calls $cb if the author is a bot admin

func RequireMod

func RequireMod(msg *discordgo.Message, cb Callback)

RequireAdmin only calls $cb if the author is an admin or has MANAGE_SERVER permission

func RequireRobyulMod

func RequireRobyulMod(msg *discordgo.Message, cb Callback)

RequireSupportMod only calls $cb if the author is a support mod

func ResetCachedDiscordInviteByVanityInvite

func ResetCachedDiscordInviteByVanityInvite(vanityInviteEntry models.VanityInviteEntry) (err error)

func RetrieveFile

func RetrieveFile(objectName string) (data []byte, err error)

retrieves a file objectName : the name of the file to retrieve

func RetrieveFileByHash

func RetrieveFileByHash(hash string) (filename, filetype string, data []byte, err error)

Retrieves a file by the object name md5 hash currently supported file sources: custom commands hash : the md5 hash

func RetrieveFileInformation

func RetrieveFileInformation(objectName string) (info models.StorageEntry, err error)

retrieves information about a file objectName : the name of the file to retrieve

func RetrieveFileWithoutLogging

func RetrieveFileWithoutLogging(objectName string) (data []byte, err error)

retrieves a file without logging objectName : the name of the file to retrieve

func RetrieveFilesByAdditionalObjectMetadata

func RetrieveFilesByAdditionalObjectMetadata(key, value string) (objectNames []string, err error)

Retrieves files by additional object metadta currently supported file sources: custom commands hash : the md5 hash

func Rev

func Rev(s string) string

func Revert

func Revert(eventlogID, userID string, item models.ElasticEventlog) (err error)

func RuneLength

func RuneLength(input string) (length int)

func ScaleImage

func ScaleImage(data []byte, targetWidth, targetHeight int) (result []byte, err error)

Scales an image to the target size. Source has to be a JPEG, PNG or GIF. Result will be a PNG. data : the image to scale targetWidth : the target width targetHeight : the target height

func SecondsToDuration

func SecondsToDuration(input int) string

SecondsToDuration turns an int (seconds) into HH:MM:SS

func SendComplex

func SendComplex(channelID string, data *discordgo.MessageSend) (messages []*discordgo.Message, err error)

func SendEmbed

func SendEmbed(channelID string, embed *discordgo.MessageEmbed) (messages []*discordgo.Message, err error)

func SendError

func SendError(msg *discordgo.Message, err interface{})

SendError Takes an error and sends it to discord and sentry.io

func SendFile

func SendFile(channelID string, filename string, reader io.Reader, message string) (messages []*discordgo.Message, err error)

func SendMessage

func SendMessage(channelID, content string) (messages []*discordgo.Message, err error)

func SendMessageBoxed

func SendMessageBoxed(channelID, content string) (messages []*discordgo.Message, err error)

func SendPagedImageMessage

func SendPagedImageMessage(msg *discordgo.Message, msgSend *discordgo.MessageSend, fieldsPerPage int) error

SendPagedImageMessage creates the paged image messages

func SendPagedMessage

func SendPagedMessage(msg *discordgo.Message, embed *discordgo.MessageEmbed, fieldsPerPage int) error

CreatePagedMessage creates the paged messages

func SetAllowedForChannel

func SetAllowedForChannel(guildID, channelID string, newPermissions models.ModulePermissionsModule) (err error)

func SetAllowedForRole

func SetAllowedForRole(guildID, roleID string, newPermissions models.ModulePermissionsModule) (err error)

func SetBotConfig

func SetBotConfig(key string, value interface{}) (err error)

func SetBotConfigString

func SetBotConfigString(key, value string) (err error)

func SetDeniedForChannel

func SetDeniedForChannel(guildID, channelID string, newPermissions models.ModulePermissionsModule) (err error)

func SetDeniedForRole

func SetDeniedForRole(guildID, roleID string, newPermissions models.ModulePermissionsModule) (err error)

func SetPagedMessage

func SetPagedMessage(messageID string, message *pagedEmbedMessage)

func SetPrefixForServer

func SetPrefixForServer(guild string, prefix string) error

SetPrefixForServer sets the prefix for $guild to $prefix

func SetUserConfig

func SetUserConfig(userID, key string, value interface{}) (err error)

func SetUserConfigInt

func SetUserConfigInt(userID, key string, value int) (err error)

func SetUserConfigString

func SetUserConfigString(userID, key, value string) (err error)

func SinceInDaysText

func SinceInDaysText(timeThen time.Time) string

func SniffMime

func SniffMime(data []byte) (mimetype string, err error)

func SoftRelax

func SoftRelax(err error, cb Callback)

SoftRelax is a softer form of Relax() Calls a callback instead of panicking

func StartTypingLoop

func StartTypingLoop(channelID string) (quitChannel chan int)

func StoreBoolAsString

func StoreBoolAsString(input bool) (output string)

func StringSliceDiff

func StringSliceDiff(rolesA, rolesB []string) (added, removed []string)

func TakeHTMLScreenshot

func TakeHTMLScreenshot(html string, width, height int) (data []byte, err error)

func ToArgv

func ToArgv(s string) ([]string, error)

ToArgv converts string s into an string array

text in quotes will be counted as 1 array element

func TruncateEmbed

func TruncateEmbed(embed *discordgo.MessageEmbed) (result *discordgo.MessageEmbed)

Applies Embed Limits to the given Embed Source: https://discordapp.com/developers/docs/resources/channel#embed-limits

func Typeof

func Typeof(v interface{}) string

Typeof resolves the type of $v as a string

func UniqueUsers

func UniqueUsers(listOfUsers []*discordgo.User) []*discordgo.User

UniqueUsers deduplicates a list of users by User ID

func UnmarshalElasticMessage

func UnmarshalElasticMessage(item *elastic.SearchHit) (result models.ElasticMessage)

func UnmuteUser

func UnmuteUser(guildID string, userID string) (err error)

func UnmuteUserMachinery

func UnmuteUserMachinery(guildID string, userID string) (err error)

func UnmuteUserSignature

func UnmuteUserSignature(guildID string, userID string) (signature *tasks.Signature)

func UpdateOrInsertVanityUrl

func UpdateOrInsertVanityUrl(vanityName, guildID, channelID, userID string) (err error)

func UpdateVanityUrl

func UpdateVanityUrl(vanityInviteEntry models.VanityInviteEntry) error

func UpdateWhitelistCache

func UpdateWhitelistCache() error

func UploadImage

func UploadImage(imageData []byte) (hostedUrl string, err error)

func UrlEncode

func UrlEncode(str string) (string, error)

UrlEncode encodes str with url#parse()

func UseruploadsDisableUser

func UseruploadsDisableUser(userID, authorID string) (err error)

func UseruploadsIsDisabled

func UseruploadsIsDisabled(userID string) (disabled bool)

func WebhookExecuteWithResult

func WebhookExecuteWithResult(id, token string, data *discordgo.WebhookParams) (message *discordgo.Message, err error)

Executes a webhook and waites for the response id : the ID of the webhook to use token : the token of the webhook to use data : webhook params to send

Types

type AddFileMetadata

type AddFileMetadata struct {
	Filename           string            // the actual file name, can be empty
	ChannelID          string            // the source channel ID, can be empty, but should be set if possible
	UserID             string            // the source user ID, can be empty, but should be set if possible
	GuildID            string            // the source guild ID, can be empty but should be set if possible, will be set automatically if ChannelID has been set
	AdditionalMetadata map[string]string // additional metadata attached to the object
}

type Callback

type Callback func()

Callback aliases a func

type GetElasticEventlogsResult

type GetElasticEventlogsResult struct {
	ElasticID string
	Entry     models.ElasticEventlog
}

func GetElasticPendingAuditLogBackfillEventlogs

func GetElasticPendingAuditLogBackfillEventlogs(createdAt time.Time, guildID, targetID, actionType string, all bool) (result []GetElasticEventlogsResult, err error)

type KeenMongoDbEvent

type KeenMongoDbEvent struct {
	Seconds    float64
	Collection string
	Type       string
	Method     string
	Query      string `json:",omitempty"`
	Skip       int64  `json:",omitempty"`
	Limit      int64  `json:",omitempty"`
	Id         string `json:",omitempty"`
	Data       string `json:",omitempty"`
}

type ModulePermissionsModuleInfo

type ModulePermissionsModuleInfo struct {
	Names      []string
	Permission models.ModulePermissionsModule
}

type ReplaceValues

type ReplaceValues struct {
	Before string
	After  string
}

ReplaceValues represents text to replace for ReplaceMessageSend

type SushiRequest

type SushiRequest struct {
	Html   string `json:"html"`
	Width  int    `json:"width"`
	Height int    `json:"height"`
}

type UnleashListener

type UnleashListener struct{}

UnleashListener is our listener for Unleash events

func (UnleashListener) OnCount

func (l UnleashListener) OnCount(name string, enabled bool)

OnCount prints to the console when the feature is queried.

func (UnleashListener) OnError

func (l UnleashListener) OnError(err error)

OnError logs errors

func (UnleashListener) OnReady

func (l UnleashListener) OnReady()

OnReady prints to the console when the repository is ready.

func (UnleashListener) OnRegistered

func (l UnleashListener) OnRegistered(payload unleash.ClientData)

OnRegistered prints to the console when the client has registered.

func (UnleashListener) OnSent

func (l UnleashListener) OnSent(payload unleash.MetricsData)

OnSent prints to the console when the server has uploaded metrics.

func (UnleashListener) OnWarning

func (l UnleashListener) OnWarning(warning error)

OnWarning logs warnings

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL