Blacklist

Blacklist

Maintains a list of blacklisted users with whom the bot should not interact. The final resting place of command spammers and people you don't like. The Blacklist can be accessed via Monochrome#getBlacklist. See the demo blacklist and demo unblacklist commands for examples of using the blacklist. The demo commands can be used in your bot without requiring any modification.

Methods

(async) blacklistUser(userId, reason)

Description:
  • Blacklist a user. The user will be completely ignored by the bot, and any guilds that they own will be left.
Source:
Parameters:
Name Type Description
userId string The ID of the user to blacklist.
reason string The reason the user was blacklisted. If the user is a guild owner, the bot will send a message with this reason to a channel in the guild before leaving. If the user is not a guild owner, they will just be silently ignored and will not see this reason.

(async) isUserBlacklisted(userId) → {boolean}

Description:
  • Check if a user is blacklisted.
Source:
Parameters:
Name Type Description
userId string The ID of the user to check the blacklist for.
Returns:
Type
boolean

isUserBlacklistedQuick(userId) → {boolean}

Description:
  • Check if a user is blacklisted without first checking if the blacklist has loaded. This function is meant to be called in hot paths and may incorrectly return false if called immediately after the bot is started. Consider using Blacklist#isUserBlacklisted instead. It will always return the correct result.
Source:
Parameters:
Name Type Description
userId string The ID of the user to check the blacklist for.
Returns:
Type
boolean

(async) unblacklistUser(userId)

Description:
  • Remove a user from the blacklist so that they can interact with the bot again.
Source:
Parameters:
Name Type Description
userId string The ID of the user to unblacklist.