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 AutomodExecution
- func (am *AutomodExecution) CheckRuleID(triggerCtx *TriggerContext, ruleID int64) (bool, error)
- func (am *AutomodExecution) DataType() interface{}
- func (am *AutomodExecution) Description() (description string)
- func (am *AutomodExecution) Kind() RulePartType
- func (am *AutomodExecution) Name() (name string)
- func (am *AutomodExecution) UserSettings() []*SettingDef
- type AutomodExecutionData
- type AutomodListener
- 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 MessageLengthTrigger
- func (ml *MessageLengthTrigger) CheckMessage(triggerCtx *TriggerContext, cs *dstate.ChannelState, m *discordgo.Message, ...) (bool, error)
- func (ml *MessageLengthTrigger) DataType() interface{}
- func (ml *MessageLengthTrigger) Description() (description string)
- func (ml *MessageLengthTrigger) Kind() RulePartType
- func (ml *MessageLengthTrigger) Name() (name string)
- func (ml *MessageLengthTrigger) UserSettings() []*SettingDef
- type MessageLengthTriggerData
- 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 SendChannelMessageEffect
- func (send *SendChannelMessageEffect) Apply(ctxData *TriggeredRuleData, settings interface{}) error
- func (send *SendChannelMessageEffect) DataType() interface{}
- func (send *SendChannelMessageEffect) Description() (description string)
- func (send *SendChannelMessageEffect) Kind() RulePartType
- func (send *SendChannelMessageEffect) MergeDuplicates(data []interface{}) interface{}
- func (send *SendChannelMessageEffect) Name() (name string)
- func (send *SendChannelMessageEffect) UserSettings() []*SettingDef
- type SendChannelMessageEffectData
- 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 ThreadCondition
- func (bc *ThreadCondition) DataType() interface{}
- func (bc *ThreadCondition) Description() string
- func (bc *ThreadCondition) IsMet(data *TriggeredRuleData, settings interface{}) (bool, error)
- func (bc *ThreadCondition) Kind() RulePartType
- func (bc *ThreadCondition) MergeDuplicates(data []interface{}) interface{}
- func (bc *ThreadCondition) Name() string
- func (bc *ThreadCondition) UserSettings() []*SettingDef
- type TimeoutUserEffect
- func (timeout *TimeoutUserEffect) Apply(ctxData *TriggeredRuleData, settings interface{}) error
- func (timeout *TimeoutUserEffect) DataType() interface{}
- func (timeout *TimeoutUserEffect) Description() (description string)
- func (timeout *TimeoutUserEffect) Kind() RulePartType
- func (timeout *TimeoutUserEffect) MergeDuplicates(data []interface{}) interface{}
- func (timeout *TimeoutUserEffect) Name() (name string)
- func (timeout *TimeoutUserEffect) UserSettings() []*SettingDef
- type TimeoutUserEffectData
- 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 INDEX IF NOT EXISTS automod_rules_ruleset_idx ON automod_rules(ruleset_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 INDEX IF NOT EXISTS automod_ruleset_conditions_ruleset_idx ON automod_ruleset_conditions(ruleset_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{}, 34: &MessageLengthTrigger{}, 35: &MessageLengthTrigger{Inverted: true}, 36: &SlowmodeTrigger{Links: true, ChannelBased: false}, 37: &SlowmodeTrigger{Links: true, ChannelBased: true}, 38: &AutomodExecution{}, 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}, 215: &ThreadCondition{true}, 216: &ThreadCondition{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{}, 313: &SendChannelMessageEffect{}, 314: &TimeoutUserEffect{}, }
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.
View Source
var SanitizeTextName = "Also match visually similar characters such as \"Ĥéĺĺó\""
Functions ¶
func CheckLimits ¶
func CheckLimits(exec boil.ContextExecutor, rule *models.AutomodRule, tmpl web.TemplateData, parts []*models.AutomodRuleDatum) (newParts []*models.AutomodRuleDatum, ok bool, err error)
func FetchGuildLists ¶
func FetchGuildLists(guildID int64) ([]*models.AutomodList, error)
func FindFetchGuildList ¶
func FindFetchGuildList(guildID int64, listID int64) (*models.AutomodList, error)
func GuildMaxLists ¶
func GuildMaxMessageTriggers ¶
func GuildMaxRulesets ¶
func GuildMaxTotalRules ¶
func ParseAllRulePartData ¶
func ParseAllRulePartData(dataModels []*models.AutomodRuleDatum) ([]interface{}, error)
func ParseRulePartData ¶
func ParseRulePartData(model *models.AutomodRuleDatum) (interface{}, error)
func ReadRuleRowData ¶
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 ¶
func WebLoadRuleSettings(r *http.Request, tmpl web.TemplateData, ruleset *models.AutomodRuleset)
Types ¶
type AccountAgeCondition ¶
type AccountAgeCondition struct {
Below bool // if true, then blacklist mode, otherwise whitelist mode
}
func (*AccountAgeCondition) DataType ¶
func (ac *AccountAgeCondition) DataType() interface{}
func (*AccountAgeCondition) Description ¶
func (ac *AccountAgeCondition) Description() string
func (*AccountAgeCondition) IsMet ¶
func (ac *AccountAgeCondition) IsMet(data *TriggeredRuleData, settings interface{}) (bool, error)
func (*AccountAgeCondition) Kind ¶
func (ac *AccountAgeCondition) Kind() RulePartType
func (*AccountAgeCondition) MergeDuplicates ¶
func (ac *AccountAgeCondition) MergeDuplicates(data []interface{}) interface{}
func (*AccountAgeCondition) Name ¶
func (ac *AccountAgeCondition) Name() string
func (*AccountAgeCondition) UserSettings ¶
func (ac *AccountAgeCondition) UserSettings() []*SettingDef
type AccountAgeConditionData ¶
type AccountAgeConditionData struct {
Treshold int
}
type AddViolationEffect ¶
type AddViolationEffect struct{}
func (*AddViolationEffect) Apply ¶
func (vio *AddViolationEffect) Apply(ctxData *TriggeredRuleData, settings interface{}) error
func (*AddViolationEffect) DataType ¶
func (vio *AddViolationEffect) DataType() interface{}
func (*AddViolationEffect) Description ¶
func (vio *AddViolationEffect) Description() (description string)
func (*AddViolationEffect) Kind ¶
func (vio *AddViolationEffect) Kind() RulePartType
func (*AddViolationEffect) Name ¶
func (vio *AddViolationEffect) Name() (name string)
func (*AddViolationEffect) UserSettings ¶
func (vio *AddViolationEffect) UserSettings() []*SettingDef
type AddViolationEffectData ¶
type AddViolationEffectData struct {
Name string `valid:",1,100,trimspace"`
}
type AllCapsTrigger ¶
type AllCapsTrigger struct{}
func (*AllCapsTrigger) CheckMessage ¶
func (caps *AllCapsTrigger) CheckMessage(triggerCtx *TriggerContext, cs *dstate.ChannelState, m *discordgo.Message, mdStripped string) (bool, error)
func (*AllCapsTrigger) DataType ¶
func (caps *AllCapsTrigger) DataType() interface{}
func (*AllCapsTrigger) Description ¶
func (caps *AllCapsTrigger) Description() string
func (*AllCapsTrigger) Kind ¶
func (caps *AllCapsTrigger) Kind() RulePartType
func (*AllCapsTrigger) MergeDuplicates ¶
func (caps *AllCapsTrigger) MergeDuplicates(data []interface{}) interface{}
func (*AllCapsTrigger) Name ¶
func (caps *AllCapsTrigger) Name() string
func (*AllCapsTrigger) UserSettings ¶
func (caps *AllCapsTrigger) UserSettings() []*SettingDef
type AllCapsTriggerData ¶
type AntiPhishingLinkTrigger ¶
type AntiPhishingLinkTrigger struct{}
func (*AntiPhishingLinkTrigger) CheckMessage ¶
func (a *AntiPhishingLinkTrigger) CheckMessage(triggerCtx *TriggerContext, cs *dstate.ChannelState, m *discordgo.Message, mdStripped string) (bool, error)
func (*AntiPhishingLinkTrigger) DataType ¶
func (a *AntiPhishingLinkTrigger) DataType() interface{}
func (*AntiPhishingLinkTrigger) Description ¶
func (a *AntiPhishingLinkTrigger) Description() string
func (*AntiPhishingLinkTrigger) Kind ¶
func (a *AntiPhishingLinkTrigger) Kind() RulePartType
func (*AntiPhishingLinkTrigger) Name ¶
func (a *AntiPhishingLinkTrigger) Name() string
func (*AntiPhishingLinkTrigger) UserSettings ¶
func (a *AntiPhishingLinkTrigger) UserSettings() []*SettingDef
type AnyLinkTrigger ¶
type AnyLinkTrigger struct{}
func (*AnyLinkTrigger) CheckMessage ¶
func (alc *AnyLinkTrigger) CheckMessage(triggerCtx *TriggerContext, cs *dstate.ChannelState, m *discordgo.Message, mdStripped string) (bool, error)
func (*AnyLinkTrigger) DataType ¶
func (alc *AnyLinkTrigger) DataType() interface{}
func (*AnyLinkTrigger) Description ¶
func (alc *AnyLinkTrigger) Description() (description string)
func (*AnyLinkTrigger) Kind ¶
func (alc *AnyLinkTrigger) Kind() RulePartType
func (*AnyLinkTrigger) MergeDuplicates ¶
func (alc *AnyLinkTrigger) MergeDuplicates(data []interface{}) interface{}
func (*AnyLinkTrigger) Name ¶
func (alc *AnyLinkTrigger) Name() (name string)
func (*AnyLinkTrigger) UserSettings ¶
func (alc *AnyLinkTrigger) UserSettings() []*SettingDef
type AutomodExecution ¶ added in v2.25.0
type AutomodExecution struct { }
func (*AutomodExecution) CheckRuleID ¶ added in v2.25.0
func (am *AutomodExecution) CheckRuleID(triggerCtx *TriggerContext, ruleID int64) (bool, error)
func (*AutomodExecution) DataType ¶ added in v2.25.0
func (am *AutomodExecution) DataType() interface{}
func (*AutomodExecution) Description ¶ added in v2.25.0
func (am *AutomodExecution) Description() (description string)
func (*AutomodExecution) Kind ¶ added in v2.25.0
func (am *AutomodExecution) Kind() RulePartType
func (*AutomodExecution) Name ¶ added in v2.25.0
func (am *AutomodExecution) Name() (name string)
func (*AutomodExecution) UserSettings ¶ added in v2.25.0
func (am *AutomodExecution) UserSettings() []*SettingDef
type AutomodExecutionData ¶ added in v2.25.0
type AutomodExecutionData struct {
RuleID string
}
type AutomodListener ¶ added in v2.25.0
type AutomodListener interface { RulePart CheckRuleID(triggerCtx *TriggerContext, ruleID int64) (isAffected bool, err error) }
AutomodListener is a trigger for when Discord's built in automod kicks in
type BanUserEffect ¶
type BanUserEffect struct{}
func (*BanUserEffect) Apply ¶
func (ban *BanUserEffect) Apply(ctxData *TriggeredRuleData, settings interface{}) error
func (*BanUserEffect) DataType ¶
func (ban *BanUserEffect) DataType() interface{}
func (*BanUserEffect) Description ¶
func (ban *BanUserEffect) Description() (description string)
func (*BanUserEffect) Kind ¶
func (ban *BanUserEffect) Kind() RulePartType
func (*BanUserEffect) MergeDuplicates ¶
func (ban *BanUserEffect) MergeDuplicates(data []interface{}) interface{}
func (*BanUserEffect) Name ¶
func (ban *BanUserEffect) Name() (name string)
func (*BanUserEffect) UserSettings ¶
func (ban *BanUserEffect) UserSettings() []*SettingDef
type BanUserEffectData ¶
type BaseRegexTrigger ¶
type BaseRegexTrigger struct {
Inverse bool
}
func (BaseRegexTrigger) DataType ¶
func (r BaseRegexTrigger) DataType() interface{}
func (BaseRegexTrigger) Kind ¶
func (r BaseRegexTrigger) Kind() RulePartType
func (BaseRegexTrigger) UserSettings ¶
func (r BaseRegexTrigger) UserSettings() []*SettingDef
type BaseRegexTriggerData ¶
type BotCondition ¶
type BotCondition struct {
Ignore bool
}
func (*BotCondition) DataType ¶
func (bc *BotCondition) DataType() interface{}
func (*BotCondition) Description ¶
func (bc *BotCondition) Description() string
func (*BotCondition) IsMet ¶
func (bc *BotCondition) IsMet(data *TriggeredRuleData, settings interface{}) (bool, error)
func (*BotCondition) Kind ¶
func (bc *BotCondition) Kind() RulePartType
func (*BotCondition) MergeDuplicates ¶
func (bc *BotCondition) MergeDuplicates(data []interface{}) interface{}
func (*BotCondition) Name ¶
func (bc *BotCondition) Name() string
func (*BotCondition) UserSettings ¶
func (bc *BotCondition) UserSettings() []*SettingDef
type ChannelCategoriesCondition ¶
type ChannelCategoriesCondition struct {
Blacklist bool // if true, then blacklist mode, otherwise whitelist mode
}
func (*ChannelCategoriesCondition) DataType ¶
func (cd *ChannelCategoriesCondition) DataType() interface{}
func (*ChannelCategoriesCondition) Description ¶
func (cd *ChannelCategoriesCondition) Description() string
func (*ChannelCategoriesCondition) IsMet ¶
func (cd *ChannelCategoriesCondition) IsMet(data *TriggeredRuleData, settings interface{}) (bool, error)
func (*ChannelCategoriesCondition) Kind ¶
func (cd *ChannelCategoriesCondition) Kind() RulePartType
func (*ChannelCategoriesCondition) MergeDuplicates ¶
func (cd *ChannelCategoriesCondition) MergeDuplicates(data []interface{}) interface{}
func (*ChannelCategoriesCondition) Name ¶
func (cd *ChannelCategoriesCondition) Name() string
func (*ChannelCategoriesCondition) UserSettings ¶
func (cd *ChannelCategoriesCondition) UserSettings() []*SettingDef
type ChannelCategoryConditionData ¶
type ChannelCategoryConditionData struct {
Categories []int64
}
type ChannelsCondition ¶
type ChannelsCondition struct {
Blacklist bool // if true, then blacklist mode, otherwise whitelist mode
}
func (*ChannelsCondition) DataType ¶
func (cd *ChannelsCondition) DataType() interface{}
func (*ChannelsCondition) Description ¶
func (cd *ChannelsCondition) Description() string
func (*ChannelsCondition) IsMet ¶
func (cd *ChannelsCondition) IsMet(data *TriggeredRuleData, settings interface{}) (bool, error)
func (*ChannelsCondition) Kind ¶
func (cd *ChannelsCondition) Kind() RulePartType
func (*ChannelsCondition) MergeDuplicates ¶
func (cd *ChannelsCondition) MergeDuplicates(data []interface{}) interface{}
func (*ChannelsCondition) Name ¶
func (cd *ChannelsCondition) Name() string
func (*ChannelsCondition) UserSettings ¶
func (cd *ChannelsCondition) UserSettings() []*SettingDef
type ChannelsConditionData ¶
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 ¶
type CreateListData struct {
Name string `valid:",1,50"`
}
type CreateRuleData ¶
type CreateRuleData struct {
Name string `valid:",1,50"`
}
type CreateRulesetData ¶
type CreateRulesetData struct {
Name string `valid:",1,100"`
}
type DeleteMessageEffect ¶
type DeleteMessageEffect struct{}
func (*DeleteMessageEffect) Apply ¶
func (del *DeleteMessageEffect) Apply(ctxData *TriggeredRuleData, settings interface{}) error
func (*DeleteMessageEffect) DataType ¶
func (del *DeleteMessageEffect) DataType() interface{}
func (*DeleteMessageEffect) Description ¶
func (del *DeleteMessageEffect) Description() (description string)
func (*DeleteMessageEffect) Kind ¶
func (del *DeleteMessageEffect) Kind() RulePartType
func (*DeleteMessageEffect) MergeDuplicates ¶
func (del *DeleteMessageEffect) MergeDuplicates(data []interface{}) interface{}
func (*DeleteMessageEffect) Name ¶
func (del *DeleteMessageEffect) Name() (name string)
func (*DeleteMessageEffect) UserSettings ¶
func (del *DeleteMessageEffect) UserSettings() []*SettingDef
type DeleteMessagesEffect ¶
type DeleteMessagesEffect struct{}
func (*DeleteMessagesEffect) Apply ¶
func (del *DeleteMessagesEffect) Apply(ctxData *TriggeredRuleData, settings interface{}) error
func (*DeleteMessagesEffect) DataType ¶
func (del *DeleteMessagesEffect) DataType() interface{}
func (*DeleteMessagesEffect) Description ¶
func (del *DeleteMessagesEffect) Description() (description string)
func (*DeleteMessagesEffect) Kind ¶
func (del *DeleteMessagesEffect) Kind() RulePartType
func (*DeleteMessagesEffect) MergeDuplicates ¶
func (del *DeleteMessagesEffect) MergeDuplicates(data []interface{}) interface{}
func (*DeleteMessagesEffect) Name ¶
func (del *DeleteMessagesEffect) Name() (name string)
func (*DeleteMessagesEffect) UserSettings ¶
func (del *DeleteMessagesEffect) UserSettings() []*SettingDef
type DomainTrigger ¶
type DomainTrigger struct {
Blacklist bool
}
func (*DomainTrigger) CheckMessage ¶
func (dt *DomainTrigger) CheckMessage(triggerCtx *TriggerContext, cs *dstate.ChannelState, m *discordgo.Message, mdStripped string) (bool, error)
func (*DomainTrigger) DataType ¶
func (dt *DomainTrigger) DataType() interface{}
func (*DomainTrigger) Description ¶
func (dt *DomainTrigger) Description() (description string)
func (*DomainTrigger) Kind ¶
func (dt *DomainTrigger) Kind() RulePartType
func (*DomainTrigger) Name ¶
func (dt *DomainTrigger) Name() (name string)
func (*DomainTrigger) UserSettings ¶
func (dt *DomainTrigger) UserSettings() []*SettingDef
type DomainTriggerData ¶
type DomainTriggerData struct {
ListID int64
}
type Effect ¶
type Effect interface {
Apply(ctxData *TriggeredRuleData, settings interface{}) error
}
type EnableChannelSlowmodeEffect ¶
type EnableChannelSlowmodeEffect struct {
// contains filtered or unexported fields
}
func (*EnableChannelSlowmodeEffect) Apply ¶
func (slow *EnableChannelSlowmodeEffect) Apply(ctxData *TriggeredRuleData, settings interface{}) error
func (*EnableChannelSlowmodeEffect) DataType ¶
func (slow *EnableChannelSlowmodeEffect) DataType() interface{}
func (*EnableChannelSlowmodeEffect) Description ¶
func (slow *EnableChannelSlowmodeEffect) Description() (description string)
func (*EnableChannelSlowmodeEffect) Kind ¶
func (slow *EnableChannelSlowmodeEffect) Kind() RulePartType
func (*EnableChannelSlowmodeEffect) Name ¶
func (slow *EnableChannelSlowmodeEffect) Name() (name string)
func (*EnableChannelSlowmodeEffect) UserSettings ¶
func (slow *EnableChannelSlowmodeEffect) UserSettings() []*SettingDef
type ErrUnknownTypeID ¶
type ErrUnknownTypeID struct {
TypeID int
}
func (*ErrUnknownTypeID) Error ¶
func (e *ErrUnknownTypeID) Error() string
type GiveRoleEffect ¶
type GiveRoleEffect struct{}
func (*GiveRoleEffect) Apply ¶
func (gf *GiveRoleEffect) Apply(ctxData *TriggeredRuleData, settings interface{}) error
func (*GiveRoleEffect) DataType ¶
func (gf *GiveRoleEffect) DataType() interface{}
func (*GiveRoleEffect) Description ¶
func (gf *GiveRoleEffect) Description() (description string)
func (*GiveRoleEffect) Kind ¶
func (gr *GiveRoleEffect) Kind() RulePartType
func (*GiveRoleEffect) Name ¶
func (gf *GiveRoleEffect) Name() (name string)
func (*GiveRoleEffect) UserSettings ¶
func (gf *GiveRoleEffect) UserSettings() []*SettingDef
type GiveRoleEffectData ¶
type GoogleSafeBrowsingTrigger ¶
type GoogleSafeBrowsingTrigger struct{}
func (*GoogleSafeBrowsingTrigger) CheckMessage ¶
func (g *GoogleSafeBrowsingTrigger) CheckMessage(triggerCtx *TriggerContext, cs *dstate.ChannelState, m *discordgo.Message, mdStripped string) (bool, error)
func (*GoogleSafeBrowsingTrigger) DataType ¶
func (g *GoogleSafeBrowsingTrigger) DataType() interface{}
func (*GoogleSafeBrowsingTrigger) Description ¶
func (g *GoogleSafeBrowsingTrigger) Description() string
func (*GoogleSafeBrowsingTrigger) Kind ¶
func (g *GoogleSafeBrowsingTrigger) Kind() RulePartType
func (*GoogleSafeBrowsingTrigger) MergeDuplicates ¶
func (g *GoogleSafeBrowsingTrigger) MergeDuplicates(data []interface{}) interface{}
func (*GoogleSafeBrowsingTrigger) Name ¶
func (g *GoogleSafeBrowsingTrigger) Name() string
func (*GoogleSafeBrowsingTrigger) UserSettings ¶
func (g *GoogleSafeBrowsingTrigger) UserSettings() []*SettingDef
type JoinListener ¶
type JoinListener interface { RulePart CheckJoin(triggerCtx *TriggerContext) (isAffected bool, err error) }
JoinListener is triggers that does stuff when members joins
type KickUserEffect ¶
type KickUserEffect struct{}
func (*KickUserEffect) Apply ¶
func (kick *KickUserEffect) Apply(ctxData *TriggeredRuleData, settings interface{}) error
func (*KickUserEffect) DataType ¶
func (kick *KickUserEffect) DataType() interface{}
func (*KickUserEffect) Description ¶
func (kick *KickUserEffect) Description() (description string)
func (*KickUserEffect) Kind ¶
func (kick *KickUserEffect) Kind() RulePartType
func (*KickUserEffect) MergeDuplicates ¶
func (kick *KickUserEffect) MergeDuplicates(data []interface{}) interface{}
func (*KickUserEffect) Name ¶
func (kick *KickUserEffect) Name() (name string)
func (*KickUserEffect) UserSettings ¶
func (kick *KickUserEffect) UserSettings() []*SettingDef
type KickUserEffectData ¶
type KickUserEffectData struct {
CustomReason string `valid:",0,150,trimspace"`
}
type MemberAgeConditionData ¶
type MemberAgeConditionData struct {
Treshold int
}
type MemberAgecondition ¶
type MemberAgecondition struct {
Below bool // if true, then blacklist mode, otherwise whitelist mode
}
func (*MemberAgecondition) DataType ¶
func (mc *MemberAgecondition) DataType() interface{}
func (*MemberAgecondition) Description ¶
func (mc *MemberAgecondition) Description() string
func (*MemberAgecondition) IsMet ¶
func (mc *MemberAgecondition) IsMet(data *TriggeredRuleData, settings interface{}) (bool, error)
func (*MemberAgecondition) Kind ¶
func (mc *MemberAgecondition) Kind() RulePartType
func (*MemberAgecondition) MergeDuplicates ¶
func (mc *MemberAgecondition) MergeDuplicates(data []interface{}) interface{}
func (*MemberAgecondition) Name ¶
func (mc *MemberAgecondition) Name() string
func (*MemberAgecondition) UserSettings ¶
func (mc *MemberAgecondition) UserSettings() []*SettingDef
type MemberJoinTrigger ¶
type MemberJoinTrigger struct { }
func (*MemberJoinTrigger) CheckJoin ¶
func (mj *MemberJoinTrigger) CheckJoin(t *TriggerContext) (isAffected bool, err error)
func (*MemberJoinTrigger) DataType ¶
func (mj *MemberJoinTrigger) DataType() interface{}
func (*MemberJoinTrigger) Description ¶
func (mj *MemberJoinTrigger) Description() (description string)
func (*MemberJoinTrigger) Kind ¶
func (mj *MemberJoinTrigger) Kind() RulePartType
func (*MemberJoinTrigger) Name ¶
func (mj *MemberJoinTrigger) Name() (name string)
func (*MemberJoinTrigger) UserSettings ¶
func (mj *MemberJoinTrigger) UserSettings() []*SettingDef
type MemberRolesCondition ¶
type MemberRolesCondition struct {
Blacklist bool // if true, then blacklist mode, otherwise whitelist mode
}
func (*MemberRolesCondition) DataType ¶
func (mrc *MemberRolesCondition) DataType() interface{}
func (*MemberRolesCondition) Description ¶
func (mrc *MemberRolesCondition) Description() string
func (*MemberRolesCondition) IsMet ¶
func (mrc *MemberRolesCondition) IsMet(data *TriggeredRuleData, settings interface{}) (bool, error)
func (*MemberRolesCondition) Kind ¶
func (mrc *MemberRolesCondition) Kind() RulePartType
func (*MemberRolesCondition) MergeDuplicates ¶
func (mrc *MemberRolesCondition) MergeDuplicates(data []interface{}) interface{}
func (*MemberRolesCondition) Name ¶
func (mrc *MemberRolesCondition) Name() string
func (*MemberRolesCondition) UserSettings ¶
func (mrc *MemberRolesCondition) UserSettings() []*SettingDef
type MentionsTrigger ¶
type MentionsTrigger struct{}
func (*MentionsTrigger) CheckMessage ¶
func (mc *MentionsTrigger) CheckMessage(triggerCtx *TriggerContext, cs *dstate.ChannelState, m *discordgo.Message, mdStripped string) (bool, error)
func (*MentionsTrigger) DataType ¶
func (mc *MentionsTrigger) DataType() interface{}
func (*MentionsTrigger) Description ¶
func (mc *MentionsTrigger) Description() string
func (*MentionsTrigger) Kind ¶
func (mc *MentionsTrigger) Kind() RulePartType
func (*MentionsTrigger) MergeDuplicates ¶
func (mc *MentionsTrigger) MergeDuplicates(data []interface{}) interface{}
func (*MentionsTrigger) Name ¶
func (mc *MentionsTrigger) Name() string
func (*MentionsTrigger) UserSettings ¶
func (mc *MentionsTrigger) UserSettings() []*SettingDef
type MentionsTriggerData ¶
type MentionsTriggerData struct {
Treshold int
}
type MergeableRulePart ¶
type MergeableRulePart interface {
MergeDuplicates(data []interface{}) interface{}
}
type MessageAttachmentTrigger ¶
type MessageAttachmentTrigger struct {
RequiresAttachment bool
}
func (*MessageAttachmentTrigger) CheckMessage ¶
func (mat *MessageAttachmentTrigger) CheckMessage(triggerCtx *TriggerContext, cs *dstate.ChannelState, m *discordgo.Message, mdStripped string) (bool, error)
func (*MessageAttachmentTrigger) DataType ¶
func (mat *MessageAttachmentTrigger) DataType() interface{}
func (*MessageAttachmentTrigger) Description ¶
func (mat *MessageAttachmentTrigger) Description() string
func (*MessageAttachmentTrigger) Kind ¶
func (mat *MessageAttachmentTrigger) Kind() RulePartType
func (*MessageAttachmentTrigger) MergeDuplicates ¶
func (mat *MessageAttachmentTrigger) MergeDuplicates(data []interface{}) interface{}
func (*MessageAttachmentTrigger) Name ¶
func (mat *MessageAttachmentTrigger) Name() string
func (*MessageAttachmentTrigger) UserSettings ¶
func (mat *MessageAttachmentTrigger) UserSettings() []*SettingDef
type MessageEditedCondition ¶
type MessageEditedCondition struct {
NewMessage bool // if true, then blacklist mode, otherwise whitelist mode
}
func (*MessageEditedCondition) DataType ¶
func (mc *MessageEditedCondition) DataType() interface{}
func (*MessageEditedCondition) Description ¶
func (mc *MessageEditedCondition) Description() string
func (*MessageEditedCondition) IsMet ¶
func (mc *MessageEditedCondition) IsMet(data *TriggeredRuleData, settings interface{}) (bool, error)
func (*MessageEditedCondition) Kind ¶
func (mc *MessageEditedCondition) Kind() RulePartType
func (*MessageEditedCondition) MergeDuplicates ¶
func (mc *MessageEditedCondition) MergeDuplicates(data []interface{}) interface{}
func (*MessageEditedCondition) Name ¶
func (mc *MessageEditedCondition) Name() string
func (*MessageEditedCondition) UserSettings ¶
func (mc *MessageEditedCondition) UserSettings() []*SettingDef
type MessageLengthTrigger ¶
type MessageLengthTrigger struct {
Inverted bool
}
func (*MessageLengthTrigger) CheckMessage ¶
func (ml *MessageLengthTrigger) CheckMessage(triggerCtx *TriggerContext, cs *dstate.ChannelState, m *discordgo.Message, mdStripped string) (bool, error)
func (*MessageLengthTrigger) DataType ¶
func (ml *MessageLengthTrigger) DataType() interface{}
func (*MessageLengthTrigger) Description ¶
func (ml *MessageLengthTrigger) Description() (description string)
func (*MessageLengthTrigger) Kind ¶
func (ml *MessageLengthTrigger) Kind() RulePartType
func (*MessageLengthTrigger) Name ¶
func (ml *MessageLengthTrigger) Name() (name string)
func (*MessageLengthTrigger) UserSettings ¶
func (ml *MessageLengthTrigger) UserSettings() []*SettingDef
type MessageLengthTriggerData ¶
type MessageLengthTriggerData struct {
Length int
}
type MessageRegexTrigger ¶
type MessageRegexTrigger struct {
BaseRegexTrigger
}
func (*MessageRegexTrigger) CheckMessage ¶
func (r *MessageRegexTrigger) CheckMessage(triggerCtx *TriggerContext, cs *dstate.ChannelState, m *discordgo.Message, mdStripped string) (bool, error)
func (*MessageRegexTrigger) Description ¶
func (r *MessageRegexTrigger) Description() string
func (*MessageRegexTrigger) Name ¶
func (r *MessageRegexTrigger) Name() string
type MessageTrigger ¶
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 ¶
type MultiMsgMentionTrigger struct {
ChannelBased bool
}
func (*MultiMsgMentionTrigger) CheckMessage ¶
func (mt *MultiMsgMentionTrigger) CheckMessage(triggerCtx *TriggerContext, cs *dstate.ChannelState, m *discordgo.Message, mdStripped string) (bool, error)
func (*MultiMsgMentionTrigger) DataType ¶
func (mt *MultiMsgMentionTrigger) DataType() interface{}
func (*MultiMsgMentionTrigger) Description ¶
func (mt *MultiMsgMentionTrigger) Description() string
func (*MultiMsgMentionTrigger) Kind ¶
func (mt *MultiMsgMentionTrigger) Kind() RulePartType
func (*MultiMsgMentionTrigger) MergeDuplicates ¶
func (mt *MultiMsgMentionTrigger) MergeDuplicates(data []interface{}) interface{}
func (*MultiMsgMentionTrigger) Name ¶
func (mt *MultiMsgMentionTrigger) Name() string
func (*MultiMsgMentionTrigger) UserSettings ¶
func (mt *MultiMsgMentionTrigger) UserSettings() []*SettingDef
type MuteUserEffect ¶
type MuteUserEffect struct{}
func (*MuteUserEffect) Apply ¶
func (mute *MuteUserEffect) Apply(ctxData *TriggeredRuleData, settings interface{}) error
func (*MuteUserEffect) DataType ¶
func (mute *MuteUserEffect) DataType() interface{}
func (*MuteUserEffect) Description ¶
func (mute *MuteUserEffect) Description() (description string)
func (*MuteUserEffect) Kind ¶
func (mute *MuteUserEffect) Kind() RulePartType
func (*MuteUserEffect) MergeDuplicates ¶
func (mute *MuteUserEffect) MergeDuplicates(data []interface{}) interface{}
func (*MuteUserEffect) Name ¶
func (mute *MuteUserEffect) Name() (name string)
func (*MuteUserEffect) UserSettings ¶
func (mute *MuteUserEffect) UserSettings() []*SettingDef
type MuteUserEffectData ¶
type NicknameListener ¶
type NicknameListener interface { RulePart CheckNickname(triggerCtx *TriggerContext) (isAffected bool, err error) }
NicknameListener is a trigger that gets triggered on a nickname change
type NicknameRegexTrigger ¶
type NicknameRegexTrigger struct {
BaseRegexTrigger
}
func (*NicknameRegexTrigger) CheckNickname ¶
func (r *NicknameRegexTrigger) CheckNickname(t *TriggerContext) (bool, error)
func (*NicknameRegexTrigger) Description ¶
func (r *NicknameRegexTrigger) Description() string
func (*NicknameRegexTrigger) Name ¶
func (r *NicknameRegexTrigger) Name() string
type NicknameWordlistTrigger ¶
type NicknameWordlistTrigger struct {
Blacklist bool
}
func (*NicknameWordlistTrigger) CheckNickname ¶
func (nwl *NicknameWordlistTrigger) CheckNickname(t *TriggerContext) (bool, error)
func (*NicknameWordlistTrigger) DataType ¶
func (nwl *NicknameWordlistTrigger) DataType() interface{}
func (*NicknameWordlistTrigger) Description ¶
func (nwl *NicknameWordlistTrigger) Description() (description string)
func (*NicknameWordlistTrigger) Kind ¶
func (nwl *NicknameWordlistTrigger) Kind() RulePartType
func (*NicknameWordlistTrigger) Name ¶
func (nwl *NicknameWordlistTrigger) Name() (name string)
func (*NicknameWordlistTrigger) UserSettings ¶
func (nwl *NicknameWordlistTrigger) UserSettings() []*SettingDef
type ParsedPart ¶
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 ¶
type ParsedRule struct { Model *models.AutomodRule Triggers []*ParsedPart Conditions []*ParsedPart Effects []*ParsedPart }
func ParseRuleData ¶
func ParseRuleData(rule *models.AutomodRule) (*ParsedRule, error)
type ParsedRuleset ¶
type ParsedRuleset struct { RSModel *models.AutomodRuleset ParsedConditions []*ParsedPart Rules []*ParsedRule }
func ParseRuleset ¶
func ParseRuleset(rs *models.AutomodRuleset) (*ParsedRuleset, error)
type Plugin ¶
type Plugin struct { }
func (*Plugin) AddCommands ¶
func (p *Plugin) AddCommands()
func (*Plugin) AllFeatureFlags ¶
func (*Plugin) CheckConditions ¶
func (p *Plugin) CheckConditions(ctxData *TriggeredRuleData, conditions []*ParsedPart) bool
func (*Plugin) CheckTriggers ¶
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 ¶
func (p *Plugin) FetchGuildRulesets(guildID int64) ([]*ParsedRuleset, error)
func (*Plugin) LoadServerHomeWidget ¶
func (p *Plugin) LoadServerHomeWidget(w http.ResponseWriter, r *http.Request) (web.TemplateData, error)
func (*Plugin) PluginInfo ¶
func (p *Plugin) PluginInfo() *common.PluginInfo
func (*Plugin) RulesetRulesTriggered ¶
func (p *Plugin) RulesetRulesTriggered(ctxData *TriggeredRuleData, checkedConditions bool)
func (*Plugin) RulesetRulesTriggeredCondsPassed ¶
func (p *Plugin) RulesetRulesTriggeredCondsPassed(ruleset *ParsedRuleset, triggeredRules []*ParsedRule, ctxData *TriggeredRuleData)
type RemoveRoleEffect ¶
type RemoveRoleEffect struct{}
func (*RemoveRoleEffect) Apply ¶
func (rf *RemoveRoleEffect) Apply(ctxData *TriggeredRuleData, settings interface{}) error
func (*RemoveRoleEffect) DataType ¶
func (rf *RemoveRoleEffect) DataType() interface{}
func (*RemoveRoleEffect) Description ¶
func (rf *RemoveRoleEffect) Description() (description string)
func (*RemoveRoleEffect) Kind ¶
func (rr *RemoveRoleEffect) Kind() RulePartType
func (*RemoveRoleEffect) Name ¶
func (rf *RemoveRoleEffect) Name() (name string)
func (*RemoveRoleEffect) UserSettings ¶
func (rf *RemoveRoleEffect) UserSettings() []*SettingDef
type RemoveRoleEffectData ¶
type ResetChannelRatelimitData ¶
type ResetChannelRatelimitData struct {
ChannelID int64
}
type ResetViolationsEffect ¶
type ResetViolationsEffect struct{}
func (*ResetViolationsEffect) Apply ¶
func (rv *ResetViolationsEffect) Apply(ctxData *TriggeredRuleData, settings interface{}) error
func (*ResetViolationsEffect) DataType ¶
func (rv *ResetViolationsEffect) DataType() interface{}
func (*ResetViolationsEffect) Description ¶
func (rv *ResetViolationsEffect) Description() (description string)
func (*ResetViolationsEffect) Kind ¶
func (rv *ResetViolationsEffect) Kind() RulePartType
func (*ResetViolationsEffect) Name ¶
func (rv *ResetViolationsEffect) Name() (name string)
func (*ResetViolationsEffect) UserSettings ¶
func (rv *ResetViolationsEffect) UserSettings() []*SettingDef
type ResetViolationsEffectData ¶
type ResetViolationsEffectData struct {
Name string `valid:",0,50,trimspace"`
}
type RulePart ¶
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 ¶
type RulePartType ¶
type RulePartType int
const ( RulePartTrigger RulePartType = 0 RulePartCondition RulePartType = 1 RulePartEffect RulePartType = 2 )
type RuleRowData ¶
type SendChannelMessageEffect ¶
type SendChannelMessageEffect struct{}
func (*SendChannelMessageEffect) Apply ¶
func (send *SendChannelMessageEffect) Apply(ctxData *TriggeredRuleData, settings interface{}) error
func (*SendChannelMessageEffect) DataType ¶
func (send *SendChannelMessageEffect) DataType() interface{}
func (*SendChannelMessageEffect) Description ¶
func (send *SendChannelMessageEffect) Description() (description string)
func (*SendChannelMessageEffect) Kind ¶
func (send *SendChannelMessageEffect) Kind() RulePartType
func (*SendChannelMessageEffect) MergeDuplicates ¶
func (send *SendChannelMessageEffect) MergeDuplicates(data []interface{}) interface{}
func (*SendChannelMessageEffect) Name ¶
func (send *SendChannelMessageEffect) Name() (name string)
func (*SendChannelMessageEffect) UserSettings ¶
func (send *SendChannelMessageEffect) UserSettings() []*SettingDef
type ServerInviteTrigger ¶
type ServerInviteTrigger struct{}
func (*ServerInviteTrigger) CheckMessage ¶
func (inv *ServerInviteTrigger) CheckMessage(triggerCtx *TriggerContext, cs *dstate.ChannelState, m *discordgo.Message, mdStripped string) (bool, error)
func (*ServerInviteTrigger) DataType ¶
func (inv *ServerInviteTrigger) DataType() interface{}
func (*ServerInviteTrigger) Description ¶
func (inv *ServerInviteTrigger) Description() string
func (*ServerInviteTrigger) Kind ¶
func (inv *ServerInviteTrigger) Kind() RulePartType
func (*ServerInviteTrigger) MergeDuplicates ¶
func (inv *ServerInviteTrigger) MergeDuplicates(data []interface{}) interface{}
func (*ServerInviteTrigger) Name ¶
func (inv *ServerInviteTrigger) Name() string
func (*ServerInviteTrigger) UserSettings ¶
func (inv *ServerInviteTrigger) UserSettings() []*SettingDef
type SetNicknameEffect ¶
type SetNicknameEffect struct{}
func (*SetNicknameEffect) Apply ¶
func (sn *SetNicknameEffect) Apply(ctxData *TriggeredRuleData, settings interface{}) error
func (*SetNicknameEffect) DataType ¶
func (sn *SetNicknameEffect) DataType() interface{}
func (*SetNicknameEffect) Description ¶
func (sn *SetNicknameEffect) Description() (description string)
func (*SetNicknameEffect) Kind ¶
func (sn *SetNicknameEffect) Kind() RulePartType
func (*SetNicknameEffect) MergeDuplicates ¶
func (sn *SetNicknameEffect) MergeDuplicates(data []interface{}) interface{}
func (*SetNicknameEffect) Name ¶
func (sn *SetNicknameEffect) Name() (name string)
func (*SetNicknameEffect) UserSettings ¶
func (sn *SetNicknameEffect) UserSettings() []*SettingDef
type SetNicknameEffectData ¶
type SetNicknameEffectData struct {
NewName string `valid:",0,32,trimspace"`
}
type SettingDef ¶
type SettingDef struct { Name string Key string Kind SettingType Min, Max int Default interface{} `json:",omitempty"` Placeholder string `json:",omitempty"` }
type SettingType ¶
type SettingType string
type SlowmodeTrigger ¶
type SlowmodeTrigger struct { ChannelBased bool Attachments bool // whether this trigger checks attachments or not Links bool // whether this trigger checks links or not }
func (*SlowmodeTrigger) CheckMessage ¶
func (s *SlowmodeTrigger) CheckMessage(triggerCtx *TriggerContext, cs *dstate.ChannelState, m *discordgo.Message, mdStripped string) (bool, error)
func (*SlowmodeTrigger) DataType ¶
func (s *SlowmodeTrigger) DataType() interface{}
func (*SlowmodeTrigger) Description ¶
func (s *SlowmodeTrigger) Description() string
func (*SlowmodeTrigger) Kind ¶
func (s *SlowmodeTrigger) Kind() RulePartType
func (*SlowmodeTrigger) MergeDuplicates ¶
func (s *SlowmodeTrigger) MergeDuplicates(data []interface{}) interface{}
func (*SlowmodeTrigger) Name ¶
func (s *SlowmodeTrigger) Name() string
func (*SlowmodeTrigger) UserSettings ¶
func (s *SlowmodeTrigger) UserSettings() []*SettingDef
type SlowmodeTriggerData ¶
type SpamTrigger ¶
type SpamTrigger struct{}
func (*SpamTrigger) CheckMessage ¶
func (spam *SpamTrigger) CheckMessage(triggerCtx *TriggerContext, cs *dstate.ChannelState, m *discordgo.Message, mdStripped string) (bool, error)
func (*SpamTrigger) DataType ¶
func (spam *SpamTrigger) DataType() interface{}
func (*SpamTrigger) Description ¶
func (spam *SpamTrigger) Description() string
func (*SpamTrigger) Kind ¶
func (spam *SpamTrigger) Kind() RulePartType
func (*SpamTrigger) Name ¶
func (spam *SpamTrigger) Name() string
func (*SpamTrigger) UserSettings ¶
func (spam *SpamTrigger) UserSettings() []*SettingDef
type SpamTriggerData ¶
type ThreadCondition ¶ added in v2.27.0
type ThreadCondition struct {
Threads bool
}
func (*ThreadCondition) DataType ¶ added in v2.27.0
func (bc *ThreadCondition) DataType() interface{}
func (*ThreadCondition) Description ¶ added in v2.27.0
func (bc *ThreadCondition) Description() string
func (*ThreadCondition) IsMet ¶ added in v2.27.0
func (bc *ThreadCondition) IsMet(data *TriggeredRuleData, settings interface{}) (bool, error)
func (*ThreadCondition) Kind ¶ added in v2.27.0
func (bc *ThreadCondition) Kind() RulePartType
func (*ThreadCondition) MergeDuplicates ¶ added in v2.27.0
func (bc *ThreadCondition) MergeDuplicates(data []interface{}) interface{}
func (*ThreadCondition) Name ¶ added in v2.27.0
func (bc *ThreadCondition) Name() string
func (*ThreadCondition) UserSettings ¶ added in v2.27.0
func (bc *ThreadCondition) UserSettings() []*SettingDef
type TimeoutUserEffect ¶ added in v2.3.0
type TimeoutUserEffect struct{}
func (*TimeoutUserEffect) Apply ¶ added in v2.3.0
func (timeout *TimeoutUserEffect) Apply(ctxData *TriggeredRuleData, settings interface{}) error
func (*TimeoutUserEffect) DataType ¶ added in v2.3.0
func (timeout *TimeoutUserEffect) DataType() interface{}
func (*TimeoutUserEffect) Description ¶ added in v2.3.0
func (timeout *TimeoutUserEffect) Description() (description string)
func (*TimeoutUserEffect) Kind ¶ added in v2.3.0
func (timeout *TimeoutUserEffect) Kind() RulePartType
func (*TimeoutUserEffect) MergeDuplicates ¶ added in v2.3.0
func (timeout *TimeoutUserEffect) MergeDuplicates(data []interface{}) interface{}
func (*TimeoutUserEffect) Name ¶ added in v2.3.0
func (timeout *TimeoutUserEffect) Name() (name string)
func (*TimeoutUserEffect) UserSettings ¶ added in v2.3.0
func (timeout *TimeoutUserEffect) UserSettings() []*SettingDef
type TimeoutUserEffectData ¶ added in v2.3.0
type TriggerContext ¶
type TriggerContext struct { GS *dstate.GuildSet MS *dstate.MemberState Data interface{} }
type TriggeredRuleData ¶
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 ¶
func (t *TriggeredRuleData) Clone() *TriggeredRuleData
func (*TriggeredRuleData) ConstructReason ¶
func (t *TriggeredRuleData) ConstructReason(includePrevious bool) string
type UpdateListData ¶
type UpdateRuleData ¶
type UpdateRuleData struct { Name string `valid:",1,50"` Triggers []RuleRowData Conditions []RuleRowData Effects []RuleRowData }
type UpdateRulesetData ¶
type UpdateRulesetData struct { Name string `valid:",1,50"` Enabled bool Conditions []RuleRowData }
type UsernameInviteTrigger ¶
type UsernameInviteTrigger struct { }
func (*UsernameInviteTrigger) CheckUsername ¶
func (uv *UsernameInviteTrigger) CheckUsername(t *TriggerContext) (bool, error)
func (*UsernameInviteTrigger) DataType ¶
func (uv *UsernameInviteTrigger) DataType() interface{}
func (*UsernameInviteTrigger) Description ¶
func (uv *UsernameInviteTrigger) Description() (description string)
func (*UsernameInviteTrigger) Kind ¶
func (uv *UsernameInviteTrigger) Kind() RulePartType
func (*UsernameInviteTrigger) Name ¶
func (uv *UsernameInviteTrigger) Name() (name string)
func (*UsernameInviteTrigger) UserSettings ¶
func (uv *UsernameInviteTrigger) UserSettings() []*SettingDef
type UsernameListener ¶
type UsernameListener interface { RulePart CheckUsername(triggerCtx *TriggerContext) (isAffected bool, err error) }
UsernameListener is a trigger that gets triggered on a nickname change
type UsernameRegexTrigger ¶
type UsernameRegexTrigger struct {
BaseRegexTrigger
}
func (*UsernameRegexTrigger) CheckUsername ¶
func (r *UsernameRegexTrigger) CheckUsername(t *TriggerContext) (bool, error)
func (*UsernameRegexTrigger) Description ¶
func (r *UsernameRegexTrigger) Description() string
func (*UsernameRegexTrigger) Name ¶
func (r *UsernameRegexTrigger) Name() string
type UsernameWordlistTrigger ¶
type UsernameWordlistTrigger struct {
Blacklist bool
}
func (*UsernameWordlistTrigger) CheckUsername ¶
func (uwl *UsernameWordlistTrigger) CheckUsername(t *TriggerContext) (bool, error)
func (*UsernameWordlistTrigger) DataType ¶
func (uwl *UsernameWordlistTrigger) DataType() interface{}
func (*UsernameWordlistTrigger) Description ¶
func (uwl *UsernameWordlistTrigger) Description() (description string)
func (*UsernameWordlistTrigger) Kind ¶
func (uwl *UsernameWordlistTrigger) Kind() RulePartType
func (*UsernameWordlistTrigger) Name ¶
func (uwl *UsernameWordlistTrigger) Name() (name string)
func (*UsernameWordlistTrigger) UserSettings ¶
func (uwl *UsernameWordlistTrigger) UserSettings() []*SettingDef
type UsernameWorldlistData ¶
type ViolationListener ¶
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 ¶
type ViolationsTrigger struct{}
func (*ViolationsTrigger) CheckUser ¶
func (vt *ViolationsTrigger) CheckUser(ctxData *TriggeredRuleData, violations []*models.AutomodViolation, settings interface{}, triggeredOnHigher bool) (isAffected bool, err error)
func (*ViolationsTrigger) DataType ¶
func (vt *ViolationsTrigger) DataType() interface{}
func (*ViolationsTrigger) Description ¶
func (vt *ViolationsTrigger) Description() string
func (*ViolationsTrigger) Kind ¶
func (vt *ViolationsTrigger) Kind() RulePartType
func (*ViolationsTrigger) Name ¶
func (vt *ViolationsTrigger) Name() string
func (*ViolationsTrigger) UserSettings ¶
func (vt *ViolationsTrigger) UserSettings() []*SettingDef
type ViolationsTriggerData ¶
type WarnUserEffect ¶
type WarnUserEffect struct{}
func (*WarnUserEffect) Apply ¶
func (warn *WarnUserEffect) Apply(ctxData *TriggeredRuleData, settings interface{}) error
func (*WarnUserEffect) DataType ¶
func (warn *WarnUserEffect) DataType() interface{}
func (*WarnUserEffect) Description ¶
func (warn *WarnUserEffect) Description() (description string)
func (*WarnUserEffect) Kind ¶
func (warn *WarnUserEffect) Kind() RulePartType
func (*WarnUserEffect) MergeDuplicates ¶
func (warn *WarnUserEffect) MergeDuplicates(data []interface{}) interface{}
func (*WarnUserEffect) Name ¶
func (warn *WarnUserEffect) Name() (name string)
func (*WarnUserEffect) UserSettings ¶
func (warn *WarnUserEffect) UserSettings() []*SettingDef
type WarnUserEffectData ¶
type WarnUserEffectData struct {
CustomReason string `valid:",0,150,trimspace"`
}
type WordListTrigger ¶
type WordListTrigger struct {
Blacklist bool
}
func (*WordListTrigger) CheckMessage ¶
func (wl *WordListTrigger) CheckMessage(triggerCtx *TriggerContext, cs *dstate.ChannelState, m *discordgo.Message, mdStripped string) (bool, error)
func (*WordListTrigger) DataType ¶
func (wl *WordListTrigger) DataType() interface{}
func (*WordListTrigger) Description ¶
func (wl *WordListTrigger) Description() (description string)
func (*WordListTrigger) Kind ¶
func (wl *WordListTrigger) Kind() RulePartType
func (*WordListTrigger) Name ¶
func (wl *WordListTrigger) Name() (name string)
func (*WordListTrigger) UserSettings ¶
func (wl *WordListTrigger) UserSettings() []*SettingDef
type WorldListTriggerData ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.