Documentation ¶
Index ¶
- Constants
- Variables
- func DeadlockGameStateResponse(command string, sett *settings.GuildSettings) *discordgo.InteractionResponse
- func DebugResponse(operationType string, cached map[string]interface{}, stateBytes []byte, ...) *discordgo.InteractionResponse
- func DmResponse(sett *settings.GuildSettings) *discordgo.InteractionResponse
- func DownloadCooldownResponse(sett *settings.GuildSettings, category string, duration time.Duration) *discordgo.InteractionResponse
- func DownloadNotGoldResponse(sett *settings.GuildSettings) *discordgo.InteractionResponse
- func GetDebugParams(s *discordgo.Session, userID string, ...) (action string, opType string, _ string)
- func GetDownloadParams(options []*discordgo.ApplicationCommandInteractionDataOption) string
- func GetLinkParams(s *discordgo.Session, ...) (string, string)
- func GetMapParams(options []*discordgo.ApplicationCommandInteractionDataOption) (_ game.PlayMap, detailed bool)
- func GetPremiumParams(options []*discordgo.ApplicationCommandInteractionDataOption) string
- func GetPrivacyParam(options []*discordgo.ApplicationCommandInteractionDataOption) string
- func GetSettingsParams(options []*discordgo.ApplicationCommandInteractionDataOption) (string, []string)
- func GetStatsParams(s *discordgo.Session, guildID string, ...) (action string, opType string, id string)
- func GetUnlinkParams(s *discordgo.Session, ...) string
- func HelpEmbedResponse(commands []*discordgo.ApplicationCommand, sett *settings.GuildSettings) discordgo.MessageEmbed
- func HelpResponse(sett *settings.GuildSettings, ...) *discordgo.InteractionResponse
- func InfoResponse(info BotInfo, guildID string, sett *settings.GuildSettings) *discordgo.InteractionResponse
- func InsufficientPermissionsResponse(sett *settings.GuildSettings) *discordgo.InteractionResponse
- func LinkResponse(status LinkStatus, userID, color string, sett *settings.GuildSettings) *discordgo.InteractionResponse
- func MapResponse(mapType game.PlayMap, detailed bool) *discordgo.InteractionResponse
- func NewResponse(status NewStatus, info NewInfo, sett *settings.GuildSettings) *discordgo.InteractionResponse
- func NoGameResponse(sett *settings.GuildSettings) *discordgo.InteractionResponse
- func PremiumResponse(guildID string, tier premium.Tier, daysRem int, arg string, isAdmin bool, ...) *discordgo.InteractionResponse
- func PrivacyResponse(status string, cached map[string]interface{}, user *storage.PostgresUser, ...) *discordgo.InteractionResponse
- func PrivateErrorResponse(cmd string, err error, sett *settings.GuildSettings) *discordgo.InteractionResponse
- func PrivateResponse(content string) *discordgo.InteractionResponse
- func ReinviteMeResponse(missingPerms int64, channelID string, sett *settings.GuildSettings) *discordgo.InteractionResponse
- func SettingsResponse(m interface{}) *discordgo.InteractionResponse
- func UnlinkResponse(status UnlinkStatus, userID string, sett *settings.GuildSettings) *discordgo.InteractionResponse
- type BotInfo
- type LinkStatus
- type NewInfo
- type NewStatus
- type UnlinkStatus
Constants ¶
View Source
const ( ISO8601 = "2006-01-02T15:04:05-0700" BasePremiumURL = "https://automute.us/premium?guild=" CaptureDownloadURL = "https://capture.automute.us" DefaultMaxActiveGames = 150 )
View Source
const ( User = "user" GameState = "game-state" UnmuteAll = "unmute-all" Unmute = "unmute" )
View Source
const ( Category = "category" Users = "users" UsersGames = "users_games" Games = "games" GameEvents = "game_events" )
View Source
const ( PremiumInfo string = "info" PremiumInvites = "invites" )
View Source
const ( PrivacyInfo = "info" PrivacyShowMe = "show-me" PrivacyOptIn = "opt-in" PrivacyOptOut = "opt-out" )
View Source
const ( Match = "match" Guild = "guild" )
Variables ¶
View Source
var All = []*discordgo.ApplicationCommand{ &Help, &New, &Refresh, &Pause, &End, &Link, &Unlink, &Settings, &Privacy, &Info, &Map, &Stats, &Premium, &Debug, &Download, }
All is all slash commands for the bot, ordered to match the README
View Source
var Debug = discordgo.ApplicationCommand{ Name: "debug", Description: "View and clear debug information for AutoMuteUs", Options: []*discordgo.ApplicationCommandOption{ { Name: setting.View, Description: "View debug info", Type: discordgo.ApplicationCommandOptionSubCommandGroup, Options: []*discordgo.ApplicationCommandOption{ { Name: User, Description: "User Cache", Type: discordgo.ApplicationCommandOptionSubCommand, Options: []*discordgo.ApplicationCommandOption{ { Name: User, Description: "User whose cache you want to view", Type: discordgo.ApplicationCommandOptionUser, Required: true, }, }, }, { Name: GameState, Description: "Game State", Type: discordgo.ApplicationCommandOptionSubCommand, }, }, }, { Name: setting.Clear, Description: "Clear debug info", Type: discordgo.ApplicationCommandOptionSubCommand, Options: []*discordgo.ApplicationCommandOption{ { Name: User, Description: "User whose cache should be cleared", Type: discordgo.ApplicationCommandOptionUser, Required: true, }, }, }, { Name: UnmuteAll, Description: "Unmute all players", Type: discordgo.ApplicationCommandOptionSubCommand, }, { Name: Unmute, Description: "Unmute myself, or a specific user", Type: discordgo.ApplicationCommandOptionSubCommand, Options: []*discordgo.ApplicationCommandOption{ { Name: User, Description: "User who should be unmuted/undeafened", Type: discordgo.ApplicationCommandOptionUser, Required: false, }, }, }, }, }
View Source
var Download = discordgo.ApplicationCommand{ Name: "download", Description: "Download AutoMuteUs data", Options: []*discordgo.ApplicationCommandOption{ { Name: Category, Description: "Data to download", Type: discordgo.ApplicationCommandOptionString, Choices: []*discordgo.ApplicationCommandOptionChoice{ { Name: Guild, Value: Guild, }, { Name: Users, Value: Users, }, { Name: UsersGames, Value: UsersGames, }, { Name: Games, Value: Games, }, { Name: GameEvents, Value: GameEvents, }, }, Required: true, }, }, }
View Source
var End = discordgo.ApplicationCommand{
Name: "end",
Description: "End a game",
}
View Source
var Help = discordgo.ApplicationCommand{ Name: "help", Description: "AutoMuteUs help", Options: []*discordgo.ApplicationCommandOption{ { Type: discordgo.ApplicationCommandOptionString, Name: "command", Description: "Command to view details for", Choices: []*discordgo.ApplicationCommandOptionChoice{ { Name: New.Name, Value: New.Name, }, { Name: Refresh.Name, Value: Refresh.Name, }, { Name: Pause.Name, Value: Pause.Name, }, { Name: End.Name, Value: End.Name, }, { Name: Link.Name, Value: Link.Name, }, { Name: Unlink.Name, Value: Unlink.Name, }, { Name: Settings.Name, Value: Settings.Name, }, { Name: Privacy.Name, Value: Privacy.Name, }, { Name: Info.Name, Value: Info.Name, }, { Name: Map.Name, Value: Map.Name, }, { Name: Stats.Name, Value: Stats.Name, }, { Name: Premium.Name, Value: Premium.Name, }, { Name: Debug.Name, Value: Debug.Name, }, { Name: Download.Name, Value: Download.Name, }, }, Required: false, }, }, }
View Source
var Info = discordgo.ApplicationCommand{
Name: "info",
Description: "AutoMuteUs info",
}
View Source
var Link = discordgo.ApplicationCommand{ Name: "link", Description: "Link a Discord User to their in-game color", Options: []*discordgo.ApplicationCommandOption{ { Type: discordgo.ApplicationCommandOptionUser, Name: "user", Description: "User to link", Required: true, }, { Type: discordgo.ApplicationCommandOptionString, Name: "color", Description: "In-game color", Required: true, Choices: colorsToCommandChoices(), }, }, }
View Source
var Map = discordgo.ApplicationCommand{ Name: "map", Description: "View Among Us game maps", Options: []*discordgo.ApplicationCommandOption{ { Type: discordgo.ApplicationCommandOptionInteger, Name: "map_name", Description: "Map to display", Choices: mapsToCommandChoices(), Required: true, }, { Type: discordgo.ApplicationCommandOptionBoolean, Name: "detailed", Description: "View detailed map", Required: false, }, }, }
View Source
var New = discordgo.ApplicationCommand{
Name: "new",
Description: "Start a new game",
}
View Source
var Pause = discordgo.ApplicationCommand{
Name: "pause",
Description: "Pause the current game",
}
View Source
var PermissionStrings = map[int64]string{ discordgo.PermissionViewChannel: "View Channel", discordgo.PermissionSendMessages: "Send Messages", discordgo.PermissionManageMessages: "Manage Messages", discordgo.PermissionEmbedLinks: "Embed Links", discordgo.PermissionUseExternalEmojis: "Use External Emojis", discordgo.PermissionVoiceMuteMembers: "Mute Members", discordgo.PermissionVoiceDeafenMembers: "Deafen Members", }
View Source
var Premium = discordgo.ApplicationCommand{ Name: "premium", Description: "View information about AutoMuteUs Premium", Options: []*discordgo.ApplicationCommandOption{ { Name: PremiumInfo, Description: "View AutoMuteUs Premium information", Type: discordgo.ApplicationCommandOptionSubCommand, }, { Name: PremiumInvites, Description: "Invite AutoMuteUs workers", Type: discordgo.ApplicationCommandOptionSubCommand, }, }, }
TODO transfer functionality TODO "add another gold server" functionality TODO cancel functionality? This is harder/needs Paypal hooks
View Source
var Privacy = discordgo.ApplicationCommand{ Name: "privacy", Description: "View AMU privacy info", Options: []*discordgo.ApplicationCommandOption{ { Name: "command", Description: "Privacy command", Type: discordgo.ApplicationCommandOptionString, Choices: []*discordgo.ApplicationCommandOptionChoice{ { Name: PrivacyInfo, Value: PrivacyInfo, }, { Name: PrivacyShowMe, Value: PrivacyShowMe, }, { Name: PrivacyOptIn, Value: PrivacyOptIn, }, { Name: PrivacyOptOut, Value: PrivacyOptOut, }, }, Required: false, }, }, }
View Source
var Refresh = discordgo.ApplicationCommand{
Name: "refresh",
Description: "Refresh the game message",
}
View Source
var Settings = discordgo.ApplicationCommand{
Name: "settings",
Description: "View or change AutoMuteUs settings",
Options: settingsToCommandOptions(),
}
View Source
var Stats = discordgo.ApplicationCommand{ Name: "stats", Description: "View or clear stats from games played with AutoMuteUs", Options: []*discordgo.ApplicationCommandOption{ { Name: setting.View, Description: "View stats", Type: discordgo.ApplicationCommandOptionSubCommandGroup, Options: []*discordgo.ApplicationCommandOption{ { Name: User, Description: "User stats", Type: discordgo.ApplicationCommandOptionSubCommand, Options: []*discordgo.ApplicationCommandOption{ { Name: User, Description: "User whose stats you want to view", Type: discordgo.ApplicationCommandOptionUser, Required: true, }, }, }, { Name: Match, Description: "Match stats", Type: discordgo.ApplicationCommandOptionSubCommand, Options: []*discordgo.ApplicationCommandOption{ { Name: Match, Description: "Match ID whose stats you want to view", Type: discordgo.ApplicationCommandOptionString, Required: true, }, }, }, { Name: Guild, Description: "View this guild's stats", Type: discordgo.ApplicationCommandOptionSubCommand, }, }, }, { Name: setting.Clear, Description: "Clear stats", Type: discordgo.ApplicationCommandOptionSubCommandGroup, Options: []*discordgo.ApplicationCommandOption{ { Name: User, Description: "User stats", Type: discordgo.ApplicationCommandOptionSubCommand, Options: []*discordgo.ApplicationCommandOption{ { Name: User, Description: "User whose stats you want to clear", Type: discordgo.ApplicationCommandOptionUser, Required: true, }, }, }, { Name: Guild, Description: "Reset this guild's stats", Type: discordgo.ApplicationCommandOptionSubCommand, }, }, }, }, }
View Source
var Unlink = discordgo.ApplicationCommand{ Name: "unlink", Description: "Unlink a Discord User from their in-game color", Options: []*discordgo.ApplicationCommandOption{ { Type: discordgo.ApplicationCommandOptionUser, Name: "user", Description: "User to unlink", Required: true, }, }, }
Functions ¶
func DeadlockGameStateResponse ¶
func DeadlockGameStateResponse(command string, sett *settings.GuildSettings) *discordgo.InteractionResponse
func DebugResponse ¶
func DebugResponse(operationType string, cached map[string]interface{}, stateBytes []byte, id string, err error, sett *settings.GuildSettings) *discordgo.InteractionResponse
func DmResponse ¶
func DmResponse(sett *settings.GuildSettings) *discordgo.InteractionResponse
func DownloadCooldownResponse ¶
func DownloadCooldownResponse(sett *settings.GuildSettings, category string, duration time.Duration) *discordgo.InteractionResponse
func DownloadNotGoldResponse ¶
func DownloadNotGoldResponse(sett *settings.GuildSettings) *discordgo.InteractionResponse
func GetDebugParams ¶
func GetDownloadParams ¶
func GetDownloadParams(options []*discordgo.ApplicationCommandInteractionDataOption) string
func GetLinkParams ¶
func GetMapParams ¶
func GetMapParams(options []*discordgo.ApplicationCommandInteractionDataOption) (_ game.PlayMap, detailed bool)
func GetPremiumParams ¶
func GetPremiumParams(options []*discordgo.ApplicationCommandInteractionDataOption) string
func GetPrivacyParam ¶
func GetPrivacyParam(options []*discordgo.ApplicationCommandInteractionDataOption) string
func GetSettingsParams ¶
func GetSettingsParams(options []*discordgo.ApplicationCommandInteractionDataOption) (string, []string)
func GetStatsParams ¶
func GetUnlinkParams ¶
func GetUnlinkParams(s *discordgo.Session, options []*discordgo.ApplicationCommandInteractionDataOption) string
func HelpEmbedResponse ¶
func HelpEmbedResponse(commands []*discordgo.ApplicationCommand, sett *settings.GuildSettings) discordgo.MessageEmbed
func HelpResponse ¶
func HelpResponse(sett *settings.GuildSettings, options []*discordgo.ApplicationCommandInteractionDataOption) *discordgo.InteractionResponse
func InfoResponse ¶
func InfoResponse(info BotInfo, guildID string, sett *settings.GuildSettings) *discordgo.InteractionResponse
func InsufficientPermissionsResponse ¶
func InsufficientPermissionsResponse(sett *settings.GuildSettings) *discordgo.InteractionResponse
func LinkResponse ¶
func LinkResponse(status LinkStatus, userID, color string, sett *settings.GuildSettings) *discordgo.InteractionResponse
func MapResponse ¶
func MapResponse(mapType game.PlayMap, detailed bool) *discordgo.InteractionResponse
func NewResponse ¶
func NewResponse(status NewStatus, info NewInfo, sett *settings.GuildSettings) *discordgo.InteractionResponse
func NoGameResponse ¶
func NoGameResponse(sett *settings.GuildSettings) *discordgo.InteractionResponse
func PremiumResponse ¶
func PremiumResponse(guildID string, tier premium.Tier, daysRem int, arg string, isAdmin bool, sett *settings.GuildSettings) *discordgo.InteractionResponse
func PrivacyResponse ¶
func PrivacyResponse(status string, cached map[string]interface{}, user *storage.PostgresUser, err error, sett *settings.GuildSettings) *discordgo.InteractionResponse
func PrivateErrorResponse ¶
func PrivateErrorResponse(cmd string, err error, sett *settings.GuildSettings) *discordgo.InteractionResponse
func PrivateResponse ¶
func PrivateResponse(content string) *discordgo.InteractionResponse
func ReinviteMeResponse ¶
func ReinviteMeResponse(missingPerms int64, channelID string, sett *settings.GuildSettings) *discordgo.InteractionResponse
func SettingsResponse ¶
func SettingsResponse(m interface{}) *discordgo.InteractionResponse
func UnlinkResponse ¶
func UnlinkResponse(status UnlinkStatus, userID string, sett *settings.GuildSettings) *discordgo.InteractionResponse
Types ¶
type BotInfo ¶
type BotInfo struct { Version string `json:"version"` Commit string `json:"commit"` ShardID int `json:"shardID"` ShardCount int `json:"shardCount"` TotalGuilds int64 `json:"totalGuilds"` ActiveGames int64 `json:"activeGames"` TotalUsers int64 `json:"totalUsers"` TotalGames int64 `json:"totalGames"` }
type LinkStatus ¶
type LinkStatus int
const ( LinkSuccess LinkStatus = iota LinkNoPlayer LinkNoGameData )
type UnlinkStatus ¶
type UnlinkStatus int
const ( UnlinkSuccess UnlinkStatus = iota UnlinkNoPlayer )
Click to show internal directories.
Click to hide internal directories.