Sueta
DI

Discord Notifier

1.02

Send discord messages via commands

·Plugin

This is a simple plugin to send discord messages via commands. I made this just to allow other plugins that run commands on specific events to send discord messages.

Commands:

  • /dn help
  • /dn reload
  • /dn version
  • /dn raw <key> <json>
  • /dn notify <key> <message>
  • /dn keys

Permissions:

  • discordnotifier.help
  • discordnotifier.reload
  • discordnotifier.version
  • discordnotifier.raw
  • discordnotifier.notify
  • discordnotifier.keys
Config.json
{
  "webHooks": {
    "key1": "webhook url",
    "key2": "webhook url 2 etc"
  },
  "notifyJson": {
    "embeds": [
      {
        "title": "Discord Notification from %sender%",
        "description": "%message%"
      }
    ]
  },
  "maxThreads": 4,
  "configVersion": 1
}

Tutorial & Examples

You need to add discord webhook links to the config with a key in order for this plugin to work. Firstly create a webhook on discord:

Example Pictures

Then add it to the config with a key name you would like to call it and reload the config with "/dn reload". In this case, the key is "test234".

Config.json Example
{
  "webHooks": {
    "test234": "https://discordapp.com/api/webhooks/111111111111111111/Ns_Z1MnaLbSgN43FeXUp2HFVnmqU4vXtfvsCS2Bov2AMJnP_g2QCajNXli7tbOvzCnD1"
  },
  "notifyJson": {
    "embeds": [
      {
        "title": "Discord Notification from %sender%",
        "description": "%message%"
      }
    ]
  },
  "maxThreads": 4,
  "configVersion": 1
}

I recommend using https://jsonlint.com/ to validate the json to make sure it's correct. Then you can simply use the command in ways like this with the key you assigned it:
(/dn notify <key> <message>)

/dn notify test234 Hello there!
/dn raw test234 {"content":"raw command example"}

I recommend using something like https://leovoel.github.io/embed-visualizer/ for creating the discord messages you desire. You can also configure the notify command to any message. There are also some special keys you can use in the messages.
%message% = Message
%sender% = Sender's name
%uuid% = UUID of sender, "null" if not a player

Similar projects

Plugin →