Skip to content

Plugin "Discord"

Add some helper commands to your Discord server.

Configuration

As Discord is an optional plugin, you need to activate it in main.yaml first like so:

# config/main.yaml
opt_plugins:
  - discord
You can configure the plugin with an optional config\plugins\discord.yaml:
# config/plugins/discord.yaml
DEFAULT:
  ping_everyone:                # Handling of unauthorized @everyone or @here pings
    report: true                # create an audit report (default: true)
    timeout: 60                 # optional: timeout for 60 minutes (default: 60 minutes, 0 to disable)
    kick: false                 # optional: kick member on mentioning (default: false)
  on_join:                      # Auto-generate a welcome DM for a user (only works with privileged member intents)
    message: Welcome {name} to this server!
    mention: 9988776655443322   # Optional: Role id to mention (in addition to the user itself, if configured)
    channel: 1199228833774466   # -1 for DM, see also greeting_dm in bot.yaml!
  roles:                        # Auto-generate a message if a user gets or loses a specific role
    1122334455667788:           # role name or id
      on_add:
        message: '{mention}, welcome to the Sample role!'
        mention: '@here'                  # Optional: Role to mention (in addition to the user itself, if configured)
        channel: 9988776655443322         # -1 for DM
      on_remove:
        message: You lost the Sample role!
        channel: -1                       # -1 for DM
      on_leave:                           # on_leave will only work if you have the "Server Members Intent" privilege intent enabled
        message: '{name}, see you next time!'
        channel: -1                       # -1 for DM
  reaction:                               # Auto-generate a reaction message to give roles to people
    channel: 1122334455667788             # The channel id to hold the reaction message
    title: Welcome to {guild}!
    message: |
      Please react to give yourself a role!
    bot_trap: true                        # If true, a bot trap will be generated to auto-kick bot users that klick this role
    roles:
      '🇹':
        role: Tester                      # can be a role or id
        message: Test Role                # message to be displayed to users 
      '🇦': 
        role: 11223344556677
        message: Application Role

Important

You need to give DCSServerBot the following additional permissions: - Manage Roles (you need that for other plugins also already) - Time out members (if you enable timeout on everyone / here pings) - Kick, Approve and Reject Members (if you want to enable member kicking)

Note

To have DCSServerBot give roles to users, you need to make sure that the bot's own role is above each of the roles it should give or take.

Also, DCSServerBot can not detect an "@everyone" or here "@ping" if the user has the permission to do so. This means you need to secure your Discord server properly on your own.

Discord Commands

Command Parameter Channel Role Description
/addrole member role all Admin Allow DCS Admins to add roles to people that are below the bots role.
/delrole member role all Admin Allow DCS Admins to remove roles from people that are below the bots role.
/clear [channel] [older_than] [ignore] [after_id] [before_id] all Admin Purge a channel (default: current).
/discord healthcheck all Admin Checks your Discord server for potential security issues.

Note

You need to give DCSServerBot (temporary) admin permissions to run /discord healthcheck


Configuration reference

Key Type Description Example
DEFAULT map Applies to every instance.
commands
chat_commands

DEFAULT

Key Type Description Example
DEFAULT.ping_everyone map Handling of unauthorized @everyone or @here pings. report: true
timeout: 60
kick: false
DEFAULT.ping_everyone.report bool (required) Create an audit report for each unauthorized ping. true
DEFAULT.ping_everyone.timeout int Minutes the member is timed out for mentioning everyone. (range: min 0) 60
DEFAULT.ping_everyone.kick bool Kick members that mention everyone in a message. false
DEFAULT.on_join map Automatic welcome for members joining the server. message: Welcome {name} to this server!
mention: 9988776655443322
channel: 1199228833774466
DEFAULT.on_join.message str Welcome message sent to the new member. (range: min 1) Welcome {name} to this server!
DEFAULT.on_join.mention text Role mentioned in the welcome message. 9988776655443322
DEFAULT.on_join.channel int Channel for the welcome; -1 sends it as a DM. 1199228833774466
DEFAULT.roles map Per-role messages sent when a member gets or loses a role. 1122334455667788:
on_add:
message: '{mention}, welcome to the Sample role!'
DEFAULT.roles.<(.+)> map
DEFAULT.roles.<(.+)>.<(on_add\|on_remove\|on_leave)> map
DEFAULT.roles.<(.+)>.<(on_add\|on_remove\|on_leave)>.message str Message sent when the role change happens. (range: min 1) {mention}, welcome to the Sample role!
DEFAULT.roles.<(.+)>.<(on_add\|on_remove\|on_leave)>.mention text Role mentioned in the role-change message. @here
DEFAULT.roles.<(.+)>.<(on_add\|on_remove\|on_leave)>.channel int Channel for the message; -1 sends it as a DM. -1
DEFAULT.reaction map Reaction-role message that hands out roles. channel: 1122334455667788
title: Welcome to {guild}!
roles:
T:
role: Tester
message: Test Role
DEFAULT.reaction.channel text Channel that holds the reaction message. 1122334455667788
DEFAULT.reaction.title str Title of the reaction message embed. (range: min 1) Welcome to {guild}!
DEFAULT.reaction.message str Body text of the reaction message. (range: min 1) Please react to give yourself a role!
DEFAULT.reaction.bot_trap bool Add a trap that kicks bots reacting to the message. true
DEFAULT.reaction.roles map Emoji-to-role mappings for the reaction message. T:
role: Tester
message: Test Role
DEFAULT.reaction.roles.<(.+)> map
DEFAULT.reaction.roles.<(.+)>.role text (required) Role given when the emoji is clicked. Tester
DEFAULT.reaction.roles.<(.+)>.message str (required) Text shown next to this emoji reaction. Test Role