Documentation ¶
Index ¶
- Constants
- Variables
- func AddAutoleaverGuildID(s string) bool
- func AddFile(name string, data []byte, metadata AddFileMetadata, source string, public bool) (objectName string, err error)
- func AddMutePersistency(guildID, userID string) (err error)
- func AddMuteRole(guildID string, userID string) (err error)
- func AddNoPermissionsReaction(channelID, messageID string)
- func AllGuilds() []*discordgo.Guild
- func AutoPagify(text string) (pages []string)
- func BtoA(s string) string
- func CachedProxiesHealthcheck()
- func CachedProxiesHealthcheckLoop()
- func CalculateFullEmbedLength(embed *discordgo.MessageEmbed) (count int)
- func CanInspectBasic(msg *discordgo.Message) bool
- func CanInspectExtended(msg *discordgo.Message) bool
- func CanRevert(item models.ElasticEventlog) bool
- func ChannelOverwritesMatch(aOverwrites, bOverwrites []*discordgo.PermissionOverwrite) (match bool)
- func ChannelPermissionsInSync(childChannelID string) (inSync bool)
- func CleanDiscordContent(content string) (output string)
- func CleanEmbedValue(input string) (output string)
- func CollageFromBytes(imageDataArray [][]byte, descriptions []string, ...) (collageBytes []byte)
- func CollageFromUrls(imageUrls, descriptions []string, width, height, tileWidth, tileHeight int, ...) (collageBytes []byte)
- func CombineTwoImages(img1 image.Image, img2 image.Image) image.Image
- func CommandExists(name string) bool
- func ConfirmEmbed(guildID, channelID string, author *discordgo.User, confirmMessageText string, ...) bool
- func ConnectMDB(url string, database string)
- func CreatePendingUnmute(guildID string, userID string, unmuteAt time.Time) (err error)
- func DecodeImage(r io.ReadCloser) (image.Image, error)
- func DecodeImageBytes(imageBytes []byte) (image.Image, string, error)
- func DeleteFile(objectName string) (err error)
- func DeleteMessageWithDelay(msg *discordgo.Message, delay time.Duration) (err error)
- func DeletePagedMessage(messageID string)
- func DrawTable(headers []string, rows [][]string) string
- func EditComplex(data *discordgo.MessageEdit) (message *discordgo.Message, err error)
- func EditEmbed(channelID, messageID string, embed *discordgo.MessageEmbed) (message *discordgo.Message, err error)
- func EditMessage(channelID, messageID, content string) (message *discordgo.Message, err error)
- func ElasticAddEventlog(createdAt time.Time, ...) (id string, err error)
- func ElasticAddJoin(member *discordgo.Member, usedInvite, usedVanityName string) error
- func ElasticAddLeave(member *discordgo.Member) error
- func ElasticAddMessage(message *discordgo.Message) error
- func ElasticAddPresenceUpdate(presence *discordgo.Presence) error
- func ElasticAddVanityInviteClick(vanityInvite models.VanityInviteEntry, referer string) error
- func ElasticAddVoiceSession(guildID, channelID, userID string, joinTime, leaveTime time.Time) (err error)
- func ElasticDeleteMessage(message *discordgo.Message) error
- func ElasticGetEventlog(eventlogID string) (eventlogItem *models.ElasticEventlog, err error)
- func ElasticOnGuildMemberRemove(session *discordgo.Session, member *discordgo.GuildMemberRemove)
- func ElasticOnMessageCreate(session *discordgo.Session, message *discordgo.MessageCreate)
- func ElasticOnMessageDelete(session *discordgo.Session, message *discordgo.MessageDelete)
- func ElasticOnMessageUpdate(session *discordgo.Session, message *discordgo.MessageUpdate)
- func ElasticOnPresenceUpdate(session *discordgo.Session, presence *discordgo.PresenceUpdate)
- func ElasticUpdateEventLog(elasticID string, UserID string, options []models.ElasticEventlogOption, ...) (eventlogItem *models.ElasticEventlog, err error)
- func ElasticUpdateMessage(message *discordgo.Message) error
- func EmojIURL(emojiID string, animated bool) string
- func EscapeLinkForMarkdown(input string) (result string)
- func EventlogLog(createdAt time.Time, ...) (added bool, err error)
- func EventlogLogUpdate(elasticID string, UserID string, options []models.ElasticEventlogOption, ...) (err error)
- func ExtractInviteCodes(input string) (inviteCodes []string)
- func FeatureEnabled(feature string, fallback bool) bool
- func FillProxies()
- func FriendRequest(friend *discordgo.Session, method string, endpoint string) (result []byte, err error)
- func GeneratePublicFileLink(filename, filehash string) (link string)
- func GetAllPagedMessages() map[string]*pagedEmbedMessage
- func GetAllPermissions(guild *discordgo.Guild, member *discordgo.Member) int64
- func GetAllowedForChannel(guildID, channelID string) (permissions models.ModulePermissionsModule)
- func GetAllowedForRole(guildID, roleID string) (permissions models.ModulePermissionsModule)
- func GetAvatarUrl(user *discordgo.User) string
- func GetAvatarUrlWithSize(user *discordgo.User, size uint16) string
- func GetBotConfig(key string, value interface{}) (err error)
- func GetBotConfigString(key string) (value string, err error)
- func GetChannel(channelID string) (*discordgo.Channel, error)
- func GetChannelFromMention(msg *discordgo.Message, mention string) (*discordgo.Channel, error)
- func GetChannelOfAnyTypeFromMention(msg *discordgo.Message, mention string) (*discordgo.Channel, error)
- func GetChannelOrCategoryFromMention(msg *discordgo.Message, mention string) (*discordgo.Channel, error)
- func GetChannelWithoutApi(channelID string) (*discordgo.Channel, error)
- func GetConfig() *gabs.Container
- func GetDeniedForChannel(guildID, channelID string) (permissions models.ModulePermissionsModule)
- func GetDeniedForRole(guildID, roleID string) (permissions models.ModulePermissionsModule)
- func GetDisabledModules(guildID string) (disabledModules []models.ModulePermissionsModule)
- func GetDiscordColorFromHex(hex string) int
- func GetDiscordEmojiFromName(guildID string, name string) (emoji *discordgo.Emoji, err error)
- func GetDiscordEmojiFromText(guildID string, text string) (emoji *discordgo.Emoji, err error)
- func GetDiscordInviteByVanityInvite(vanityInviteEntry models.VanityInviteEntry) (code string, err error)
- func GetEmbedCode(targetMessage *discordgo.Message) (embedCode string)
- func GetFileLink(objectName string) (url string, err error)
- func GetGlobalChannelFromMention(mention string) (*discordgo.Channel, error)
- func GetGuild(guildID string) (*discordgo.Guild, error)
- func GetGuildDefaultChannel(guildID string) (channelID string, err error)
- func GetGuildMember(guildID string, userID string) (*discordgo.Member, error)
- func GetGuildMemberWithoutApi(guildID string, userID string) (*discordgo.Member, error)
- func GetGuildWithoutApi(guildID string) (*discordgo.Guild, error)
- func GetHexFromDiscordColor(colour int) (hex string)
- func GetImageHash(img image.Image) (*goimagehash.ImageHash, error)
- func GetImageHashString(img image.Image) (string, error)
- func GetIsInGuild(guildID string, userID string) bool
- func GetJSON(url string) *gabs.Container
- func GetLastFmClient() (client *lastfm.Api)
- func GetLastFmUsername(userID string) (username string)
- func GetLastPresenceUpdate(userID string, elasticsearch bool) (*models.ElasticPresenceUpdate, error)
- func GetMD5Hash(text string) string
- func GetMDb() *mgo.Database
- func GetMDbSession() *mgo.Session
- func GetMaxBadgesForGuild(guildID string) (maxBadges int)
- func GetMemberPermissions(guildID, userID string) (apermissions int)
- func GetMessage(channelID string, messageID string) (*discordgo.Message, error)
- func GetMinTimeForInterval(interval string, count int) (minTime time.Time)
- func GetModuleNameById(id models.ModulePermissionsModule) (name string)
- func GetModulePermissionEntries(guildID string) (entries []models.ModulePermissionEntry)
- func GetMuteRole(guildID string) (*discordgo.Role, error)
- func GetPagedMessage(messageID string) *pagedEmbedMessage
- func GetPermissionsText(permissions int) string
- func GetPrefixForServer(guildID string) string
- func GetRandomProxy() (proxy http.Transport, err error)
- func GetStaffUsernamesText() (text string)
- func GetStringAsBool(input string) bool
- func GetText(id string) string
- func GetTextF(id string, replacements ...interface{}) string
- func GetTimeFromSnowflake(id string) time.Time
- func GetUser(userID string) (*discordgo.User, error)
- func GetUserConfig(userID, key string, value interface{}) (err error)
- func GetUserConfigInt(userID, key string, placeholder int) (value int)
- func GetUserConfigString(userID, key, placeholder string) (value string)
- func GetUserFromMention(mention string) (*discordgo.User, error)
- func GetUserUserdata(userID string) (userdata models.ProfileUserdataEntry, err error)
- func GetUserWithoutAPI(userID string) (*discordgo.User, error)
- func GetVanityUrlByGuildID(guildID string) (entryBucket models.VanityInviteEntry, err error)
- func GetVanityUrlByVanityName(vanityName string) (entryBucket models.VanityInviteEntry, err error)
- func GetWebhook(guildID, channelID string) (webhook *discordgo.Webhook, err error)
- func GimmeProxy() (proxyUrl string, err error)
- func GuildFriendRequest(guildID string, method string, endpoint string) (result []byte, err error)
- func GuildIsOnWhitelist(guildID string) bool
- func GuildSettingsGet(guild string) (models.Config, error)
- func GuildSettingsGetCached(id string) models.Config
- func GuildSettingsSet(guild string, config models.Config) error
- func GuildSettingsUpdater()
- func HasPermissionByID(guildID string, userID string, permission int) bool
- func HumanToMdbId(text string) (id bson.ObjectId)
- func HumanizeDuration(d time.Duration) (result string)
- func HumanizeNumber(num int) string
- func HumanizedTimesSince(a time.Time) (year, month, day, hour, min, sec int)
- func HumanizedTimesSinceText(since time.Time) string
- func ImageByteComparison(imgByte1, imgByte2 []byte) (int, error)
- func ImageComparison(img1, img2 image.Image) (int, error)
- func ImageHashStringComparison(imgHashString1, imgHashString2 string) (int, error)
- func ImageToReader(sourceImage image.Image) *bytes.Reader
- func InviteFriend() (*discordgo.Session, error)
- func IsAdmin(msg *discordgo.Message) bool
- func IsAdminByID(guildID string, userID string) bool
- func IsBlacklisted(id string) bool
- func IsBlacklistedGuild(guildID string) bool
- func IsBotAdmin(id string) bool
- func IsDiscordEmoji(text string) (isEmoji bool)
- func IsEmbedCode(embedText string) (isCode bool)
- func IsEmoji(text string) (isEmoji bool)
- func IsLimitedGuild(guildID string) bool
- func IsMdbNotFound(err error) (notFound bool)
- func IsMod(msg *discordgo.Message) bool
- func IsModByID(guildID string, userID string) bool
- func IsNukeMod(id string) bool
- func IsRobyulMod(id string) bool
- func IsSnowflake(input string) (snowflake bool)
- func IsUnicodeEmoji(text string) (isEmoji bool)
- func LoadConfig(path string)
- func LoadTranslations()
- func LogMachineryError(errorMessage string) (err error)
- func MDbDelete(collection models.MongoDbCollection, id bson.ObjectId) (err error)
- func MDbDeleteWithoutLogging(collection models.MongoDbCollection, id bson.ObjectId) (err error)
- func MDbInsert(collection models.MongoDbCollection, data interface{}) (rid bson.ObjectId, err error)
- func MDbInsertWithoutLogging(collection models.MongoDbCollection, data interface{}) (rid bson.ObjectId, err error)
- func MDbIter(query *mgo.Query) (iter *mgo.Iter)
- func MDbIterWithoutLogging(query *mgo.Query) (iter *mgo.Iter)
- func MDbUpdate(collection models.MongoDbCollection, id bson.ObjectId, data interface{}) (err error)
- func MDbUpdateQuery(collection models.MongoDbCollection, selector interface{}, data interface{}) (err error)
- func MDbUpdateQueryWithoutLogging(collection models.MongoDbCollection, selector interface{}, data interface{}) (err error)
- func MDbUpdateWithoutLogging(collection models.MongoDbCollection, id bson.ObjectId, data interface{}) (err error)
- func MDbUpsert(collection models.MongoDbCollection, selector interface{}, data interface{}) (err error)
- func MDbUpsertID(collection models.MongoDbCollection, id bson.ObjectId, data interface{}) (err error)
- func MDbUpsertIDWithoutLogging(collection models.MongoDbCollection, id bson.ObjectId, data interface{}) (err error)
- func MDbUpsertWithoutLogging(collection models.MongoDbCollection, selector interface{}, data interface{}) (err error)
- func MapToSliceOfSlices(m map[string]string) [][]string
- func MdbCollection(collection models.MongoDbCollection) (query *mgo.Collection)
- func MdbCount(collection models.MongoDbCollection, query interface{}) (count int, err error)
- func MdbCountWithoutLogging(collection models.MongoDbCollection, query interface{}) (count int, err error)
- func MdbDeleteQuery(collection models.MongoDbCollection, selector interface{}) (err error)
- func MdbDeleteQueryWithoutLogging(collection models.MongoDbCollection, selector interface{}) (err error)
- func MdbIdToHuman(id bson.ObjectId) (text string)
- func MdbOne(query *mgo.Query, object interface{}) (err error)
- func MdbOneWithoutLogging(query *mgo.Query, object interface{}) (err error)
- func MdbPipeOne(collection models.MongoDbCollection, pipeline interface{}, object interface{}) (err error)
- func MdbPipeOneWithoutLogging(collection models.MongoDbCollection, pipeline interface{}, object interface{}) (err error)
- func MessageDeeplink(channelID, messageID string) string
- func ModuleIsAllowed(channelID, msgID, userID string, module models.ModulePermissionsModule) (isAllowed bool)
- func ModuleIsAllowedSilent(channelID, msgID, userID string, module models.ModulePermissionsModule) (isAllowed bool)
- func MuteUser(guildID string, userID string, unmuteAt time.Time) (err error)
- func NetGet(url string) []byte
- func NetGetUA(url string, useragent string) []byte
- func NetGetUAWithError(url string, useragent string) ([]byte, error)
- func NetGetUAWithErrorAndTimeout(url string, useragent string, timeout time.Duration) ([]byte, error)
- func NetGetUAWithErrorAndTransport(url string, useragent string, transport http.Transport) ([]byte, error)
- func NetPost(url string, data string) []byte
- func NetPostUA(url string, data string, useragent string) []byte
- func NetPostUAWithError(url string, data string, useragent string) (result []byte, err error)
- func ObjectExists(objectName string) bool
- func OnEventlogChannelUpdate(guildID string, oldChannel, newChannel *discordgo.Channel)
- func OnEventlogEmojiCreate(guildID string, emoji *discordgo.Emoji)
- func OnEventlogEmojiDelete(guildID string, emoji *discordgo.Emoji)
- func OnEventlogEmojiUpdate(guildID string, oldEmoji, newEmoji *discordgo.Emoji)
- func OnEventlogGuildUpdate(guildID string, oldGuild, newGuild *discordgo.Guild)
- func OnEventlogMemberUpdate(guildID string, oldMember, newMember *discordgo.Member)
- func OnEventlogRoleUpdate(guildID string, oldRole, newRole *discordgo.Role)
- func Pagify(text string, delimiter string) []string
- func ParseCustomEmoji(text string) (emojiID, emojiName string, animated bool)
- func ParseEmbedCode(embedText string) (ptext string, embed *discordgo.MessageEmbed, err error)
- func ParseKeyValueString(text string) (data map[string]string)
- func PictureIsSafe(reader io.Reader) (safe bool)
- func Recover()
- func RecoverDiscord(msg *discordgo.Message)
- func RefreshModulePermissionsCache() (err error)
- func Relax(err error)
- func RelaxAssertEqual(a interface{}, b interface{}, err error)
- func RelaxAssertUnequal(a interface{}, b interface{}, err error)
- func RelaxEmbed(err error, channelID string, commandMessageID string)
- func RelaxLog(err error)
- func RelaxMessage(err error, channelID string, commandMessageID string)
- func RemoveAutoleaverGuildID(s string) bool
- func RemoveMuteDatabase(guildID string, userID string) (err error)
- func RemoveMutePersistency(guildID string, userID string) (err error)
- func RemoveMuteRole(guildID string, userID string) (err error)
- func RemovePendingUnmutes(guildID string, userID string) (err error)
- func RemoveReactionsFromPagedEmbeds()
- func RemoveVanityUrl(vanityInviteEntry models.VanityInviteEntry) error
- func ReplaceEmojis(content string) (result string)
- func ReplaceMessageSend(message *discordgo.MessageSend, replace []*ReplaceValues) *discordgo.MessageSend
- func RequestAuditLogBackfill(guildID string, backfillType models.AuditLogBackfillType, userID string) (err error)
- func RequireAdmin(msg *discordgo.Message, cb Callback)
- func RequireAdminOrStaff(msg *discordgo.Message, cb Callback)
- func RequireBotAdmin(msg *discordgo.Message, cb Callback)
- func RequireMod(msg *discordgo.Message, cb Callback)
- func RequireRobyulMod(msg *discordgo.Message, cb Callback)
- func ResetCachedDiscordInviteByVanityInvite(vanityInviteEntry models.VanityInviteEntry) (err error)
- func RetrieveFile(objectName string) (data []byte, err error)
- func RetrieveFileByHash(hash string) (filename, filetype string, data []byte, err error)
- func RetrieveFileInformation(objectName string) (info models.StorageEntry, err error)
- func RetrieveFileWithoutLogging(objectName string) (data []byte, err error)
- func RetrieveFilesByAdditionalObjectMetadata(key, value string) (objectNames []string, err error)
- func Rev(s string) string
- func Revert(eventlogID, userID string, item models.ElasticEventlog) (err error)
- func RuneLength(input string) (length int)
- func ScaleImage(data []byte, targetWidth, targetHeight int) (result []byte, err error)
- func SecondsToDuration(input int) string
- func SendComplex(channelID string, data *discordgo.MessageSend) (messages []*discordgo.Message, err error)
- func SendEmbed(channelID string, embed *discordgo.MessageEmbed) (messages []*discordgo.Message, err error)
- func SendError(msg *discordgo.Message, err interface{})
- func SendFile(channelID string, filename string, reader io.Reader, message string) (messages []*discordgo.Message, err error)
- func SendMessage(channelID, content string) (messages []*discordgo.Message, err error)
- func SendMessageBoxed(channelID, content string) (messages []*discordgo.Message, err error)
- func SendPagedImageMessage(msg *discordgo.Message, msgSend *discordgo.MessageSend, fieldsPerPage int) error
- func SendPagedMessage(msg *discordgo.Message, embed *discordgo.MessageEmbed, fieldsPerPage int) error
- func SetAllowedForChannel(guildID, channelID string, newPermissions models.ModulePermissionsModule) (err error)
- func SetAllowedForRole(guildID, roleID string, newPermissions models.ModulePermissionsModule) (err error)
- func SetBotConfig(key string, value interface{}) (err error)
- func SetBotConfigString(key, value string) (err error)
- func SetDeniedForChannel(guildID, channelID string, newPermissions models.ModulePermissionsModule) (err error)
- func SetDeniedForRole(guildID, roleID string, newPermissions models.ModulePermissionsModule) (err error)
- func SetPagedMessage(messageID string, message *pagedEmbedMessage)
- func SetPrefixForServer(guild string, prefix string) error
- func SetUserConfig(userID, key string, value interface{}) (err error)
- func SetUserConfigInt(userID, key string, value int) (err error)
- func SetUserConfigString(userID, key, value string) (err error)
- func SinceInDaysText(timeThen time.Time) string
- func SniffMime(data []byte) (mimetype string, err error)
- func SoftRelax(err error, cb Callback)
- func StartTypingLoop(channelID string) (quitChannel chan int)
- func StoreBoolAsString(input bool) (output string)
- func StringSliceDiff(rolesA, rolesB []string) (added, removed []string)
- func TakeHTMLScreenshot(html string, width, height int) (data []byte, err error)
- func ToArgv(s string) ([]string, error)
- func TruncateEmbed(embed *discordgo.MessageEmbed) (result *discordgo.MessageEmbed)
- func Typeof(v interface{}) string
- func UniqueUsers(listOfUsers []*discordgo.User) []*discordgo.User
- func UnmarshalElasticMessage(item *elastic.SearchHit) (result models.ElasticMessage)
- func UnmuteUser(guildID string, userID string) (err error)
- func UnmuteUserMachinery(guildID string, userID string) (err error)
- func UnmuteUserSignature(guildID string, userID string) (signature *tasks.Signature)
- func UpdateOrInsertVanityUrl(vanityName, guildID, channelID, userID string) (err error)
- func UpdateVanityUrl(vanityInviteEntry models.VanityInviteEntry) error
- func UpdateWhitelistCache() error
- func UploadImage(imageData []byte) (hostedUrl string, err error)
- func UrlEncode(str string) (string, error)
- func UseruploadsDisableUser(userID, authorID string) (err error)
- func UseruploadsIsDisabled(userID string) (disabled bool)
- func WebhookExecuteWithResult(id, token string, data *discordgo.WebhookParams) (message *discordgo.Message, err error)
- type AddFileMetadata
- type Callback
- type GetElasticEventlogsResult
- type KeenMongoDbEvent
- type ModulePermissionsModuleInfo
- type ReplaceValues
- type SushiRequest
- type UnleashListener
- func (l UnleashListener) OnCount(name string, enabled bool)
- func (l UnleashListener) OnError(err error)
- func (l UnleashListener) OnReady()
- func (l UnleashListener) OnRegistered(payload unleash.ClientData)
- func (l UnleashListener) OnSent(payload unleash.MetricsData)
- func (l UnleashListener) OnWarning(warning error)
Constants ¶
const ( DISCORD_EPOCH int64 = 1420070400000 DISCORD_DARK_THEME_BACKGROUND_HEX = "#36393F" )
const ( PROXIES_KEY = "robyul-discord:gimmeproxy:proxies" NUMBER_OF_PROXIES = 240 )
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 )
const ( LEFT_ARROW_EMOJI = "⬅" RIGHT_ARROW_EMOJI = "➡" X_EMOJI = "🇽" NAV_NUMBERS = "🔢" FIELD_MESSAGE_TYPE = iota IMAGE_MESSAGE_TYPE )
const ( SettingLevelMod models.SettingLevel = "mod" SettingLevelAdmin models.SettingLevel = "admin" )
const ElasticIndexTimeout = "5s"
const (
ServerLimitPerFriend = 95
)
const (
ZERO_WIDTH_SPACE = "\u200B"
)
Variables ¶
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])`) )
var (
AuditLogBackfillRequestsLock = sync.Mutex{}
)
var BasicInspectRoleIDs = []string{
"345209098100277248",
}
var Blacklisted = []string{
"171883318386753536",
"502156053597782027",
"466007709322444800",
"430514716243263498",
}
var BlacklistedGuildIDs = []string{
"586923572392493061",
}
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 )
var DEFAULT_UA = "Robyul2/" + version.BOT_VERSION + " (https://robyul.chat)"
var ExtendedInspectRoleIDs = []string{
"345209385821274113",
"345209098100277248",
}
var LimitedGuildIDs = []string{
"264445053596991498",
}
No Level gaining, No Elastic Search features
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}, } )
var NukeMods = []string{
"116620585638821891",
"134298438559858688",
"68661361537712128",
}
var (
PROXY_CHECK_URLS = []string{"https://robyul.chat"}
)
var RobyulMod = []string{
"273639623324991489",
}
var ( // UnleashInitialised will be set to true when it has been initialised UnleashInitialised = false )
Functions ¶
func AddAutoleaverGuildID ¶
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 AddMuteRole ¶
func AddNoPermissionsReaction ¶
func AddNoPermissionsReaction(channelID, messageID string)
func AutoPagify ¶
func CachedProxiesHealthcheck ¶
func CachedProxiesHealthcheck()
func CachedProxiesHealthcheckLoop ¶
func CachedProxiesHealthcheckLoop()
func CalculateFullEmbedLength ¶
func CalculateFullEmbedLength(embed *discordgo.MessageEmbed) (count int)
func CanInspectBasic ¶
func CanInspectExtended ¶
func CanRevert ¶
func CanRevert(item models.ElasticEventlog) bool
func ChannelOverwritesMatch ¶
func ChannelOverwritesMatch(aOverwrites, bOverwrites []*discordgo.PermissionOverwrite) (match bool)
func CleanDiscordContent ¶
func CleanEmbedValue ¶
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 ¶
CombineTwoImages combines two images with img1 being on the left and img2 on the right. returns the resulting image
func CommandExists ¶
func ConfirmEmbed ¶
func ConnectMDB ¶
ConnectDB connects to mongodb and stores the session
func CreatePendingUnmute ¶
func DecodeImage ¶
func DecodeImage(r io.ReadCloser) (image.Image, error)
decodeImage decodes the image with retry.
func DecodeImageBytes ¶
DecodeImageBytes
func DeleteFile ¶
Deletes a file objectName : the name of the object
func DeleteMessageWithDelay ¶
DeleteMessageWithDelay will delete the given message after a given time duration
func DeletePagedMessage ¶
func DeletePagedMessage(messageID string)
func EditComplex ¶
func EditComplex(data *discordgo.MessageEdit) (message *discordgo.Message, err error)
func EditMessage ¶
func ElasticAddEventlog ¶
func ElasticAddJoin ¶
func ElasticAddLeave ¶
func ElasticAddMessage ¶
func ElasticAddVanityInviteClick ¶
func ElasticAddVanityInviteClick(vanityInvite models.VanityInviteEntry, referer string) error
func ElasticAddVoiceSession ¶
func ElasticDeleteMessage ¶
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 EscapeLinkForMarkdown ¶
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 ¶
Extracts ALL invites codes from the given message (message can contain multiple invites) (e.g. discord.gg/foo => [foo])
func FeatureEnabled ¶
func FillProxies ¶
func FillProxies()
func FriendRequest ¶
func GeneratePublicFileLink ¶
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 GetAllowedForChannel ¶
func GetAllowedForChannel(guildID, channelID string) (permissions models.ModulePermissionsModule)
func GetAllowedForRole ¶
func GetAllowedForRole(guildID, roleID string) (permissions models.ModulePermissionsModule)
func GetAvatarUrl ¶
func GetBotConfigString ¶
func GetChannelFromMention ¶
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 GetDiscordEmojiFromName ¶
func GetDiscordEmojiFromText ¶
func GetDiscordInviteByVanityInvite ¶
func GetDiscordInviteByVanityInvite(vanityInviteEntry models.VanityInviteEntry) (code string, err error)
func GetEmbedCode ¶
func GetFileLink ¶
Retrieves a file's public url, returns an error if file is not public objectName : the name of the object
func GetGuildDefaultChannel ¶
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 GetHexFromDiscordColor ¶
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 ¶
GetImageHash returns the average image hash
note: use helpers.GetImageHash(img).ToString() to get the string value
func GetIsInGuild ¶
func GetLastFmClient ¶
Gets the LastFM client from cache. If there is no LastFM client in cache yet it will create a new instance
func GetLastFmUsername ¶
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 GetMDbSession ¶
GetDB is a simple getter for the mongodb session.
func GetMaxBadgesForGuild ¶
func GetMemberPermissions ¶
func GetMinTimeForInterval ¶
func GetModuleNameById ¶
func GetModuleNameById(id models.ModulePermissionsModule) (name string)
func GetModulePermissionEntries ¶
func GetModulePermissionEntries(guildID string) (entries []models.ModulePermissionEntry)
func GetPagedMessage ¶
func GetPagedMessage(messageID string) *pagedEmbedMessage
GetPagedMessage will return the paged message if there is one, otherwill will return nil
func GetPermissionsText ¶
func GetPrefixForServer ¶
GetPrefixForServer gets the prefix for $guild
func GetRandomProxy ¶
func GetStaffUsernamesText ¶
func GetStaffUsernamesText() (text string)
func GetStringAsBool ¶
func GetTimeFromSnowflake ¶
func GetUserConfig ¶
TODO: cache
func GetUserConfigInt ¶
func GetUserConfigString ¶
func GetUserUserdata ¶
func GetUserUserdata(userID string) (userdata models.ProfileUserdataEntry, err 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 ¶
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 GuildFriendRequest ¶
func GuildIsOnWhitelist ¶
func GuildSettingsGet ¶
GuildSettingsGet returns all config values for the guild or a default object
func GuildSettingsGetCached ¶
func GuildSettingsSet ¶
GuildSettingsSet writes all $config into the db
func GuildSettingsUpdater ¶
func GuildSettingsUpdater()
func HumanToMdbId ¶
Returns an ObjectID from a human readable ID text : the human readable ID
func HumanizeDuration ¶
func HumanizeNumber ¶
HumanizeNumber takes an int and turns it into a word
func HumanizedTimesSince ¶
func HumanizedTimesSinceText ¶
func ImageByteComparison ¶
ImageHashComparison does an image comparison using the average hash
0 is perfect match
func ImageComparison ¶
ImageHashComparison does an image comparison using the average hash
0 is perfect match
func ImageHashStringComparison ¶
ImageHashComparison does a comparison of the given hashes and returns value indicating their difference
0 is perfect match
func ImageToReader ¶
ImageToReader will take the given image and return a reader of the bytes
func InviteFriend ¶
func IsAdminByID ¶
func IsBlacklisted ¶
func IsBlacklistedGuild ¶
func IsDiscordEmoji ¶
returns true if text is a discord custom emoji, returns false for everything else
func IsEmbedCode ¶
func IsEmoji ¶
returns true if text is an unicode emoji or a discord custom emoji, returns false for everything else
func IsLimitedGuild ¶
func IsMdbNotFound ¶
Returns true if the given error is a not found error from MongoDB includes errors from invalid object IDs
func IsRobyulMod ¶
func IsSnowflake ¶
func IsUnicodeEmoji ¶
returns true if text is an unicode emoji, returns false for everything else
func LoadTranslations ¶
func LoadTranslations()
func LogMachineryError ¶
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 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 ¶
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 ¶
Returns a human readable ID version of a ObjectID id : the ObjectID to convert
func MdbOneWithoutLogging ¶
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 ¶
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 NetPostUAWithError ¶
func ObjectExists ¶
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 OnEventlogEmojiCreate ¶
func OnEventlogEmojiDelete ¶
func OnEventlogEmojiUpdate ¶
func OnEventlogGuildUpdate ¶
func OnEventlogMemberUpdate ¶
func OnEventlogRoleUpdate ¶
func ParseCustomEmoji ¶
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 PictureIsSafe ¶
func RecoverDiscord ¶
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 ¶
RelaxEmbed does nothing if $err is nil, prints a notice if there are no permissions to embed, else sends it to Relax()
func RelaxMessage ¶
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 RemoveMuteDatabase ¶
func RemoveMutePersistency ¶
func RemoveMuteRole ¶
func RemovePendingUnmutes ¶
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 ¶
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 ¶
RequireAdmin only calls $cb if the author is an admin or has MANAGE_SERVER permission
func RequireAdminOrStaff ¶
RequireAdmin only calls $cb if the author is an admin or has MANAGE_SERVER permission
func RequireBotAdmin ¶
RequireBotAdmin only calls $cb if the author is a bot admin
func RequireMod ¶
RequireAdmin only calls $cb if the author is an admin or has MANAGE_SERVER permission
func RequireRobyulMod ¶
RequireSupportMod only calls $cb if the author is a support mod
func ResetCachedDiscordInviteByVanityInvite ¶
func ResetCachedDiscordInviteByVanityInvite(vanityInviteEntry models.VanityInviteEntry) (err error)
func RetrieveFile ¶
retrieves a file objectName : the name of the file to retrieve
func RetrieveFileByHash ¶
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 ¶
retrieves a file without logging objectName : the name of the file to retrieve
func RetrieveFilesByAdditionalObjectMetadata ¶
Retrieves files by additional object metadta currently supported file sources: custom commands hash : the md5 hash
func RuneLength ¶
func ScaleImage ¶
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 ¶
SecondsToDuration turns an int (seconds) into HH:MM:SS
func SendComplex ¶
func SendMessage ¶
func SendMessageBoxed ¶
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 SetBotConfigString ¶
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 ¶
SetPrefixForServer sets the prefix for $guild to $prefix
func SetUserConfig ¶
func SetUserConfigInt ¶
func SetUserConfigString ¶
func SinceInDaysText ¶
func StartTypingLoop ¶
func StoreBoolAsString ¶
func StringSliceDiff ¶
func TakeHTMLScreenshot ¶
func ToArgv ¶
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 UniqueUsers ¶
UniqueUsers deduplicates a list of users by User ID
func UnmarshalElasticMessage ¶
func UnmarshalElasticMessage(item *elastic.SearchHit) (result models.ElasticMessage)
func UnmuteUser ¶
func UnmuteUserMachinery ¶
func UnmuteUserSignature ¶
func UpdateOrInsertVanityUrl ¶
func UpdateVanityUrl ¶
func UpdateVanityUrl(vanityInviteEntry models.VanityInviteEntry) error
func UpdateWhitelistCache ¶
func UpdateWhitelistCache() error
func UploadImage ¶
func UseruploadsDisableUser ¶
func UseruploadsIsDisabled ¶
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 GetElasticEventlogsResult ¶
type GetElasticEventlogsResult struct { ElasticID string Entry models.ElasticEventlog }
type KeenMongoDbEvent ¶
type ModulePermissionsModuleInfo ¶
type ModulePermissionsModuleInfo struct { Names []string Permission models.ModulePermissionsModule }
type ReplaceValues ¶
ReplaceValues represents text to replace for ReplaceMessageSend
type SushiRequest ¶
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) 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
Source Files ¶
- ascii.go
- autoleaverGuilds.go
- bot_config.go
- cloudvision.go
- collage.go
- config.go
- db.go
- defines.go
- discord.go
- elastic.go
- embed.go
- embedcode.go
- emoji.go
- eventlog.go
- eventlog_ignore.go
- eventlog_permissions.go
- eventlog_revert.go
- except.go
- file.go
- friend.go
- gettext.go
- gimmeproxy.go
- globs.go
- hosting.go
- images.go
- lastfm.go
- levels.go
- md5.go
- mdb.go
- modulepermissions.go
- net.go
- numbers.go
- pagedEmbedMessages.go
- parser.go
- regex.go
- resize.go
- screenshot.go
- slice.go
- storage.go
- text.go
- time.go
- types.go
- unleash.go
- url.go
- user_config.go
- useruploads.go
- vanityinvite.go
- webhooks.go
- websettings.go
- whitelist.go