Documentation
¶
Index ¶
- Constants
- Variables
- type APITokenClaims
- type APITokenResponse
- type AccessTokenResponse
- type AntiraidAction
- type AntiraidActionType
- type AntiraidSettings
- type CaptchaSiteKey
- type CaptchaVerificationRequest
- type ChannelWithPermissions
- type CodeExecSettings
- type Count
- type EnableStatus
- type Error
- type FlatUser
- type FlushGuildRequest
- type Guild
- type GuildAPISettingsRequest
- type GuildKarmaEntry
- type GuildReduced
- type GuildSettings
- type InviteSettingsRequest
- type InviteSettingsResponse
- type KarmaSettings
- type LandingPageResponse
- type ListResponse
- type Member
- type PermissionsMap
- type PermissionsResponse
- type PermissionsUpdate
- type PushCodeRequest
- type ReasonRequest
- type Report
- type ReportRequest
- type RichUnbanRequest
- type SearchResult
- type SessionTokenClaims
- type SlashCommandInfo
- type StarboardEntryResponse
- type State
- type Status
- type SystemInfo
- type UpdateInfoResponse
- type User
- type UsersettingsOTA
- type UsersettingsPrivacy
Constants ¶
const ( AntiraidActionTypeKick = iota AntiraidActionTypeBan )
Variables ¶
var Ok = &Status{200}
Functions ¶
This section is empty.
Types ¶
type APITokenClaims ¶
type APITokenClaims struct { jwt.StandardClaims Salt string `json:"sp_salt,omitempty"` }
APITokenClaims extends the standard JWT claims by private claims used for api tokens.
type APITokenResponse ¶
type APITokenResponse struct { Created time.Time `json:"created"` Expires time.Time `json:"expires"` LastAccess time.Time `json:"last_access"` Hits int `json:"hits"` Token string `json:"token,omitempty"` }
APITokenResponse wraps the reponse model of an apit token request.
type AccessTokenResponse ¶
type AntiraidAction ¶
type AntiraidAction struct { Type AntiraidActionType `json:"type"` IDs []string `json:"ids"` }
type AntiraidActionType ¶
type AntiraidActionType int
type AntiraidSettings ¶
type AntiraidSettings struct { State bool `json:"state"` RegenerationPeriod int `json:"regeneration_period"` Burst int `json:"burst"` Verification bool `json:"verification"` }
AntiraidSettings wraps settings properties for guild antiraid settings.
type CaptchaSiteKey ¶
type CaptchaSiteKey struct {
SiteKey string `json:"sitekey"`
}
type CaptchaVerificationRequest ¶
type CaptchaVerificationRequest struct {
Token string `json:"token"`
}
type ChannelWithPermissions ¶
type CodeExecSettings ¶
type CodeExecSettings struct { EnableStatus Type string `json:"type"` TypesOptions []string `json:"types_options,omitempty"` JdoodleClientId string `json:"jdoodle_clientid,omitempty"` JdoodleClientSecret string `json:"jdoodle_clientsecret,omitempty"` }
type Count ¶
type Count struct {
Count int `json:"count"`
}
Count is a simple response wrapper for a count number.
type EnableStatus ¶
type EnableStatus struct {
Enabled bool `json:"enabled"`
}
type FlatUser ¶
type FlatUser struct { ID string `json:"id"` Username string `json:"username"` Discriminator string `json:"discriminator"` AvatarURL string `json:"avatar_url"` Bot bool `json:"bot"` }
FlatUser shrinks the user object to the only necessary parts for the web interface.
func FlatUserFromUser ¶
FlatUserFromUser returns the reduced FlatUser object from the given user object.
type FlushGuildRequest ¶
type Guild ¶
type Guild struct { ID string `json:"id"` Name string `json:"name"` Icon string `json:"icon"` Region string `json:"region"` AfkChannelID string `json:"afk_channel_id"` OwnerID string `json:"owner_id"` JoinedAt time.Time `json:"joined_at"` Splash string `json:"splash"` MemberCount int `json:"member_count"` VerificationLevel discordgo.VerificationLevel `json:"verification_level"` Large bool `json:"large"` MfaLevel discordgo.MfaLevel `json:"mfa_level"` Description string `json:"description"` Banner string `json:"banner"` PremiumTier discordgo.PremiumTier `json:"premium_tier"` PremiumSubscriptionCount int `json:"premium_subscription_count"` Roles []*discordgo.Role `json:"roles"` Channels []*discordgo.Channel `json:"channels"` SelfMember *Member `json:"self_member"` IconURL string `json:"icon_url"` BackupsEnabled bool `json:"backups_enabled"` LatestBackupEntry time.Time `json:"latest_backup_entry"` InviteBlockEnabled bool `json:"invite_block_enabled"` }
Guild extends a discordgo.Guild as response model.
type GuildAPISettingsRequest ¶
type GuildAPISettingsRequest struct { sharedmodels.GuildAPISettings NewToken string `json:"token"` ResetToken bool `json:"reset_token"` }
type GuildKarmaEntry ¶
GuildKarmaEntry wraps a Member model and karma value for an entry of the karma scoreboard of a guild.
type GuildReduced ¶
type GuildReduced struct { ID string `json:"id"` Name string `json:"name"` Icon string `json:"icon"` IconURL string `json:"icon_url"` Region string `json:"region"` OwnerID string `json:"owner_id"` JoinedAt time.Time `json:"joined_at"` MemberCount int `json:"member_count"` OnlineMemberCount int `json:"online_member_count,omitempty"` }
GuildReduced is a Guild model with fewer details than Guild model.
func GuildReducedFromGuild ¶
func GuildReducedFromGuild(g *discordgo.Guild) *GuildReduced
GuildReducedFromGuild returns a GuildReduced from the passed discordgo.Guild g.
type GuildSettings ¶
type GuildSettings struct { Prefix string `json:"prefix"` Perms map[string]permissions.PermissionArray `json:"perms"` AutoRoles []string `json:"autoroles"` ModLogChannel string `json:"modlogchannel"` ModNotChannel string `json:"modnotchannel"` VoiceLogChannel string `json:"voicelogchannel"` JoinMessageChannel string `json:"joinmessagechannel"` JoinMessageText string `json:"joinmessagetext"` LeaveMessageChannel string `json:"leavemessagechannel"` LeaveMessageText string `json:"leavemessagetext"` }
GuildSettings is the response model for guild settings and preferences.
type InviteSettingsRequest ¶
type InviteSettingsRequest struct { GuildID string `json:"guild_id"` Messsage string `json:"message"` InviteCode string `json:"invite_code"` }
InviteSettingsRequest is the request model for setting the global invite setting.
type InviteSettingsResponse ¶
type InviteSettingsResponse struct { Guild *Guild `json:"guild"` InviteURL string `json:"invite_url"` Message string `json:"message"` }
InviteSettingsResponse is the response model sent back when setting the global invite setting.
type KarmaSettings ¶
type KarmaSettings struct { State bool `json:"state"` EmotesIncrease []string `json:"emotes_increase"` EmotesDecrease []string `json:"emotes_decrease"` Tokens int `json:"tokens"` Penalty bool `json:"penalty"` }
KarmaSettings wraps settings properties for guild karma settings.
type LandingPageResponse ¶
type ListResponse ¶
ListResponse wraps a list response object with the list as Data and N as len(Data).
func NewListResponse ¶
func NewListResponse[T any](data []T) ListResponse[T]
type Member ¶
type Member struct { *discordgo.Member GuildName string `json:"guild_name,omitempty"` AvatarURL string `json:"avatar_url"` CreatedAt time.Time `json:"created_at"` Dominance int `json:"dominance"` Karma int `json:"karma"` KarmaTotal int `json:"karma_total"` ChatMuted bool `json:"chat_muted"` }
Member extends a discordgo.Member as response model.
func MemberFromMember ¶
MemberFromMember returns a Member from the passed discordgo.Member m.
type PermissionsMap ¶
type PermissionsMap map[string]permissions.PermissionArray
type PermissionsResponse ¶
type PermissionsResponse struct {
Permissions permissions.PermissionArray `json:"permissions"`
}
PermissionsResponse wraps a permissions.PermissionsArra as response model.
type PermissionsUpdate ¶
type PermissionsUpdate struct { Perm string `json:"perm"` RoleIDs []string `json:"role_ids"` Override bool `json:"override"` }
PermissionsUpdate is the request model to update a permissions array.
type PushCodeRequest ¶
type PushCodeRequest struct {
Code string `json:"code"`
}
type ReasonRequest ¶
type ReasonRequest struct { Reason string `json:"reason"` Timeout *time.Time `json:"timeout"` Attachment string `json:"attachment"` AttachmentData string `json:"attachment_data"` }
ReasonRequest is a request model wrapping a Reason and Attachment URL.
type Report ¶
type Report struct { sharedmodels.Report TypeName string `json:"type_name"` Created time.Time `json:"created"` Executor *FlatUser `json:"executor,omitempty"` Victim *FlatUser `json:"victim,omitempty"` }
Report extends models.Report by TypeName and Created time.
func ReportFromReport ¶
func ReportFromReport(r sharedmodels.Report, publicAddr string) Report
ReportFromReport returns a Report from the passed models.Report r and publicAddr to generate an attachment URL.
type ReportRequest ¶
type ReportRequest struct { *ReasonRequest Type sharedmodels.ReportType `json:"type"` }
ReportRequest extends ReasonRequest by Type of report.
type RichUnbanRequest ¶
type RichUnbanRequest struct { sharedmodels.UnbanRequest Creator *FlatUser `json:"creator"` Processor *FlatUser `json:"processor"` }
type SearchResult ¶
type SearchResult struct { Guilds []*GuildReduced `json:"guilds"` Members []*Member `json:"members"` }
type SessionTokenClaims ¶
type SessionTokenClaims struct {
jwt.StandardClaims
}
SessionTokenClaims extends the standard JWT claims by information used for session tokens.
Currently, no additional information is extended but this wrapper is used tho to be able to add session information later.
type SlashCommandInfo ¶
type SlashCommandInfo struct { Name string `json:"name"` Description string `json:"description"` Version string `json:"version"` Options []*discordgo.ApplicationCommandOption `json:"options"` Domain string `json:"domain"` SubDomains []permService.SubPermission `json:"subdomains"` DmCapable bool `json:"dm_capable"` Group string `json:"group"` }
SlashCommandInfo wraps a slash command object containing all information of a slash command instance.
func GetSlashCommandInfoFromCommand ¶
func GetSlashCommandInfoFromCommand(cmd *ken.CommandInfo) (ci *SlashCommandInfo)
type StarboardEntryResponse ¶
type StarboardEntryResponse struct { sharedmodels.StarboardEntry MessageURL string `json:"message_url"` AuthorUsername string `json:"author_username"` AvatarURL string `json:"author_avatar_url"` }
StarboardEntryResponse wraps a starboard entry as response model containing hydrated information of the author.
type SystemInfo ¶
type SystemInfo struct { Version string `json:"version"` CommitHash string `json:"commit_hash"` BuildDate time.Time `json:"build_date"` GoVersion string `json:"go_version"` Uptime int64 `json:"uptime"` UptimeStr string `json:"uptime_str"` OS string `json:"os"` Arch string `json:"arch"` CPUs int `json:"cpus"` GoRoutines int `json:"go_routines"` StackUse uint64 `json:"stack_use"` StackUseStr string `json:"stack_use_str"` HeapUse uint64 `json:"heap_use"` HeapUseStr string `json:"heap_use_str"` BotUserID string `json:"bot_user_id"` BotInvite string `json:"bot_invite"` Guilds int `json:"guilds"` }
SystemInfo is the response model for a system info request.
type UpdateInfoResponse ¶
type UpdateInfoResponse struct { Current versioncheck.Semver `json:"current"` CurrentStr string `json:"current_str"` Latest versioncheck.Semver `json:"latest"` LatestStr string `json:"latest_str"` IsOld bool `json:"isold"` }
type User ¶
type User struct { *discordgo.User AvatarURL string `json:"avatar_url"` CreatedAt time.Time `json:"created_at"` BotOwner bool `json:"bot_owner"` CaptchaVerified bool `json:"captcha_verified"` }
User extends a discordgo.User as reponse model.
type UsersettingsOTA ¶
type UsersettingsOTA struct {
Enabled bool `json:"enabled"`
}
type UsersettingsPrivacy ¶
type UsersettingsPrivacy struct {
StarboardOptout bool `json:"starboard_optout"`
}