Documentation ¶
Index ¶
- Constants
- Variables
- func CheckLimits(exec boil.ContextExecutor, rule *models.AutomodRule, tmpl web.TemplateData, ...) (newParts []*models.AutomodRuleDatum, ok bool, err error)
- func FetchGuildLists(gs *dstate.GuildState) ([]*models.AutomodList, error)
- func FindFetchGuildList(gs *dstate.GuildState, listID int64) (*models.AutomodList, error)
- func GuildMaxLists(guildID int64) int
- func GuildMaxMessageTriggers(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 *discordgo.Guild, 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(ms *dstate.MemberState, 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 AnyLinkTrigger
- func (alc *AnyLinkTrigger) CheckMessage(ms *dstate.MemberState, 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 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 CacheKey
- 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 DomainTrigger
- func (dt *DomainTrigger) CheckMessage(ms *dstate.MemberState, 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 ErrUnknownTypeID
- type GoogleSafeBrowsingTrigger
- func (g *GoogleSafeBrowsingTrigger) CheckMessage(ms *dstate.MemberState, 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 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 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 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(ms *dstate.MemberState, 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 MessageRegexTrigger
- type MessageTrigger
- type MultiMsgMentionTrigger
- func (mt *MultiMsgMentionTrigger) CheckMessage(ms *dstate.MemberState, 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(ms *dstate.MemberState, data interface{}) (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) BotInit()
- func (p *Plugin) CheckConditions(ctxData *TriggeredRuleData, conditions []*ParsedPart) bool
- func (p *Plugin) CheckTriggers(rulesets []*ParsedRuleset, ms *dstate.MemberState, msg *discordgo.Message, ...) bool
- func (p *Plugin) FetchGuildRulesets(gs *dstate.GuildState) ([]*ParsedRuleset, error)
- func (p *Plugin) InitWeb()
- func (p *Plugin) Name() string
- func (p *Plugin) RulesetRulesTriggered(ctxData *TriggeredRuleData, checkedConditions bool)
- func (p *Plugin) RulesetRulesTriggeredCondsPassed(ruleset *ParsedRuleset, triggeredRules []*ParsedRule, ...)
- type RulePart
- type RulePartPair
- type RulePartType
- type RuleRowData
- type ServerInviteTrigger
- func (inv *ServerInviteTrigger) CheckMessage(ms *dstate.MemberState, 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(ms *dstate.MemberState, 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(ms *dstate.MemberState, 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 TriggeredRuleData
- type UpdateListData
- type UpdateRuleData
- type UpdateRulesetData
- 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 WordListTrigger
- func (wl *WordListTrigger) CheckMessage(ms *dstate.MemberState, 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 = 15 MaxTotalRulesPremium = 100 MaxLists = 5 MaxListsPremium = 25 MaxRuleParts = 20 MaxRulesets = 10 )
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" )
View Source
const DBSchema = `` /* 2657-byte string literal not displayed */
View Source
const PubSubEvtCleaCache = "automod_2_clear_guild_cache"
Variables ¶
View Source
var ErrListNotFound = errors.New("list not found")
View Source
var InverseRulePartMap = make(map[RulePart]int)
View Source
var LinkRegex = regexp.MustCompile(`((https?|steam):\/\/[^\s<]+[^<.,:;"')\]\s])`)
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}, 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}, 300: &DeleteMessageEffect{}, 301: &AddViolationEffect{}, 302: &KickUserEffect{}, 303: &BanUserEffect{}, 304: &MuteUserEffect{}, 305: &WarnUserEffect{}, 306: &SetNicknameEffect{}, }
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(gs *dstate.GuildState) ([]*models.AutomodList, error)
func FindFetchGuildList ¶ added in v1.7.0
func FindFetchGuildList(gs *dstate.GuildState, listID int64) (*models.AutomodList, error)
func GuildMaxLists ¶ added in v1.7.0
func GuildMaxMessageTriggers ¶ added in v1.7.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 *discordgo.Guild, 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(ms *dstate.MemberState, cs *dstate.ChannelState, m *discordgo.Message, mdStripped string, data interface{}) (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 AnyLinkTrigger ¶ added in v1.7.0
type AnyLinkTrigger struct{}
func (*AnyLinkTrigger) CheckMessage ¶ added in v1.7.0
func (alc *AnyLinkTrigger) CheckMessage(ms *dstate.MemberState, cs *dstate.ChannelState, m *discordgo.Message, stripped string, data interface{}) (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 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 DomainTrigger ¶ added in v1.7.0
type DomainTrigger struct {
Blacklist bool
}
func (*DomainTrigger) CheckMessage ¶ added in v1.7.0
func (dt *DomainTrigger) CheckMessage(ms *dstate.MemberState, cs *dstate.ChannelState, m *discordgo.Message, mdStripped string, data interface{}) (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 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 GoogleSafeBrowsingTrigger ¶ added in v1.7.0
type GoogleSafeBrowsingTrigger struct{}
func (*GoogleSafeBrowsingTrigger) CheckMessage ¶ added in v1.7.0
func (g *GoogleSafeBrowsingTrigger) CheckMessage(ms *dstate.MemberState, cs *dstate.ChannelState, m *discordgo.Message, mdStripped string, data interface{}) (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 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 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 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(ms *dstate.MemberState, cs *dstate.ChannelState, m *discordgo.Message, mdStripped string, data interface{}) (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 MessageRegexTrigger ¶ added in v1.7.0
type MessageRegexTrigger struct {
BaseRegexTrigger
}
func (*MessageRegexTrigger) CheckMessage ¶ added in v1.7.0
func (r *MessageRegexTrigger) CheckMessage(ms *dstate.MemberState, cs *dstate.ChannelState, m *discordgo.Message, mdStripped string, data interface{}) (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(ms *dstate.MemberState, cs *dstate.ChannelState, m *discordgo.Message, mdStripped string, data interface{}) (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(ms *dstate.MemberState, cs *dstate.ChannelState, m *discordgo.Message, mdStripped string, data interface{}) (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 MuteUserEffectData struct {
Duration int
}
type NicknameListener ¶ added in v1.7.0
type NicknameListener interface { RulePart CheckNickname(ms *dstate.MemberState, data interface{}) (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(ms *dstate.MemberState, data interface{}) (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(ms *dstate.MemberState, data interface{}) (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) 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, 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(gs *dstate.GuildState) ([]*ParsedRuleset, error)
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 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(ms *dstate.MemberState, cs *dstate.ChannelState, m *discordgo.Message, mdStripped string, data interface{}) (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
}
func (*SlowmodeTrigger) CheckMessage ¶ added in v1.7.0
func (s *SlowmodeTrigger) CheckMessage(ms *dstate.MemberState, cs *dstate.ChannelState, m *discordgo.Message, mdStripped string, data interface{}) (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(ms *dstate.MemberState, cs *dstate.ChannelState, m *discordgo.Message, mdStripped string, data interface{}) (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 SpamTriggerData struct {
Treshold int
}
type TriggeredRuleData ¶ added in v1.7.0
type TriggeredRuleData struct { // Should always be available Plugin *Plugin GS *dstate.GuildState 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 UpdateListData struct {
Content string `valid:",0,5000"`
}
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 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 WordListTrigger ¶ added in v1.7.0
type WordListTrigger struct {
Blacklist bool
}
func (*WordListTrigger) CheckMessage ¶ added in v1.7.0
func (wl *WordListTrigger) CheckMessage(ms *dstate.MemberState, cs *dstate.ChannelState, m *discordgo.Message, mdStripped string, data interface{}) (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.