Documentation ¶
Index ¶
- Constants
- Variables
- func CheckLimits(exec boil.ContextExecutor, rule *models.AutomodRule, tmpl web.TemplateData, ...) (newParts []*models.AutomodRuleDatum, ok bool, err error)
- func FetchGuildLists(guildID int64) ([]*models.AutomodList, error)
- func FindFetchGuildList(guildID int64, listID int64) (*models.AutomodList, error)
- func GuildMaxLists(guildID int64) int
- func GuildMaxMessageTriggers(guildID int64) int
- func GuildMaxRulesets(guildID int64) int
- func GuildMaxTotalRules(guildID int64) int
- func GuildMaxViolationTriggers(guildID int64) int
- func ParseAllRulePartData(dataModels []*models.AutomodRuleDatum) ([]interface{}, error)
- func ParseRulePartData(model *models.AutomodRuleDatum) (interface{}, error)
- func PrepareMessageForWordCheck(input string) string
- func ReadRuleRowData(guild *dstate.GuildSet, tmpl web.TemplateData, rawData []RuleRowData, ...) (result []*models.AutomodRuleDatum, validationOK bool, err error)
- func RegisterPlugin()
- func WebLoadRuleSettings(r *http.Request, tmpl web.TemplateData, ruleset *models.AutomodRuleset)
- type AccountAgeCondition
- func (ac *AccountAgeCondition) DataType() interface{}
- func (ac *AccountAgeCondition) Description() string
- func (ac *AccountAgeCondition) IsMet(data *TriggeredRuleData, settings interface{}) (bool, error)
- func (ac *AccountAgeCondition) Kind() RulePartType
- func (ac *AccountAgeCondition) MergeDuplicates(data []interface{}) interface{}
- func (ac *AccountAgeCondition) Name() string
- func (ac *AccountAgeCondition) UserSettings() []*SettingDef
- type AccountAgeConditionData
- type AddViolationEffect
- func (vio *AddViolationEffect) Apply(ctxData *TriggeredRuleData, settings interface{}) error
- func (vio *AddViolationEffect) DataType() interface{}
- func (vio *AddViolationEffect) Description() (description string)
- func (vio *AddViolationEffect) Kind() RulePartType
- func (vio *AddViolationEffect) Name() (name string)
- func (vio *AddViolationEffect) UserSettings() []*SettingDef
- type AddViolationEffectData
- type AllCapsTrigger
- func (caps *AllCapsTrigger) CheckMessage(triggerCtx *TriggerContext, cs *dstate.ChannelState, m *discordgo.Message, ...) (bool, error)
- func (caps *AllCapsTrigger) DataType() interface{}
- func (caps *AllCapsTrigger) Description() string
- func (caps *AllCapsTrigger) Kind() RulePartType
- func (caps *AllCapsTrigger) MergeDuplicates(data []interface{}) interface{}
- func (caps *AllCapsTrigger) Name() string
- func (caps *AllCapsTrigger) UserSettings() []*SettingDef
- type AllCapsTriggerData
- type AntiPhishingLinkTrigger
- func (a *AntiPhishingLinkTrigger) CheckMessage(triggerCtx *TriggerContext, cs *dstate.ChannelState, m *discordgo.Message, ...) (bool, error)
- func (a *AntiPhishingLinkTrigger) DataType() interface{}
- func (a *AntiPhishingLinkTrigger) Description() string
- func (a *AntiPhishingLinkTrigger) Kind() RulePartType
- func (a *AntiPhishingLinkTrigger) Name() string
- func (a *AntiPhishingLinkTrigger) UserSettings() []*SettingDef
- type AnyLinkTrigger
- func (alc *AnyLinkTrigger) CheckMessage(triggerCtx *TriggerContext, cs *dstate.ChannelState, m *discordgo.Message, ...) (bool, error)
- func (alc *AnyLinkTrigger) DataType() interface{}
- func (alc *AnyLinkTrigger) Description() (description string)
- func (alc *AnyLinkTrigger) Kind() RulePartType
- func (alc *AnyLinkTrigger) MergeDuplicates(data []interface{}) interface{}
- func (alc *AnyLinkTrigger) Name() (name string)
- func (alc *AnyLinkTrigger) UserSettings() []*SettingDef
- type BanUserEffect
- func (ban *BanUserEffect) Apply(ctxData *TriggeredRuleData, settings interface{}) error
- func (ban *BanUserEffect) DataType() interface{}
- func (ban *BanUserEffect) Description() (description string)
- func (ban *BanUserEffect) Kind() RulePartType
- func (ban *BanUserEffect) MergeDuplicates(data []interface{}) interface{}
- func (ban *BanUserEffect) Name() (name string)
- func (ban *BanUserEffect) UserSettings() []*SettingDef
- type BanUserEffectData
- type BaseRegexTrigger
- type BaseRegexTriggerData
- type BotCondition
- func (bc *BotCondition) DataType() interface{}
- func (bc *BotCondition) Description() string
- func (bc *BotCondition) IsMet(data *TriggeredRuleData, settings interface{}) (bool, error)
- func (bc *BotCondition) Kind() RulePartType
- func (bc *BotCondition) MergeDuplicates(data []interface{}) interface{}
- func (bc *BotCondition) Name() string
- func (bc *BotCondition) UserSettings() []*SettingDef
- type ChannelCategoriesCondition
- func (cd *ChannelCategoriesCondition) DataType() interface{}
- func (cd *ChannelCategoriesCondition) Description() string
- func (cd *ChannelCategoriesCondition) IsMet(data *TriggeredRuleData, settings interface{}) (bool, error)
- func (cd *ChannelCategoriesCondition) Kind() RulePartType
- func (cd *ChannelCategoriesCondition) MergeDuplicates(data []interface{}) interface{}
- func (cd *ChannelCategoriesCondition) Name() string
- func (cd *ChannelCategoriesCondition) UserSettings() []*SettingDef
- type ChannelCategoryConditionData
- type ChannelsCondition
- func (cd *ChannelsCondition) DataType() interface{}
- func (cd *ChannelsCondition) Description() string
- func (cd *ChannelsCondition) IsMet(data *TriggeredRuleData, settings interface{}) (bool, error)
- func (cd *ChannelsCondition) Kind() RulePartType
- func (cd *ChannelsCondition) MergeDuplicates(data []interface{}) interface{}
- func (cd *ChannelsCondition) Name() string
- func (cd *ChannelsCondition) UserSettings() []*SettingDef
- type ChannelsConditionData
- type Condition
- type CreateListData
- type CreateRuleData
- type CreateRulesetData
- type CtxKey
- type DeleteMessageEffect
- func (del *DeleteMessageEffect) Apply(ctxData *TriggeredRuleData, settings interface{}) error
- func (del *DeleteMessageEffect) DataType() interface{}
- func (del *DeleteMessageEffect) Description() (description string)
- func (del *DeleteMessageEffect) Kind() RulePartType
- func (del *DeleteMessageEffect) MergeDuplicates(data []interface{}) interface{}
- func (del *DeleteMessageEffect) Name() (name string)
- func (del *DeleteMessageEffect) UserSettings() []*SettingDef
- type DeleteMessagesEffect
- func (del *DeleteMessagesEffect) Apply(ctxData *TriggeredRuleData, settings interface{}) error
- func (del *DeleteMessagesEffect) DataType() interface{}
- func (del *DeleteMessagesEffect) Description() (description string)
- func (del *DeleteMessagesEffect) Kind() RulePartType
- func (del *DeleteMessagesEffect) MergeDuplicates(data []interface{}) interface{}
- func (del *DeleteMessagesEffect) Name() (name string)
- func (del *DeleteMessagesEffect) UserSettings() []*SettingDef
- type DeleteMessagesEffectData
- type DomainTrigger
- func (dt *DomainTrigger) CheckMessage(triggerCtx *TriggerContext, cs *dstate.ChannelState, m *discordgo.Message, ...) (bool, error)
- func (dt *DomainTrigger) DataType() interface{}
- func (dt *DomainTrigger) Description() (description string)
- func (dt *DomainTrigger) Kind() RulePartType
- func (dt *DomainTrigger) Name() (name string)
- func (dt *DomainTrigger) UserSettings() []*SettingDef
- type DomainTriggerData
- type Effect
- type EnableChannelSlowmodeEffect
- func (slow *EnableChannelSlowmodeEffect) Apply(ctxData *TriggeredRuleData, settings interface{}) error
- func (slow *EnableChannelSlowmodeEffect) DataType() interface{}
- func (slow *EnableChannelSlowmodeEffect) Description() (description string)
- func (slow *EnableChannelSlowmodeEffect) Kind() RulePartType
- func (slow *EnableChannelSlowmodeEffect) Name() (name string)
- func (slow *EnableChannelSlowmodeEffect) UserSettings() []*SettingDef
- type EnableChannelSlowmodeEffectData
- type ErrUnknownTypeID
- type GiveRoleEffect
- func (gf *GiveRoleEffect) Apply(ctxData *TriggeredRuleData, settings interface{}) error
- func (gf *GiveRoleEffect) DataType() interface{}
- func (gf *GiveRoleEffect) Description() (description string)
- func (gr *GiveRoleEffect) Kind() RulePartType
- func (gf *GiveRoleEffect) Name() (name string)
- func (gf *GiveRoleEffect) UserSettings() []*SettingDef
- type GiveRoleEffectData
- type GoogleSafeBrowsingTrigger
- func (g *GoogleSafeBrowsingTrigger) CheckMessage(triggerCtx *TriggerContext, cs *dstate.ChannelState, m *discordgo.Message, ...) (bool, error)
- func (g *GoogleSafeBrowsingTrigger) DataType() interface{}
- func (g *GoogleSafeBrowsingTrigger) Description() string
- func (g *GoogleSafeBrowsingTrigger) Kind() RulePartType
- func (g *GoogleSafeBrowsingTrigger) MergeDuplicates(data []interface{}) interface{}
- func (g *GoogleSafeBrowsingTrigger) Name() string
- func (g *GoogleSafeBrowsingTrigger) UserSettings() []*SettingDef
- type JoinListener
- type KickUserEffect
- func (kick *KickUserEffect) Apply(ctxData *TriggeredRuleData, settings interface{}) error
- func (kick *KickUserEffect) DataType() interface{}
- func (kick *KickUserEffect) Description() (description string)
- func (kick *KickUserEffect) Kind() RulePartType
- func (kick *KickUserEffect) MergeDuplicates(data []interface{}) interface{}
- func (kick *KickUserEffect) Name() (name string)
- func (kick *KickUserEffect) UserSettings() []*SettingDef
- type KickUserEffectData
- type MemberAgeConditionData
- type MemberAgecondition
- func (mc *MemberAgecondition) DataType() interface{}
- func (mc *MemberAgecondition) Description() string
- func (mc *MemberAgecondition) IsMet(data *TriggeredRuleData, settings interface{}) (bool, error)
- func (mc *MemberAgecondition) Kind() RulePartType
- func (mc *MemberAgecondition) MergeDuplicates(data []interface{}) interface{}
- func (mc *MemberAgecondition) Name() string
- func (mc *MemberAgecondition) UserSettings() []*SettingDef
- type MemberJoinTrigger
- func (mj *MemberJoinTrigger) CheckJoin(t *TriggerContext) (isAffected bool, err error)
- func (mj *MemberJoinTrigger) DataType() interface{}
- func (mj *MemberJoinTrigger) Description() (description string)
- func (mj *MemberJoinTrigger) Kind() RulePartType
- func (mj *MemberJoinTrigger) Name() (name string)
- func (mj *MemberJoinTrigger) UserSettings() []*SettingDef
- type MemberRolesCondition
- func (mrc *MemberRolesCondition) DataType() interface{}
- func (mrc *MemberRolesCondition) Description() string
- func (mrc *MemberRolesCondition) IsMet(data *TriggeredRuleData, settings interface{}) (bool, error)
- func (mrc *MemberRolesCondition) Kind() RulePartType
- func (mrc *MemberRolesCondition) MergeDuplicates(data []interface{}) interface{}
- func (mrc *MemberRolesCondition) Name() string
- func (mrc *MemberRolesCondition) UserSettings() []*SettingDef
- type MemberRolesConditionData
- type MentionsTrigger
- func (mc *MentionsTrigger) CheckMessage(triggerCtx *TriggerContext, cs *dstate.ChannelState, m *discordgo.Message, ...) (bool, error)
- func (mc *MentionsTrigger) DataType() interface{}
- func (mc *MentionsTrigger) Description() string
- func (mc *MentionsTrigger) Kind() RulePartType
- func (mc *MentionsTrigger) MergeDuplicates(data []interface{}) interface{}
- func (mc *MentionsTrigger) Name() string
- func (mc *MentionsTrigger) UserSettings() []*SettingDef
- type MentionsTriggerData
- type MergeableRulePart
- type MessageAttachmentTrigger
- func (mat *MessageAttachmentTrigger) CheckMessage(triggerCtx *TriggerContext, cs *dstate.ChannelState, m *discordgo.Message, ...) (bool, error)
- func (mat *MessageAttachmentTrigger) DataType() interface{}
- func (mat *MessageAttachmentTrigger) Description() string
- func (mat *MessageAttachmentTrigger) Kind() RulePartType
- func (mat *MessageAttachmentTrigger) MergeDuplicates(data []interface{}) interface{}
- func (mat *MessageAttachmentTrigger) Name() string
- func (mat *MessageAttachmentTrigger) UserSettings() []*SettingDef
- type MessageEditedCondition
- func (mc *MessageEditedCondition) DataType() interface{}
- func (mc *MessageEditedCondition) Description() string
- func (mc *MessageEditedCondition) IsMet(data *TriggeredRuleData, settings interface{}) (bool, error)
- func (mc *MessageEditedCondition) Kind() RulePartType
- func (mc *MessageEditedCondition) MergeDuplicates(data []interface{}) interface{}
- func (mc *MessageEditedCondition) Name() string
- func (mc *MessageEditedCondition) UserSettings() []*SettingDef
- type MessageRegexTrigger
- type MessageTrigger
- type MultiMsgMentionTrigger
- func (mt *MultiMsgMentionTrigger) CheckMessage(triggerCtx *TriggerContext, cs *dstate.ChannelState, m *discordgo.Message, ...) (bool, error)
- func (mt *MultiMsgMentionTrigger) DataType() interface{}
- func (mt *MultiMsgMentionTrigger) Description() string
- func (mt *MultiMsgMentionTrigger) Kind() RulePartType
- func (mt *MultiMsgMentionTrigger) MergeDuplicates(data []interface{}) interface{}
- func (mt *MultiMsgMentionTrigger) Name() string
- func (mt *MultiMsgMentionTrigger) UserSettings() []*SettingDef
- type MultiMsgMentionTriggerData
- type MuteUserEffect
- func (mute *MuteUserEffect) Apply(ctxData *TriggeredRuleData, settings interface{}) error
- func (mute *MuteUserEffect) DataType() interface{}
- func (mute *MuteUserEffect) Description() (description string)
- func (mute *MuteUserEffect) Kind() RulePartType
- func (mute *MuteUserEffect) MergeDuplicates(data []interface{}) interface{}
- func (mute *MuteUserEffect) Name() (name string)
- func (mute *MuteUserEffect) UserSettings() []*SettingDef
- type MuteUserEffectData
- type NicknameListener
- type NicknameRegexTrigger
- type NicknameWordlistTrigger
- func (nwl *NicknameWordlistTrigger) CheckNickname(t *TriggerContext) (bool, error)
- func (nwl *NicknameWordlistTrigger) DataType() interface{}
- func (nwl *NicknameWordlistTrigger) Description() (description string)
- func (nwl *NicknameWordlistTrigger) Kind() RulePartType
- func (nwl *NicknameWordlistTrigger) Name() (name string)
- func (nwl *NicknameWordlistTrigger) UserSettings() []*SettingDef
- type NicknameWordlistTriggerData
- type ParsedPart
- type ParsedRule
- type ParsedRuleset
- type Plugin
- func (p *Plugin) AddCommands()
- func (p *Plugin) AllFeatureFlags() []string
- func (p *Plugin) BotInit()
- func (p *Plugin) CheckConditions(ctxData *TriggeredRuleData, conditions []*ParsedPart) bool
- func (p *Plugin) CheckTriggers(rulesets []*ParsedRuleset, gs *dstate.GuildSet, ms *dstate.MemberState, ...) bool
- func (p *Plugin) FetchGuildRulesets(guildID int64) ([]*ParsedRuleset, error)
- func (p *Plugin) InitWeb()
- func (p *Plugin) LoadServerHomeWidget(w http.ResponseWriter, r *http.Request) (web.TemplateData, error)
- func (p *Plugin) PluginInfo() *common.PluginInfo
- func (p *Plugin) RulesetRulesTriggered(ctxData *TriggeredRuleData, checkedConditions bool)
- func (p *Plugin) RulesetRulesTriggeredCondsPassed(ruleset *ParsedRuleset, triggeredRules []*ParsedRule, ...)
- func (p *Plugin) UpdateFeatureFlags(guildID int64) ([]string, error)
- type RemoveRoleEffect
- func (rf *RemoveRoleEffect) Apply(ctxData *TriggeredRuleData, settings interface{}) error
- func (rf *RemoveRoleEffect) DataType() interface{}
- func (rf *RemoveRoleEffect) Description() (description string)
- func (rr *RemoveRoleEffect) Kind() RulePartType
- func (rf *RemoveRoleEffect) Name() (name string)
- func (rf *RemoveRoleEffect) UserSettings() []*SettingDef
- type RemoveRoleEffectData
- type ResetChannelRatelimitData
- type ResetViolationsEffect
- func (rv *ResetViolationsEffect) Apply(ctxData *TriggeredRuleData, settings interface{}) error
- func (rv *ResetViolationsEffect) DataType() interface{}
- func (rv *ResetViolationsEffect) Description() (description string)
- func (rv *ResetViolationsEffect) Kind() RulePartType
- func (rv *ResetViolationsEffect) Name() (name string)
- func (rv *ResetViolationsEffect) UserSettings() []*SettingDef
- type ResetViolationsEffectData
- type RulePart
- type RulePartPair
- type RulePartType
- type RuleRowData
- type ServerInviteTrigger
- func (inv *ServerInviteTrigger) CheckMessage(triggerCtx *TriggerContext, cs *dstate.ChannelState, m *discordgo.Message, ...) (bool, error)
- func (inv *ServerInviteTrigger) DataType() interface{}
- func (inv *ServerInviteTrigger) Description() string
- func (inv *ServerInviteTrigger) Kind() RulePartType
- func (inv *ServerInviteTrigger) MergeDuplicates(data []interface{}) interface{}
- func (inv *ServerInviteTrigger) Name() string
- func (inv *ServerInviteTrigger) UserSettings() []*SettingDef
- type SetNicknameEffect
- func (sn *SetNicknameEffect) Apply(ctxData *TriggeredRuleData, settings interface{}) error
- func (sn *SetNicknameEffect) DataType() interface{}
- func (sn *SetNicknameEffect) Description() (description string)
- func (sn *SetNicknameEffect) Kind() RulePartType
- func (sn *SetNicknameEffect) MergeDuplicates(data []interface{}) interface{}
- func (sn *SetNicknameEffect) Name() (name string)
- func (sn *SetNicknameEffect) UserSettings() []*SettingDef
- type SetNicknameEffectData
- type SettingDef
- type SettingType
- type SlowmodeTrigger
- func (s *SlowmodeTrigger) CheckMessage(triggerCtx *TriggerContext, cs *dstate.ChannelState, m *discordgo.Message, ...) (bool, error)
- func (s *SlowmodeTrigger) DataType() interface{}
- func (s *SlowmodeTrigger) Description() string
- func (s *SlowmodeTrigger) Kind() RulePartType
- func (s *SlowmodeTrigger) MergeDuplicates(data []interface{}) interface{}
- func (s *SlowmodeTrigger) Name() string
- func (s *SlowmodeTrigger) UserSettings() []*SettingDef
- type SlowmodeTriggerData
- type SpamTrigger
- func (spam *SpamTrigger) CheckMessage(triggerCtx *TriggerContext, cs *dstate.ChannelState, m *discordgo.Message, ...) (bool, error)
- func (spam *SpamTrigger) DataType() interface{}
- func (spam *SpamTrigger) Description() string
- func (spam *SpamTrigger) Kind() RulePartType
- func (spam *SpamTrigger) Name() string
- func (spam *SpamTrigger) UserSettings() []*SettingDef
- type SpamTriggerData
- type TriggerContext
- type TriggeredRuleData
- type UpdateListData
- type UpdateRuleData
- type UpdateRulesetData
- type UsernameInviteTrigger
- func (uv *UsernameInviteTrigger) CheckUsername(t *TriggerContext) (bool, error)
- func (uv *UsernameInviteTrigger) DataType() interface{}
- func (uv *UsernameInviteTrigger) Description() (description string)
- func (uv *UsernameInviteTrigger) Kind() RulePartType
- func (uv *UsernameInviteTrigger) Name() (name string)
- func (uv *UsernameInviteTrigger) UserSettings() []*SettingDef
- type UsernameListener
- type UsernameRegexTrigger
- type UsernameWordlistTrigger
- func (uwl *UsernameWordlistTrigger) CheckUsername(t *TriggerContext) (bool, error)
- func (uwl *UsernameWordlistTrigger) DataType() interface{}
- func (uwl *UsernameWordlistTrigger) Description() (description string)
- func (uwl *UsernameWordlistTrigger) Kind() RulePartType
- func (uwl *UsernameWordlistTrigger) Name() (name string)
- func (uwl *UsernameWordlistTrigger) UserSettings() []*SettingDef
- type UsernameWorldlistData
- type ViolationListener
- type ViolationsTrigger
- func (vt *ViolationsTrigger) CheckUser(ctxData *TriggeredRuleData, violations []*models.AutomodViolation, ...) (isAffected bool, err error)
- func (vt *ViolationsTrigger) DataType() interface{}
- func (vt *ViolationsTrigger) Description() string
- func (vt *ViolationsTrigger) Kind() RulePartType
- func (vt *ViolationsTrigger) Name() string
- func (vt *ViolationsTrigger) UserSettings() []*SettingDef
- type ViolationsTriggerData
- type WarnUserEffect
- func (warn *WarnUserEffect) Apply(ctxData *TriggeredRuleData, settings interface{}) error
- func (warn *WarnUserEffect) DataType() interface{}
- func (warn *WarnUserEffect) Description() (description string)
- func (warn *WarnUserEffect) Kind() RulePartType
- func (warn *WarnUserEffect) MergeDuplicates(data []interface{}) interface{}
- func (warn *WarnUserEffect) Name() (name string)
- func (warn *WarnUserEffect) UserSettings() []*SettingDef
- type WarnUserEffectData
- type WordListTrigger
- func (wl *WordListTrigger) CheckMessage(triggerCtx *TriggerContext, cs *dstate.ChannelState, m *discordgo.Message, ...) (bool, error)
- func (wl *WordListTrigger) DataType() interface{}
- func (wl *WordListTrigger) Description() (description string)
- func (wl *WordListTrigger) Kind() RulePartType
- func (wl *WordListTrigger) Name() (name string)
- func (wl *WordListTrigger) UserSettings() []*SettingDef
- type WorldListTriggerData
Constants ¶
View Source
const ( MaxMessageTriggers = 20 MaxMessageTriggersPremium = 100 MaxViolationTriggers = 20 MaxViolationTriggersPremium = 100 MaxTotalRules = 25 MaxTotalRulesPremium = 150 MaxLists = 5 MaxListsPremium = 25 MaxRuleParts = 25 MaxRulesets = 10 MaxRulesetsPremium = 25 )
View Source
const ( SettingTypeRole = "role" SettingTypeMultiRole = "multi_role" SettingTypeChannel = "channel" SettingTypeMultiChannel = "multi_channel" SettingTypeMultiChannelCategories = "multi_channel_cat" SettingTypeInt = "int" SettingTypeString = "string" SettingTypeBool = "bool" SettingTypeList = "list" )
Variables ¶
View Source
var DBSchemas = []string{`
CREATE TABLE IF NOT EXISTS automod_rulesets (
id BIGSERIAL PRIMARY KEY,
guild_id BIGINT NOT NULL,
name TEXT NOT NULL,
enabled BOOLEAN NOT NULL
);
`, `
CREATE INDEX IF NOT EXISTS automod_rulesets_guild_idx ON automod_rulesets(guild_id);
`, `
CREATE TABLE IF NOT EXISTS automod_rules (
id BIGSERIAL PRIMARY KEY,
guild_id BIGINT NOT NULL,
ruleset_id BIGINT references automod_rulesets(id) ON DELETE CASCADE NOT NULL,
name TEXT NOT NULL,
trigger_counter BIGINT NOT NULL
);
`, `
CREATE INDEX IF NOT EXISTS automod_rules_guild_idx ON automod_rules(guild_id);
`, `
CREATE TABLE IF NOT EXISTS automod_rule_data (
id BIGSERIAL PRIMARY KEY,
guild_id BIGINT NOT NULL,
rule_id BIGINT references automod_rules(id) ON DELETE CASCADE NOT NULL,
kind int NOT NULL,
type_id INT NOT NULL,
settings JSONB NOT NULL
);
`, `
CREATE INDEX IF NOT EXISTS automod_rule_data_guild_idx ON automod_rule_data(guild_id);
`, `
CREATE TABLE IF NOT EXISTS automod_ruleset_conditions (
id BIGSERIAL PRIMARY KEY,
guild_id BIGINT NOT NULL,
ruleset_id BIGINT references automod_rulesets(id) ON DELETE CASCADE NOT NULL,
kind int NOT NULL,
type_id INT NOT NULL,
settings JSONB NOT NULL
);
`, `
CREATE INDEX IF NOT EXISTS automod_ruleset_conditions_guild_idx ON automod_ruleset_conditions(guild_id);
`, `
CREATE TABLE IF NOT EXISTS automod_violations (
id BIGSERIAL PRIMARY KEY,
guild_id BIGINT NOT NULL,
user_id BIGINT NOT NULL,
rule_id BIGINT references automod_rules(id) ON DELETE SET NULL,
created_at TIMESTAMP WITH TIME ZONE NOT NULL,
name TEXT NOT NULL
);
`, `
CREATE INDEX IF NOT EXISTS automod_violations_guild_idx ON automod_violations(guild_id);
`, `
CREATE INDEX IF NOT EXISTS automod_violations_user_idx ON automod_violations(user_id);
`, `
CREATE TABLE IF NOT EXISTS automod_lists (
id BIGSERIAL PRIMARY KEY,
guild_id BIGINT NOT NULL,
name TEXT NOT NULL,
kind INT NOT NULL,
content TEXT[] NOT NULL
);
`, `
CREATE INDEX IF NOT EXISTS automod_lists_guild_idx ON automod_lists(guild_id);
`, `
CREATE TABLE IF NOT EXISTS automod_triggered_rules (
id BIGSERIAL PRIMARY KEY,
created_at TIMESTAMP WITH TIME ZONE NOT NULL,
channel_id BIGINT NOT NULL,
channel_name TEXT NOT NULL,
guild_id BIGINT NOT NULL,
trigger_id BIGINT references automod_rule_data(id) ON DELETE SET NULL,
trigger_typeid INT NOT NULL, -- backup in case the actual trigger was deleted
rule_id BIGINT references automod_rules(id) ON DELETE SET NULL,
rule_name TEXT NOT NULL, -- backup in case the rule was deleted
ruleset_name TEXT NOT NULL,
user_id BIGINT NOT NULL,
user_name TEXT NOT NULL,
extradata JSONB NOT NULL
);
`, `
CREATE INDEX IF NOT EXISTS automod_triggered_rules_guild_idx ON automod_triggered_rules(guild_id);
`, `
CREATE INDEX IF NOT EXISTS automod_triggered_rules_rule_id_idx on automod_triggered_rules(rule_id);
`, `
CREATE INDEX IF NOT EXISTS automod_triggered_rules_trigger_idx ON automod_triggered_rules(trigger_id);
`}
View Source
var ErrListNotFound = errors.New("list not found")
View Source
var InverseRulePartMap = make(map[RulePart]int)
View Source
var PageHTML string
View Source
var (
RegexCache *ccache.Cache
)
View Source
var RulePartList = make([]*RulePartPair, 0)
View Source
var RulePartMap = map[int]RulePart{ 1: &AllCapsTrigger{}, 2: &MentionsTrigger{}, 3: &AnyLinkTrigger{}, 4: &ViolationsTrigger{}, 5: &WordListTrigger{Blacklist: true}, 6: &WordListTrigger{Blacklist: false}, 7: &DomainTrigger{Blacklist: true}, 8: &DomainTrigger{Blacklist: false}, 9: &ServerInviteTrigger{}, 10: &GoogleSafeBrowsingTrigger{}, 11: &SlowmodeTrigger{ChannelBased: false}, 12: &SlowmodeTrigger{ChannelBased: true}, 13: &MultiMsgMentionTrigger{ChannelBased: false}, 14: &MultiMsgMentionTrigger{ChannelBased: true}, 15: &MessageRegexTrigger{}, 16: &MessageRegexTrigger{BaseRegexTrigger: BaseRegexTrigger{Inverse: true}}, 17: &SpamTrigger{}, 18: &NicknameRegexTrigger{BaseRegexTrigger: BaseRegexTrigger{Inverse: false}}, 19: &NicknameRegexTrigger{BaseRegexTrigger: BaseRegexTrigger{Inverse: true}}, 20: &NicknameWordlistTrigger{Blacklist: false}, 21: &NicknameWordlistTrigger{Blacklist: true}, 22: &SlowmodeTrigger{Attachments: true, ChannelBased: false}, 23: &SlowmodeTrigger{Attachments: true, ChannelBased: true}, 24: &UsernameWordlistTrigger{Blacklist: false}, 25: &UsernameWordlistTrigger{Blacklist: true}, 26: &UsernameRegexTrigger{BaseRegexTrigger{Inverse: false}}, 27: &UsernameRegexTrigger{BaseRegexTrigger{Inverse: true}}, 29: &UsernameInviteTrigger{}, 30: &MemberJoinTrigger{}, 31: &MessageAttachmentTrigger{}, 32: &MessageAttachmentTrigger{RequiresAttachment: true}, 33: &AntiPhishingLinkTrigger{}, 200: &MemberRolesCondition{Blacklist: true}, 201: &MemberRolesCondition{Blacklist: false}, 202: &ChannelsCondition{Blacklist: true}, 203: &ChannelsCondition{Blacklist: false}, 204: &AccountAgeCondition{Below: false}, 205: &AccountAgeCondition{Below: true}, 206: &MemberAgecondition{Below: false}, 207: &MemberAgecondition{Below: true}, 209: &BotCondition{Ignore: true}, 210: &BotCondition{Ignore: false}, 211: &ChannelCategoriesCondition{Blacklist: true}, 212: &ChannelCategoriesCondition{Blacklist: false}, 213: &MessageEditedCondition{NewMessage: true}, 214: &MessageEditedCondition{NewMessage: false}, 300: &DeleteMessageEffect{}, 301: &AddViolationEffect{}, 302: &KickUserEffect{}, 303: &BanUserEffect{}, 304: &MuteUserEffect{}, 305: &WarnUserEffect{}, 306: &SetNicknameEffect{}, 307: &ResetViolationsEffect{}, 308: &DeleteMessagesEffect{}, 309: &GiveRoleEffect{}, 311: &EnableChannelSlowmodeEffect{}, 312: &RemoveRoleEffect{}, }
maps rule part indentifiers to actual condition types since these are stored in the database, changing the id's would require an update of all the relevant rows so don't do that.
Functions ¶
func CheckLimits ¶ added in v1.7.0
func CheckLimits(exec boil.ContextExecutor, rule *models.AutomodRule, tmpl web.TemplateData, parts []*models.AutomodRuleDatum) (newParts []*models.AutomodRuleDatum, ok bool, err error)
func FetchGuildLists ¶ added in v1.7.0
func FetchGuildLists(guildID int64) ([]*models.AutomodList, error)
func FindFetchGuildList ¶ added in v1.7.0
func FindFetchGuildList(guildID int64, listID int64) (*models.AutomodList, error)
func GuildMaxLists ¶ added in v1.7.0
func GuildMaxMessageTriggers ¶ added in v1.7.0
func GuildMaxRulesets ¶ added in v1.18.0
func GuildMaxTotalRules ¶ added in v1.7.0
func GuildMaxViolationTriggers ¶ added in v1.7.0
func ParseAllRulePartData ¶ added in v1.7.0
func ParseAllRulePartData(dataModels []*models.AutomodRuleDatum) ([]interface{}, error)
func ParseRulePartData ¶ added in v1.7.0
func ParseRulePartData(model *models.AutomodRuleDatum) (interface{}, error)
func PrepareMessageForWordCheck ¶ added in v1.7.4
func ReadRuleRowData ¶ added in v1.7.0
func ReadRuleRowData(guild *dstate.GuildSet, tmpl web.TemplateData, rawData []RuleRowData, form url.Values, namePrefix string) (result []*models.AutomodRuleDatum, validationOK bool, err error)
func RegisterPlugin ¶
func RegisterPlugin()
func WebLoadRuleSettings ¶ added in v1.7.0
func WebLoadRuleSettings(r *http.Request, tmpl web.TemplateData, ruleset *models.AutomodRuleset)
Types ¶
type AccountAgeCondition ¶ added in v1.7.0
type AccountAgeCondition struct {
Below bool // if true, then blacklist mode, otherwise whitelist mode
}
func (*AccountAgeCondition) DataType ¶ added in v1.7.0
func (ac *AccountAgeCondition) DataType() interface{}
func (*AccountAgeCondition) Description ¶ added in v1.7.0
func (ac *AccountAgeCondition) Description() string
func (*AccountAgeCondition) IsMet ¶ added in v1.7.0
func (ac *AccountAgeCondition) IsMet(data *TriggeredRuleData, settings interface{}) (bool, error)
func (*AccountAgeCondition) Kind ¶ added in v1.7.0
func (ac *AccountAgeCondition) Kind() RulePartType
func (*AccountAgeCondition) MergeDuplicates ¶ added in v1.7.0
func (ac *AccountAgeCondition) MergeDuplicates(data []interface{}) interface{}
func (*AccountAgeCondition) Name ¶ added in v1.7.0
func (ac *AccountAgeCondition) Name() string
func (*AccountAgeCondition) UserSettings ¶ added in v1.7.0
func (ac *AccountAgeCondition) UserSettings() []*SettingDef
type AccountAgeConditionData ¶ added in v1.7.0
type AccountAgeConditionData struct {
Treshold int
}
type AddViolationEffect ¶ added in v1.7.0
type AddViolationEffect struct{}
func (*AddViolationEffect) Apply ¶ added in v1.7.0
func (vio *AddViolationEffect) Apply(ctxData *TriggeredRuleData, settings interface{}) error
func (*AddViolationEffect) DataType ¶ added in v1.7.0
func (vio *AddViolationEffect) DataType() interface{}
func (*AddViolationEffect) Description ¶ added in v1.7.0
func (vio *AddViolationEffect) Description() (description string)
func (*AddViolationEffect) Kind ¶ added in v1.7.0
func (vio *AddViolationEffect) Kind() RulePartType
func (*AddViolationEffect) Name ¶ added in v1.7.0
func (vio *AddViolationEffect) Name() (name string)
func (*AddViolationEffect) UserSettings ¶ added in v1.7.0
func (vio *AddViolationEffect) UserSettings() []*SettingDef
type AddViolationEffectData ¶ added in v1.7.0
type AddViolationEffectData struct {
Name string `valid:",1,100,trimspace"`
}
type AllCapsTrigger ¶ added in v1.7.0
type AllCapsTrigger struct{}
func (*AllCapsTrigger) CheckMessage ¶ added in v1.7.0
func (caps *AllCapsTrigger) CheckMessage(triggerCtx *TriggerContext, cs *dstate.ChannelState, m *discordgo.Message, mdStripped string) (bool, error)
func (*AllCapsTrigger) DataType ¶ added in v1.7.0
func (caps *AllCapsTrigger) DataType() interface{}
func (*AllCapsTrigger) Description ¶ added in v1.7.0
func (caps *AllCapsTrigger) Description() string
func (*AllCapsTrigger) Kind ¶ added in v1.7.0
func (caps *AllCapsTrigger) Kind() RulePartType
func (*AllCapsTrigger) MergeDuplicates ¶ added in v1.7.0
func (caps *AllCapsTrigger) MergeDuplicates(data []interface{}) interface{}
func (*AllCapsTrigger) Name ¶ added in v1.7.0
func (caps *AllCapsTrigger) Name() string
func (*AllCapsTrigger) UserSettings ¶ added in v1.7.0
func (caps *AllCapsTrigger) UserSettings() []*SettingDef
type AllCapsTriggerData ¶ added in v1.7.0
type AntiPhishingLinkTrigger ¶ added in v1.31.14
type AntiPhishingLinkTrigger struct{}
func (*AntiPhishingLinkTrigger) CheckMessage ¶ added in v1.31.14
func (a *AntiPhishingLinkTrigger) CheckMessage(triggerCtx *TriggerContext, cs *dstate.ChannelState, m *discordgo.Message, mdStripped string) (bool, error)
func (*AntiPhishingLinkTrigger) DataType ¶ added in v1.31.14
func (a *AntiPhishingLinkTrigger) DataType() interface{}
func (*AntiPhishingLinkTrigger) Description ¶ added in v1.31.14
func (a *AntiPhishingLinkTrigger) Description() string
func (*AntiPhishingLinkTrigger) Kind ¶ added in v1.31.14
func (a *AntiPhishingLinkTrigger) Kind() RulePartType
func (*AntiPhishingLinkTrigger) Name ¶ added in v1.31.14
func (a *AntiPhishingLinkTrigger) Name() string
func (*AntiPhishingLinkTrigger) UserSettings ¶ added in v1.31.14
func (a *AntiPhishingLinkTrigger) UserSettings() []*SettingDef
type AnyLinkTrigger ¶ added in v1.7.0
type AnyLinkTrigger struct{}
func (*AnyLinkTrigger) CheckMessage ¶ added in v1.7.0
func (alc *AnyLinkTrigger) CheckMessage(triggerCtx *TriggerContext, cs *dstate.ChannelState, m *discordgo.Message, mdStripped string) (bool, error)
func (*AnyLinkTrigger) DataType ¶ added in v1.7.0
func (alc *AnyLinkTrigger) DataType() interface{}
func (*AnyLinkTrigger) Description ¶ added in v1.7.0
func (alc *AnyLinkTrigger) Description() (description string)
func (*AnyLinkTrigger) Kind ¶ added in v1.7.0
func (alc *AnyLinkTrigger) Kind() RulePartType
func (*AnyLinkTrigger) MergeDuplicates ¶ added in v1.7.0
func (alc *AnyLinkTrigger) MergeDuplicates(data []interface{}) interface{}
func (*AnyLinkTrigger) Name ¶ added in v1.7.0
func (alc *AnyLinkTrigger) Name() (name string)
func (*AnyLinkTrigger) UserSettings ¶ added in v1.7.0
func (alc *AnyLinkTrigger) UserSettings() []*SettingDef
type BanUserEffect ¶ added in v1.7.0
type BanUserEffect struct{}
func (*BanUserEffect) Apply ¶ added in v1.7.0
func (ban *BanUserEffect) Apply(ctxData *TriggeredRuleData, settings interface{}) error
func (*BanUserEffect) DataType ¶ added in v1.7.0
func (ban *BanUserEffect) DataType() interface{}
func (*BanUserEffect) Description ¶ added in v1.7.0
func (ban *BanUserEffect) Description() (description string)
func (*BanUserEffect) Kind ¶ added in v1.7.0
func (ban *BanUserEffect) Kind() RulePartType
func (*BanUserEffect) MergeDuplicates ¶ added in v1.7.0
func (ban *BanUserEffect) MergeDuplicates(data []interface{}) interface{}
func (*BanUserEffect) Name ¶ added in v1.7.0
func (ban *BanUserEffect) Name() (name string)
func (*BanUserEffect) UserSettings ¶ added in v1.7.0
func (ban *BanUserEffect) UserSettings() []*SettingDef
type BanUserEffectData ¶ added in v1.8.0
type BaseRegexTrigger ¶ added in v1.7.0
type BaseRegexTrigger struct {
Inverse bool
}
func (BaseRegexTrigger) DataType ¶ added in v1.7.0
func (r BaseRegexTrigger) DataType() interface{}
func (BaseRegexTrigger) Kind ¶ added in v1.7.0
func (r BaseRegexTrigger) Kind() RulePartType
func (BaseRegexTrigger) UserSettings ¶ added in v1.7.0
func (r BaseRegexTrigger) UserSettings() []*SettingDef
type BaseRegexTriggerData ¶ added in v1.7.0
type BaseRegexTriggerData struct {
Regex string `valid:",1,250"`
}
type BotCondition ¶ added in v1.7.0
type BotCondition struct {
Ignore bool
}
func (*BotCondition) DataType ¶ added in v1.7.0
func (bc *BotCondition) DataType() interface{}
func (*BotCondition) Description ¶ added in v1.7.0
func (bc *BotCondition) Description() string
func (*BotCondition) IsMet ¶ added in v1.7.0
func (bc *BotCondition) IsMet(data *TriggeredRuleData, settings interface{}) (bool, error)
func (*BotCondition) Kind ¶ added in v1.7.0
func (bc *BotCondition) Kind() RulePartType
func (*BotCondition) MergeDuplicates ¶ added in v1.7.0
func (bc *BotCondition) MergeDuplicates(data []interface{}) interface{}
func (*BotCondition) Name ¶ added in v1.7.0
func (bc *BotCondition) Name() string
func (*BotCondition) UserSettings ¶ added in v1.7.0
func (bc *BotCondition) UserSettings() []*SettingDef
type ChannelCategoriesCondition ¶ added in v1.7.0
type ChannelCategoriesCondition struct {
Blacklist bool // if true, then blacklist mode, otherwise whitelist mode
}
func (*ChannelCategoriesCondition) DataType ¶ added in v1.7.0
func (cd *ChannelCategoriesCondition) DataType() interface{}
func (*ChannelCategoriesCondition) Description ¶ added in v1.7.0
func (cd *ChannelCategoriesCondition) Description() string
func (*ChannelCategoriesCondition) IsMet ¶ added in v1.7.0
func (cd *ChannelCategoriesCondition) IsMet(data *TriggeredRuleData, settings interface{}) (bool, error)
func (*ChannelCategoriesCondition) Kind ¶ added in v1.7.0
func (cd *ChannelCategoriesCondition) Kind() RulePartType
func (*ChannelCategoriesCondition) MergeDuplicates ¶ added in v1.7.0
func (cd *ChannelCategoriesCondition) MergeDuplicates(data []interface{}) interface{}
func (*ChannelCategoriesCondition) Name ¶ added in v1.7.0
func (cd *ChannelCategoriesCondition) Name() string
func (*ChannelCategoriesCondition) UserSettings ¶ added in v1.7.0
func (cd *ChannelCategoriesCondition) UserSettings() []*SettingDef
type ChannelCategoryConditionData ¶ added in v1.7.0
type ChannelCategoryConditionData struct {
Categories []int64
}
type ChannelsCondition ¶ added in v1.7.0
type ChannelsCondition struct {
Blacklist bool // if true, then blacklist mode, otherwise whitelist mode
}
func (*ChannelsCondition) DataType ¶ added in v1.7.0
func (cd *ChannelsCondition) DataType() interface{}
func (*ChannelsCondition) Description ¶ added in v1.7.0
func (cd *ChannelsCondition) Description() string
func (*ChannelsCondition) IsMet ¶ added in v1.7.0
func (cd *ChannelsCondition) IsMet(data *TriggeredRuleData, settings interface{}) (bool, error)
func (*ChannelsCondition) Kind ¶ added in v1.7.0
func (cd *ChannelsCondition) Kind() RulePartType
func (*ChannelsCondition) MergeDuplicates ¶ added in v1.7.0
func (cd *ChannelsCondition) MergeDuplicates(data []interface{}) interface{}
func (*ChannelsCondition) Name ¶ added in v1.7.0
func (cd *ChannelsCondition) Name() string
func (*ChannelsCondition) UserSettings ¶ added in v1.7.0
func (cd *ChannelsCondition) UserSettings() []*SettingDef
type ChannelsConditionData ¶ added in v1.7.0
type ChannelsConditionData struct {
Channels []int64
}
type Condition ¶
type Condition interface { RulePart // IsMet is called to check wether this condition is met or not IsMet(data *TriggeredRuleData, parsedSettings interface{}) (bool, error) }
type CreateListData ¶ added in v1.7.0
type CreateListData struct {
Name string `valid:",1,50"`
}
type CreateRuleData ¶ added in v1.7.0
type CreateRuleData struct {
Name string `valid:",1,50"`
}
type CreateRulesetData ¶ added in v1.7.0
type CreateRulesetData struct {
Name string `valid:",1,100"`
}
type DeleteMessageEffect ¶ added in v1.7.0
type DeleteMessageEffect struct{}
func (*DeleteMessageEffect) Apply ¶ added in v1.7.0
func (del *DeleteMessageEffect) Apply(ctxData *TriggeredRuleData, settings interface{}) error
func (*DeleteMessageEffect) DataType ¶ added in v1.7.0
func (del *DeleteMessageEffect) DataType() interface{}
func (*DeleteMessageEffect) Description ¶ added in v1.7.0
func (del *DeleteMessageEffect) Description() (description string)
func (*DeleteMessageEffect) Kind ¶ added in v1.7.0
func (del *DeleteMessageEffect) Kind() RulePartType
func (*DeleteMessageEffect) MergeDuplicates ¶ added in v1.7.0
func (del *DeleteMessageEffect) MergeDuplicates(data []interface{}) interface{}
func (*DeleteMessageEffect) Name ¶ added in v1.7.0
func (del *DeleteMessageEffect) Name() (name string)
func (*DeleteMessageEffect) UserSettings ¶ added in v1.7.0
func (del *DeleteMessageEffect) UserSettings() []*SettingDef
type DeleteMessagesEffect ¶ added in v1.13.3
type DeleteMessagesEffect struct{}
func (*DeleteMessagesEffect) Apply ¶ added in v1.13.3
func (del *DeleteMessagesEffect) Apply(ctxData *TriggeredRuleData, settings interface{}) error
func (*DeleteMessagesEffect) DataType ¶ added in v1.13.3
func (del *DeleteMessagesEffect) DataType() interface{}
func (*DeleteMessagesEffect) Description ¶ added in v1.13.3
func (del *DeleteMessagesEffect) Description() (description string)
func (*DeleteMessagesEffect) Kind ¶ added in v1.13.3
func (del *DeleteMessagesEffect) Kind() RulePartType
func (*DeleteMessagesEffect) MergeDuplicates ¶ added in v1.13.3
func (del *DeleteMessagesEffect) MergeDuplicates(data []interface{}) interface{}
func (*DeleteMessagesEffect) Name ¶ added in v1.13.3
func (del *DeleteMessagesEffect) Name() (name string)
func (*DeleteMessagesEffect) UserSettings ¶ added in v1.13.3
func (del *DeleteMessagesEffect) UserSettings() []*SettingDef
type DeleteMessagesEffectData ¶ added in v1.13.3
type DomainTrigger ¶ added in v1.7.0
type DomainTrigger struct {
Blacklist bool
}
func (*DomainTrigger) CheckMessage ¶ added in v1.7.0
func (dt *DomainTrigger) CheckMessage(triggerCtx *TriggerContext, cs *dstate.ChannelState, m *discordgo.Message, mdStripped string) (bool, error)
func (*DomainTrigger) DataType ¶ added in v1.7.0
func (dt *DomainTrigger) DataType() interface{}
func (*DomainTrigger) Description ¶ added in v1.7.0
func (dt *DomainTrigger) Description() (description string)
func (*DomainTrigger) Kind ¶ added in v1.7.0
func (dt *DomainTrigger) Kind() RulePartType
func (*DomainTrigger) Name ¶ added in v1.7.0
func (dt *DomainTrigger) Name() (name string)
func (*DomainTrigger) UserSettings ¶ added in v1.7.0
func (dt *DomainTrigger) UserSettings() []*SettingDef
type DomainTriggerData ¶ added in v1.7.0
type DomainTriggerData struct {
ListID int64
}
type Effect ¶ added in v1.7.0
type Effect interface {
Apply(ctxData *TriggeredRuleData, settings interface{}) error
}
type EnableChannelSlowmodeEffect ¶ added in v1.20.0
type EnableChannelSlowmodeEffect struct {
// contains filtered or unexported fields
}
func (*EnableChannelSlowmodeEffect) Apply ¶ added in v1.20.0
func (slow *EnableChannelSlowmodeEffect) Apply(ctxData *TriggeredRuleData, settings interface{}) error
func (*EnableChannelSlowmodeEffect) DataType ¶ added in v1.20.0
func (slow *EnableChannelSlowmodeEffect) DataType() interface{}
func (*EnableChannelSlowmodeEffect) Description ¶ added in v1.20.0
func (slow *EnableChannelSlowmodeEffect) Description() (description string)
func (*EnableChannelSlowmodeEffect) Kind ¶ added in v1.20.0
func (slow *EnableChannelSlowmodeEffect) Kind() RulePartType
func (*EnableChannelSlowmodeEffect) Name ¶ added in v1.20.0
func (slow *EnableChannelSlowmodeEffect) Name() (name string)
func (*EnableChannelSlowmodeEffect) UserSettings ¶ added in v1.20.0
func (slow *EnableChannelSlowmodeEffect) UserSettings() []*SettingDef
type EnableChannelSlowmodeEffectData ¶ added in v1.20.0
type ErrUnknownTypeID ¶ added in v1.7.0
type ErrUnknownTypeID struct {
TypeID int
}
func (*ErrUnknownTypeID) Error ¶ added in v1.7.0
func (e *ErrUnknownTypeID) Error() string
type GiveRoleEffect ¶ added in v1.16.0
type GiveRoleEffect struct{}
func (*GiveRoleEffect) Apply ¶ added in v1.16.0
func (gf *GiveRoleEffect) Apply(ctxData *TriggeredRuleData, settings interface{}) error
func (*GiveRoleEffect) DataType ¶ added in v1.16.0
func (gf *GiveRoleEffect) DataType() interface{}
func (*GiveRoleEffect) Description ¶ added in v1.16.0
func (gf *GiveRoleEffect) Description() (description string)
func (*GiveRoleEffect) Kind ¶ added in v1.16.0
func (gr *GiveRoleEffect) Kind() RulePartType
func (*GiveRoleEffect) Name ¶ added in v1.16.0
func (gf *GiveRoleEffect) Name() (name string)
func (*GiveRoleEffect) UserSettings ¶ added in v1.16.0
func (gf *GiveRoleEffect) UserSettings() []*SettingDef
type GiveRoleEffectData ¶ added in v1.16.0
type GoogleSafeBrowsingTrigger ¶ added in v1.7.0
type GoogleSafeBrowsingTrigger struct{}
func (*GoogleSafeBrowsingTrigger) CheckMessage ¶ added in v1.7.0
func (g *GoogleSafeBrowsingTrigger) CheckMessage(triggerCtx *TriggerContext, cs *dstate.ChannelState, m *discordgo.Message, mdStripped string) (bool, error)
func (*GoogleSafeBrowsingTrigger) DataType ¶ added in v1.7.0
func (g *GoogleSafeBrowsingTrigger) DataType() interface{}
func (*GoogleSafeBrowsingTrigger) Description ¶ added in v1.7.0
func (g *GoogleSafeBrowsingTrigger) Description() string
func (*GoogleSafeBrowsingTrigger) Kind ¶ added in v1.7.0
func (g *GoogleSafeBrowsingTrigger) Kind() RulePartType
func (*GoogleSafeBrowsingTrigger) MergeDuplicates ¶ added in v1.7.0
func (g *GoogleSafeBrowsingTrigger) MergeDuplicates(data []interface{}) interface{}
func (*GoogleSafeBrowsingTrigger) Name ¶ added in v1.7.0
func (g *GoogleSafeBrowsingTrigger) Name() string
func (*GoogleSafeBrowsingTrigger) UserSettings ¶ added in v1.7.0
func (g *GoogleSafeBrowsingTrigger) UserSettings() []*SettingDef
type JoinListener ¶ added in v1.11.6
type JoinListener interface { RulePart CheckJoin(triggerCtx *TriggerContext) (isAffected bool, err error) }
JoinListener is triggers that does stuff when members joins
type KickUserEffect ¶ added in v1.7.0
type KickUserEffect struct{}
func (*KickUserEffect) Apply ¶ added in v1.7.0
func (kick *KickUserEffect) Apply(ctxData *TriggeredRuleData, settings interface{}) error
func (*KickUserEffect) DataType ¶ added in v1.7.0
func (kick *KickUserEffect) DataType() interface{}
func (*KickUserEffect) Description ¶ added in v1.7.0
func (kick *KickUserEffect) Description() (description string)
func (*KickUserEffect) Kind ¶ added in v1.7.0
func (kick *KickUserEffect) Kind() RulePartType
func (*KickUserEffect) MergeDuplicates ¶ added in v1.7.0
func (kick *KickUserEffect) MergeDuplicates(data []interface{}) interface{}
func (*KickUserEffect) Name ¶ added in v1.7.0
func (kick *KickUserEffect) Name() (name string)
func (*KickUserEffect) UserSettings ¶ added in v1.7.0
func (kick *KickUserEffect) UserSettings() []*SettingDef
type KickUserEffectData ¶ added in v1.8.0
type KickUserEffectData struct {
CustomReason string `valid:",0,150,trimspace"`
}
type MemberAgeConditionData ¶ added in v1.7.0
type MemberAgeConditionData struct {
Treshold int
}
type MemberAgecondition ¶ added in v1.7.0
type MemberAgecondition struct {
Below bool // if true, then blacklist mode, otherwise whitelist mode
}
func (*MemberAgecondition) DataType ¶ added in v1.7.0
func (mc *MemberAgecondition) DataType() interface{}
func (*MemberAgecondition) Description ¶ added in v1.7.0
func (mc *MemberAgecondition) Description() string
func (*MemberAgecondition) IsMet ¶ added in v1.7.0
func (mc *MemberAgecondition) IsMet(data *TriggeredRuleData, settings interface{}) (bool, error)
func (*MemberAgecondition) Kind ¶ added in v1.7.0
func (mc *MemberAgecondition) Kind() RulePartType
func (*MemberAgecondition) MergeDuplicates ¶ added in v1.7.0
func (mc *MemberAgecondition) MergeDuplicates(data []interface{}) interface{}
func (*MemberAgecondition) Name ¶ added in v1.7.0
func (mc *MemberAgecondition) Name() string
func (*MemberAgecondition) UserSettings ¶ added in v1.7.0
func (mc *MemberAgecondition) UserSettings() []*SettingDef
type MemberJoinTrigger ¶ added in v1.11.6
type MemberJoinTrigger struct { }
func (*MemberJoinTrigger) CheckJoin ¶ added in v1.11.6
func (mj *MemberJoinTrigger) CheckJoin(t *TriggerContext) (isAffected bool, err error)
func (*MemberJoinTrigger) DataType ¶ added in v1.11.6
func (mj *MemberJoinTrigger) DataType() interface{}
func (*MemberJoinTrigger) Description ¶ added in v1.11.6
func (mj *MemberJoinTrigger) Description() (description string)
func (*MemberJoinTrigger) Kind ¶ added in v1.11.6
func (mj *MemberJoinTrigger) Kind() RulePartType
func (*MemberJoinTrigger) Name ¶ added in v1.11.6
func (mj *MemberJoinTrigger) Name() (name string)
func (*MemberJoinTrigger) UserSettings ¶ added in v1.11.6
func (mj *MemberJoinTrigger) UserSettings() []*SettingDef
type MemberRolesCondition ¶ added in v1.7.0
type MemberRolesCondition struct {
Blacklist bool // if true, then blacklist mode, otherwise whitelist mode
}
func (*MemberRolesCondition) DataType ¶ added in v1.7.0
func (mrc *MemberRolesCondition) DataType() interface{}
func (*MemberRolesCondition) Description ¶ added in v1.7.0
func (mrc *MemberRolesCondition) Description() string
func (*MemberRolesCondition) IsMet ¶ added in v1.7.0
func (mrc *MemberRolesCondition) IsMet(data *TriggeredRuleData, settings interface{}) (bool, error)
func (*MemberRolesCondition) Kind ¶ added in v1.7.0
func (mrc *MemberRolesCondition) Kind() RulePartType
func (*MemberRolesCondition) MergeDuplicates ¶ added in v1.7.0
func (mrc *MemberRolesCondition) MergeDuplicates(data []interface{}) interface{}
func (*MemberRolesCondition) Name ¶ added in v1.7.0
func (mrc *MemberRolesCondition) Name() string
func (*MemberRolesCondition) UserSettings ¶ added in v1.7.0
func (mrc *MemberRolesCondition) UserSettings() []*SettingDef
type MemberRolesConditionData ¶ added in v1.7.0
type MemberRolesConditionData struct {
Roles []int64
}
type MentionsTrigger ¶ added in v1.7.0
type MentionsTrigger struct{}
func (*MentionsTrigger) CheckMessage ¶ added in v1.7.0
func (mc *MentionsTrigger) CheckMessage(triggerCtx *TriggerContext, cs *dstate.ChannelState, m *discordgo.Message, mdStripped string) (bool, error)
func (*MentionsTrigger) DataType ¶ added in v1.7.0
func (mc *MentionsTrigger) DataType() interface{}
func (*MentionsTrigger) Description ¶ added in v1.7.0
func (mc *MentionsTrigger) Description() string
func (*MentionsTrigger) Kind ¶ added in v1.7.0
func (mc *MentionsTrigger) Kind() RulePartType
func (*MentionsTrigger) MergeDuplicates ¶ added in v1.7.0
func (mc *MentionsTrigger) MergeDuplicates(data []interface{}) interface{}
func (*MentionsTrigger) Name ¶ added in v1.7.0
func (mc *MentionsTrigger) Name() string
func (*MentionsTrigger) UserSettings ¶ added in v1.7.0
func (mc *MentionsTrigger) UserSettings() []*SettingDef
type MentionsTriggerData ¶ added in v1.7.0
type MentionsTriggerData struct {
Treshold int
}
type MergeableRulePart ¶ added in v1.7.0
type MergeableRulePart interface {
MergeDuplicates(data []interface{}) interface{}
}
type MessageAttachmentTrigger ¶ added in v1.13.0
type MessageAttachmentTrigger struct {
RequiresAttachment bool
}
func (*MessageAttachmentTrigger) CheckMessage ¶ added in v1.13.0
func (mat *MessageAttachmentTrigger) CheckMessage(triggerCtx *TriggerContext, cs *dstate.ChannelState, m *discordgo.Message, mdStripped string) (bool, error)
func (*MessageAttachmentTrigger) DataType ¶ added in v1.13.0
func (mat *MessageAttachmentTrigger) DataType() interface{}
func (*MessageAttachmentTrigger) Description ¶ added in v1.13.0
func (mat *MessageAttachmentTrigger) Description() string
func (*MessageAttachmentTrigger) Kind ¶ added in v1.13.0
func (mat *MessageAttachmentTrigger) Kind() RulePartType
func (*MessageAttachmentTrigger) MergeDuplicates ¶ added in v1.13.0
func (mat *MessageAttachmentTrigger) MergeDuplicates(data []interface{}) interface{}
func (*MessageAttachmentTrigger) Name ¶ added in v1.13.0
func (mat *MessageAttachmentTrigger) Name() string
func (*MessageAttachmentTrigger) UserSettings ¶ added in v1.13.0
func (mat *MessageAttachmentTrigger) UserSettings() []*SettingDef
type MessageEditedCondition ¶ added in v1.12.0
type MessageEditedCondition struct {
NewMessage bool // if true, then blacklist mode, otherwise whitelist mode
}
func (*MessageEditedCondition) DataType ¶ added in v1.12.0
func (mc *MessageEditedCondition) DataType() interface{}
func (*MessageEditedCondition) Description ¶ added in v1.12.0
func (mc *MessageEditedCondition) Description() string
func (*MessageEditedCondition) IsMet ¶ added in v1.12.0
func (mc *MessageEditedCondition) IsMet(data *TriggeredRuleData, settings interface{}) (bool, error)
func (*MessageEditedCondition) Kind ¶ added in v1.12.0
func (mc *MessageEditedCondition) Kind() RulePartType
func (*MessageEditedCondition) MergeDuplicates ¶ added in v1.12.0
func (mc *MessageEditedCondition) MergeDuplicates(data []interface{}) interface{}
func (*MessageEditedCondition) Name ¶ added in v1.12.0
func (mc *MessageEditedCondition) Name() string
func (*MessageEditedCondition) UserSettings ¶ added in v1.12.0
func (mc *MessageEditedCondition) UserSettings() []*SettingDef
type MessageRegexTrigger ¶ added in v1.7.0
type MessageRegexTrigger struct {
BaseRegexTrigger
}
func (*MessageRegexTrigger) CheckMessage ¶ added in v1.7.0
func (r *MessageRegexTrigger) CheckMessage(triggerCtx *TriggerContext, cs *dstate.ChannelState, m *discordgo.Message, mdStripped string) (bool, error)
func (*MessageRegexTrigger) Description ¶ added in v1.7.0
func (r *MessageRegexTrigger) Description() string
func (*MessageRegexTrigger) Name ¶ added in v1.7.0
func (r *MessageRegexTrigger) Name() string
type MessageTrigger ¶ added in v1.7.0
type MessageTrigger interface { RulePart CheckMessage(triggerCtx *TriggerContext, cs *dstate.ChannelState, m *discordgo.Message, mdStripped string) (isAffected bool, err error) }
MessageCondition is a active condition that needs to run on a message
type MultiMsgMentionTrigger ¶ added in v1.7.0
type MultiMsgMentionTrigger struct {
ChannelBased bool
}
func (*MultiMsgMentionTrigger) CheckMessage ¶ added in v1.7.0
func (mt *MultiMsgMentionTrigger) CheckMessage(triggerCtx *TriggerContext, cs *dstate.ChannelState, m *discordgo.Message, mdStripped string) (bool, error)
func (*MultiMsgMentionTrigger) DataType ¶ added in v1.7.0
func (mt *MultiMsgMentionTrigger) DataType() interface{}
func (*MultiMsgMentionTrigger) Description ¶ added in v1.7.0
func (mt *MultiMsgMentionTrigger) Description() string
func (*MultiMsgMentionTrigger) Kind ¶ added in v1.7.0
func (mt *MultiMsgMentionTrigger) Kind() RulePartType
func (*MultiMsgMentionTrigger) MergeDuplicates ¶ added in v1.7.0
func (mt *MultiMsgMentionTrigger) MergeDuplicates(data []interface{}) interface{}
func (*MultiMsgMentionTrigger) Name ¶ added in v1.7.0
func (mt *MultiMsgMentionTrigger) Name() string
func (*MultiMsgMentionTrigger) UserSettings ¶ added in v1.7.0
func (mt *MultiMsgMentionTrigger) UserSettings() []*SettingDef
type MultiMsgMentionTriggerData ¶ added in v1.7.0
type MuteUserEffect ¶ added in v1.7.0
type MuteUserEffect struct{}
func (*MuteUserEffect) Apply ¶ added in v1.7.0
func (mute *MuteUserEffect) Apply(ctxData *TriggeredRuleData, settings interface{}) error
func (*MuteUserEffect) DataType ¶ added in v1.7.0
func (mute *MuteUserEffect) DataType() interface{}
func (*MuteUserEffect) Description ¶ added in v1.7.0
func (mute *MuteUserEffect) Description() (description string)
func (*MuteUserEffect) Kind ¶ added in v1.7.0
func (mute *MuteUserEffect) Kind() RulePartType
func (*MuteUserEffect) MergeDuplicates ¶ added in v1.7.0
func (mute *MuteUserEffect) MergeDuplicates(data []interface{}) interface{}
func (*MuteUserEffect) Name ¶ added in v1.7.0
func (mute *MuteUserEffect) Name() (name string)
func (*MuteUserEffect) UserSettings ¶ added in v1.7.0
func (mute *MuteUserEffect) UserSettings() []*SettingDef
type MuteUserEffectData ¶ added in v1.7.0
type NicknameListener ¶ added in v1.7.0
type NicknameListener interface { RulePart CheckNickname(triggerCtx *TriggerContext) (isAffected bool, err error) }
NicknameListener is a trigger that gets triggered on a nickname change
type NicknameRegexTrigger ¶ added in v1.7.0
type NicknameRegexTrigger struct {
BaseRegexTrigger
}
func (*NicknameRegexTrigger) CheckNickname ¶ added in v1.7.0
func (r *NicknameRegexTrigger) CheckNickname(t *TriggerContext) (bool, error)
func (*NicknameRegexTrigger) Description ¶ added in v1.7.0
func (r *NicknameRegexTrigger) Description() string
func (*NicknameRegexTrigger) Name ¶ added in v1.7.0
func (r *NicknameRegexTrigger) Name() string
type NicknameWordlistTrigger ¶ added in v1.7.0
type NicknameWordlistTrigger struct {
Blacklist bool
}
func (*NicknameWordlistTrigger) CheckNickname ¶ added in v1.7.0
func (nwl *NicknameWordlistTrigger) CheckNickname(t *TriggerContext) (bool, error)
func (*NicknameWordlistTrigger) DataType ¶ added in v1.7.0
func (nwl *NicknameWordlistTrigger) DataType() interface{}
func (*NicknameWordlistTrigger) Description ¶ added in v1.7.0
func (nwl *NicknameWordlistTrigger) Description() (description string)
func (*NicknameWordlistTrigger) Kind ¶ added in v1.7.0
func (nwl *NicknameWordlistTrigger) Kind() RulePartType
func (*NicknameWordlistTrigger) Name ¶ added in v1.7.0
func (nwl *NicknameWordlistTrigger) Name() (name string)
func (*NicknameWordlistTrigger) UserSettings ¶ added in v1.7.0
func (nwl *NicknameWordlistTrigger) UserSettings() []*SettingDef
type NicknameWordlistTriggerData ¶ added in v1.7.0
type NicknameWordlistTriggerData struct {
ListID int64
}
type ParsedPart ¶ added in v1.7.0
type ParsedPart struct { // Parts are either children directly of the ruleset, ad ruleset conditions or as children of individual rules ParentRule *ParsedRule ParentRS *ParsedRuleset RuleModel *models.AutomodRuleDatum RSConditionModel *models.AutomodRulesetCondition Part RulePart ParsedSettings interface{} }
type ParsedRule ¶ added in v1.7.0
type ParsedRule struct { Model *models.AutomodRule Triggers []*ParsedPart Conditions []*ParsedPart Effects []*ParsedPart }
func ParseRuleData ¶ added in v1.7.0
func ParseRuleData(rule *models.AutomodRule) (*ParsedRule, error)
type ParsedRuleset ¶ added in v1.7.0
type ParsedRuleset struct { RSModel *models.AutomodRuleset ParsedConditions []*ParsedPart Rules []*ParsedRule }
func ParseRuleset ¶ added in v1.7.0
func ParseRuleset(rs *models.AutomodRuleset) (*ParsedRuleset, error)
type Plugin ¶
type Plugin struct { }
func (*Plugin) AddCommands ¶ added in v1.7.0
func (p *Plugin) AddCommands()
func (*Plugin) AllFeatureFlags ¶ added in v1.31.10
func (*Plugin) CheckConditions ¶ added in v1.7.0
func (p *Plugin) CheckConditions(ctxData *TriggeredRuleData, conditions []*ParsedPart) bool
func (*Plugin) CheckTriggers ¶ added in v1.7.0
func (p *Plugin) CheckTriggers(rulesets []*ParsedRuleset, gs *dstate.GuildSet, ms *dstate.MemberState, msg *discordgo.Message, cs *dstate.ChannelState, checkF func(trp *ParsedPart) (activated bool, err error)) bool
func (*Plugin) FetchGuildRulesets ¶ added in v1.7.0
func (p *Plugin) FetchGuildRulesets(guildID int64) ([]*ParsedRuleset, error)
func (*Plugin) LoadServerHomeWidget ¶ added in v1.17.0
func (p *Plugin) LoadServerHomeWidget(w http.ResponseWriter, r *http.Request) (web.TemplateData, error)
func (*Plugin) PluginInfo ¶ added in v1.17.0
func (p *Plugin) PluginInfo() *common.PluginInfo
func (*Plugin) RulesetRulesTriggered ¶ added in v1.7.0
func (p *Plugin) RulesetRulesTriggered(ctxData *TriggeredRuleData, checkedConditions bool)
func (*Plugin) RulesetRulesTriggeredCondsPassed ¶ added in v1.7.0
func (p *Plugin) RulesetRulesTriggeredCondsPassed(ruleset *ParsedRuleset, triggeredRules []*ParsedRule, ctxData *TriggeredRuleData)
type RemoveRoleEffect ¶ added in v1.31.10
type RemoveRoleEffect struct{}
func (*RemoveRoleEffect) Apply ¶ added in v1.31.10
func (rf *RemoveRoleEffect) Apply(ctxData *TriggeredRuleData, settings interface{}) error
func (*RemoveRoleEffect) DataType ¶ added in v1.31.10
func (rf *RemoveRoleEffect) DataType() interface{}
func (*RemoveRoleEffect) Description ¶ added in v1.31.10
func (rf *RemoveRoleEffect) Description() (description string)
func (*RemoveRoleEffect) Kind ¶ added in v1.31.10
func (rr *RemoveRoleEffect) Kind() RulePartType
func (*RemoveRoleEffect) Name ¶ added in v1.31.10
func (rf *RemoveRoleEffect) Name() (name string)
func (*RemoveRoleEffect) UserSettings ¶ added in v1.31.10
func (rf *RemoveRoleEffect) UserSettings() []*SettingDef
type RemoveRoleEffectData ¶ added in v1.31.10
type ResetChannelRatelimitData ¶ added in v1.20.0
type ResetChannelRatelimitData struct {
ChannelID int64
}
type ResetViolationsEffect ¶ added in v1.13.3
type ResetViolationsEffect struct{}
func (*ResetViolationsEffect) Apply ¶ added in v1.13.3
func (rv *ResetViolationsEffect) Apply(ctxData *TriggeredRuleData, settings interface{}) error
func (*ResetViolationsEffect) DataType ¶ added in v1.13.3
func (rv *ResetViolationsEffect) DataType() interface{}
func (*ResetViolationsEffect) Description ¶ added in v1.13.3
func (rv *ResetViolationsEffect) Description() (description string)
func (*ResetViolationsEffect) Kind ¶ added in v1.13.3
func (rv *ResetViolationsEffect) Kind() RulePartType
func (*ResetViolationsEffect) Name ¶ added in v1.13.3
func (rv *ResetViolationsEffect) Name() (name string)
func (*ResetViolationsEffect) UserSettings ¶ added in v1.13.3
func (rv *ResetViolationsEffect) UserSettings() []*SettingDef
type ResetViolationsEffectData ¶ added in v1.13.3
type ResetViolationsEffectData struct {
Name string `valid:",0,50,trimspace"`
}
type RulePart ¶ added in v1.7.0
type RulePart interface { // Datatype needs to return a new object to unmarshal the settings into, if there is none for this rule data entry then return nil DataType() interface{} // Returns the available user settings that can be changed (such as roles) UserSettings() []*SettingDef // Returns a human readble name for this rule data entry and a description Name() string Description() string Kind() RulePartType }
RulePart represents a single condition, trigger or effect
type RulePartPair ¶ added in v1.7.0
type RulePartType ¶ added in v1.7.0
type RulePartType int
const ( RulePartTrigger RulePartType = 0 RulePartCondition RulePartType = 1 RulePartEffect RulePartType = 2 )
type RuleRowData ¶ added in v1.7.0
type ServerInviteTrigger ¶ added in v1.7.0
type ServerInviteTrigger struct{}
func (*ServerInviteTrigger) CheckMessage ¶ added in v1.7.0
func (inv *ServerInviteTrigger) CheckMessage(triggerCtx *TriggerContext, cs *dstate.ChannelState, m *discordgo.Message, mdStripped string) (bool, error)
func (*ServerInviteTrigger) DataType ¶ added in v1.7.0
func (inv *ServerInviteTrigger) DataType() interface{}
func (*ServerInviteTrigger) Description ¶ added in v1.7.0
func (inv *ServerInviteTrigger) Description() string
func (*ServerInviteTrigger) Kind ¶ added in v1.7.0
func (inv *ServerInviteTrigger) Kind() RulePartType
func (*ServerInviteTrigger) MergeDuplicates ¶ added in v1.7.0
func (inv *ServerInviteTrigger) MergeDuplicates(data []interface{}) interface{}
func (*ServerInviteTrigger) Name ¶ added in v1.7.0
func (inv *ServerInviteTrigger) Name() string
func (*ServerInviteTrigger) UserSettings ¶ added in v1.7.0
func (inv *ServerInviteTrigger) UserSettings() []*SettingDef
type SetNicknameEffect ¶ added in v1.7.0
type SetNicknameEffect struct{}
func (*SetNicknameEffect) Apply ¶ added in v1.7.0
func (sn *SetNicknameEffect) Apply(ctxData *TriggeredRuleData, settings interface{}) error
func (*SetNicknameEffect) DataType ¶ added in v1.7.0
func (sn *SetNicknameEffect) DataType() interface{}
func (*SetNicknameEffect) Description ¶ added in v1.7.0
func (sn *SetNicknameEffect) Description() (description string)
func (*SetNicknameEffect) Kind ¶ added in v1.7.0
func (sn *SetNicknameEffect) Kind() RulePartType
func (*SetNicknameEffect) MergeDuplicates ¶ added in v1.7.0
func (sn *SetNicknameEffect) MergeDuplicates(data []interface{}) interface{}
func (*SetNicknameEffect) Name ¶ added in v1.7.0
func (sn *SetNicknameEffect) Name() (name string)
func (*SetNicknameEffect) UserSettings ¶ added in v1.7.0
func (sn *SetNicknameEffect) UserSettings() []*SettingDef
type SetNicknameEffectData ¶ added in v1.7.0
type SetNicknameEffectData struct {
NewName string `valid:",0,32,trimspace"`
}
type SettingDef ¶ added in v1.7.0
type SettingDef struct { Name string Key string Kind SettingType Min, Max int Default interface{} `json:",omitempty"` }
type SettingType ¶ added in v1.7.0
type SettingType string
type SlowmodeTrigger ¶ added in v1.7.0
type SlowmodeTrigger struct { ChannelBased bool Attachments bool // whether this trigger checks any messages or just attachments }
func (*SlowmodeTrigger) CheckMessage ¶ added in v1.7.0
func (s *SlowmodeTrigger) CheckMessage(triggerCtx *TriggerContext, cs *dstate.ChannelState, m *discordgo.Message, mdStripped string) (bool, error)
func (*SlowmodeTrigger) DataType ¶ added in v1.7.0
func (s *SlowmodeTrigger) DataType() interface{}
func (*SlowmodeTrigger) Description ¶ added in v1.7.0
func (s *SlowmodeTrigger) Description() string
func (*SlowmodeTrigger) Kind ¶ added in v1.7.0
func (s *SlowmodeTrigger) Kind() RulePartType
func (*SlowmodeTrigger) MergeDuplicates ¶ added in v1.7.0
func (s *SlowmodeTrigger) MergeDuplicates(data []interface{}) interface{}
func (*SlowmodeTrigger) Name ¶ added in v1.7.0
func (s *SlowmodeTrigger) Name() string
func (*SlowmodeTrigger) UserSettings ¶ added in v1.7.0
func (s *SlowmodeTrigger) UserSettings() []*SettingDef
type SlowmodeTriggerData ¶ added in v1.7.0
type SpamTrigger ¶ added in v1.7.0
type SpamTrigger struct{}
func (*SpamTrigger) CheckMessage ¶ added in v1.7.0
func (spam *SpamTrigger) CheckMessage(triggerCtx *TriggerContext, cs *dstate.ChannelState, m *discordgo.Message, mdStripped string) (bool, error)
func (*SpamTrigger) DataType ¶ added in v1.7.0
func (spam *SpamTrigger) DataType() interface{}
func (*SpamTrigger) Description ¶ added in v1.7.0
func (spam *SpamTrigger) Description() string
func (*SpamTrigger) Kind ¶ added in v1.7.0
func (spam *SpamTrigger) Kind() RulePartType
func (*SpamTrigger) Name ¶ added in v1.7.0
func (spam *SpamTrigger) Name() string
func (*SpamTrigger) UserSettings ¶ added in v1.7.0
func (spam *SpamTrigger) UserSettings() []*SettingDef
type SpamTriggerData ¶ added in v1.7.0
type TriggerContext ¶ added in v1.31.10
type TriggerContext struct { GS *dstate.GuildSet MS *dstate.MemberState Data interface{} }
type TriggeredRuleData ¶ added in v1.7.0
type TriggeredRuleData struct { // Should always be available Plugin *Plugin GS *dstate.GuildSet MS *dstate.MemberState Ruleset *ParsedRuleset // not present when checking rs conditions CurrentRule *ParsedRule // not present when checking conditions TriggeredRules []*ParsedRule ActivatedTriggers []*ParsedPart // Optional data that may not be present CS *dstate.ChannelState Message *discordgo.Message StrippedMessageContent string // message content stripped of markdown RecursionCounter int // Gets added to when we recurse using +violation PreviousReasons []string }
func (*TriggeredRuleData) Clone ¶ added in v1.7.0
func (t *TriggeredRuleData) Clone() *TriggeredRuleData
func (*TriggeredRuleData) ConstructReason ¶ added in v1.7.0
func (t *TriggeredRuleData) ConstructReason(includePrevious bool) string
type UpdateListData ¶ added in v1.7.0
type UpdateRuleData ¶ added in v1.7.0
type UpdateRuleData struct { Name string `valid:",1,50"` Triggers []RuleRowData Conditions []RuleRowData Effects []RuleRowData }
type UpdateRulesetData ¶ added in v1.7.0
type UpdateRulesetData struct { Name string `valid:",1,50"` Enabled bool Conditions []RuleRowData }
type UsernameInviteTrigger ¶ added in v1.9.0
type UsernameInviteTrigger struct { }
func (*UsernameInviteTrigger) CheckUsername ¶ added in v1.9.0
func (uv *UsernameInviteTrigger) CheckUsername(t *TriggerContext) (bool, error)
func (*UsernameInviteTrigger) DataType ¶ added in v1.9.0
func (uv *UsernameInviteTrigger) DataType() interface{}
func (*UsernameInviteTrigger) Description ¶ added in v1.9.0
func (uv *UsernameInviteTrigger) Description() (description string)
func (*UsernameInviteTrigger) Kind ¶ added in v1.9.0
func (uv *UsernameInviteTrigger) Kind() RulePartType
func (*UsernameInviteTrigger) Name ¶ added in v1.9.0
func (uv *UsernameInviteTrigger) Name() (name string)
func (*UsernameInviteTrigger) UserSettings ¶ added in v1.9.0
func (uv *UsernameInviteTrigger) UserSettings() []*SettingDef
type UsernameListener ¶ added in v1.9.0
type UsernameListener interface { RulePart CheckUsername(triggerCtx *TriggerContext) (isAffected bool, err error) }
UsernameListener is a trigger that gets triggered on a nickname change
type UsernameRegexTrigger ¶ added in v1.9.0
type UsernameRegexTrigger struct {
BaseRegexTrigger
}
func (*UsernameRegexTrigger) CheckUsername ¶ added in v1.9.0
func (r *UsernameRegexTrigger) CheckUsername(t *TriggerContext) (bool, error)
func (*UsernameRegexTrigger) Description ¶ added in v1.9.0
func (r *UsernameRegexTrigger) Description() string
func (*UsernameRegexTrigger) Name ¶ added in v1.9.0
func (r *UsernameRegexTrigger) Name() string
type UsernameWordlistTrigger ¶ added in v1.9.0
type UsernameWordlistTrigger struct {
Blacklist bool
}
func (*UsernameWordlistTrigger) CheckUsername ¶ added in v1.9.0
func (uwl *UsernameWordlistTrigger) CheckUsername(t *TriggerContext) (bool, error)
func (*UsernameWordlistTrigger) DataType ¶ added in v1.9.0
func (uwl *UsernameWordlistTrigger) DataType() interface{}
func (*UsernameWordlistTrigger) Description ¶ added in v1.9.0
func (uwl *UsernameWordlistTrigger) Description() (description string)
func (*UsernameWordlistTrigger) Kind ¶ added in v1.9.0
func (uwl *UsernameWordlistTrigger) Kind() RulePartType
func (*UsernameWordlistTrigger) Name ¶ added in v1.9.0
func (uwl *UsernameWordlistTrigger) Name() (name string)
func (*UsernameWordlistTrigger) UserSettings ¶ added in v1.9.0
func (uwl *UsernameWordlistTrigger) UserSettings() []*SettingDef
type UsernameWorldlistData ¶ added in v1.9.0
type UsernameWorldlistData struct {
ListID int64
}
type ViolationListener ¶ added in v1.7.0
type ViolationListener interface { RulePart CheckUser(ctxData *TriggeredRuleData, violations []*models.AutomodViolation, data interface{}, triggeredOnHigher bool) (isAffected bool, err error) }
ViolationListener is a trigger that gets triggered on a violation
type ViolationsTrigger ¶ added in v1.7.0
type ViolationsTrigger struct{}
func (*ViolationsTrigger) CheckUser ¶ added in v1.7.0
func (vt *ViolationsTrigger) CheckUser(ctxData *TriggeredRuleData, violations []*models.AutomodViolation, settings interface{}, triggeredOnHigher bool) (isAffected bool, err error)
func (*ViolationsTrigger) DataType ¶ added in v1.7.0
func (vt *ViolationsTrigger) DataType() interface{}
func (*ViolationsTrigger) Description ¶ added in v1.7.0
func (vt *ViolationsTrigger) Description() string
func (*ViolationsTrigger) Kind ¶ added in v1.7.0
func (vt *ViolationsTrigger) Kind() RulePartType
func (*ViolationsTrigger) Name ¶ added in v1.7.0
func (vt *ViolationsTrigger) Name() string
func (*ViolationsTrigger) UserSettings ¶ added in v1.7.0
func (vt *ViolationsTrigger) UserSettings() []*SettingDef
type ViolationsTriggerData ¶ added in v1.7.0
type WarnUserEffect ¶ added in v1.7.0
type WarnUserEffect struct{}
func (*WarnUserEffect) Apply ¶ added in v1.7.0
func (warn *WarnUserEffect) Apply(ctxData *TriggeredRuleData, settings interface{}) error
func (*WarnUserEffect) DataType ¶ added in v1.7.0
func (warn *WarnUserEffect) DataType() interface{}
func (*WarnUserEffect) Description ¶ added in v1.7.0
func (warn *WarnUserEffect) Description() (description string)
func (*WarnUserEffect) Kind ¶ added in v1.7.0
func (warn *WarnUserEffect) Kind() RulePartType
func (*WarnUserEffect) MergeDuplicates ¶ added in v1.7.0
func (warn *WarnUserEffect) MergeDuplicates(data []interface{}) interface{}
func (*WarnUserEffect) Name ¶ added in v1.7.0
func (warn *WarnUserEffect) Name() (name string)
func (*WarnUserEffect) UserSettings ¶ added in v1.7.0
func (warn *WarnUserEffect) UserSettings() []*SettingDef
type WarnUserEffectData ¶ added in v1.8.0
type WarnUserEffectData struct {
CustomReason string `valid:",0,150,trimspace"`
}
type WordListTrigger ¶ added in v1.7.0
type WordListTrigger struct {
Blacklist bool
}
func (*WordListTrigger) CheckMessage ¶ added in v1.7.0
func (wl *WordListTrigger) CheckMessage(triggerCtx *TriggerContext, cs *dstate.ChannelState, m *discordgo.Message, mdStripped string) (bool, error)
func (*WordListTrigger) DataType ¶ added in v1.7.0
func (wl *WordListTrigger) DataType() interface{}
func (*WordListTrigger) Description ¶ added in v1.7.0
func (wl *WordListTrigger) Description() (description string)
func (*WordListTrigger) Kind ¶ added in v1.7.0
func (wl *WordListTrigger) Kind() RulePartType
func (*WordListTrigger) Name ¶ added in v1.7.0
func (wl *WordListTrigger) Name() (name string)
func (*WordListTrigger) UserSettings ¶ added in v1.7.0
func (wl *WordListTrigger) UserSettings() []*SettingDef
type WorldListTriggerData ¶ added in v1.7.0
type WorldListTriggerData struct {
ListID int64
}
Source Files ¶
Click to show internal directories.
Click to hide internal directories.