-
Notifications
You must be signed in to change notification settings - Fork 2
Ignoring Subsystem
The Ignoring Subsystem provides tools to block users, commands in specific channels and commands for specific users.
Blocking and unblocking can be done with the !disable and !enable commands provided by the Bot Management/Mod Plugin.
Technically the commands adding or removing entries on the Bots ignoring list, which will be used for checking if users or commands will be blocked. The checks if a user or command is blocked, will be done in the Bots general on_message event listener and on_command command pre-check. It blocks and ignores any message from users on the ignoring list, so no interaction between bot and blocked users are possible. For blocked commands, it checks if the command is disabled in the current channel, in which the command was used, and ignores the commmand usage in that case. The bot also ignores active command usages from users, who are blocking the passive command usage like mentioning. The passive usage of commands like commands, which affecting other user than the user who used the command, must be supported and implemented by the command itself.
To block the passive command usage, the method bot.ignoring.check_passive_usage(user, command_name) (or one if it's alternatives) must be used like in the following example:
@commands.command(name="mentionuser", help="Mentions a user, supports user cmd disabling.")
async def mentionuser(self, ctx, user: discord.Member):
if self.bot.ignoring.check_passive_usage(user, ctx.command.qualified_name):
await ctx.send("Command blocked for user!")
else:
await ctx.send(user.mention)If a user has blocked the example command ´mentionuser´, the user can't use the command itself, but also can't be mentioned by the command. To passive blocking only any command name variant can be used, but if the ignoring entry should also block the active usage, the qualified command name must be used. If the check should be made via the user id instead of the user object, the method check_passive_usage_uid(), or based on user names check_passive_usage_uname() can be used.