Discord

Integrating Discord Notifications

Integrating Discord notifications with our plugin allows you to receive updates directly on your Discord server whenever a player registers their documents. This feature enhances communication and engagement within your community. Follow the steps below to set up the Discord hook successfully.

Prerequisites

  • Discord Developer Portal Access: You must have a Discord account and access to the Discord Developer Portal.

  • A Discord Server: The server where you want to receive notifications.

Configuration Steps

  1. Enable Discord Hook:

    • In the plugin's configuration file (config.yml), set discord-hook: enabled to true to activate Discord integration.

  2. Create a Discord Application:

    • Visit the Discord Developer Portal.

    • Click on the "New Application" button. Name your application and create it.

    • Under the "Bot" tab, click on "Add Bot". Confirm the creation.

  3. Copy the Bot Token:

    • Still within the "Bot" tab, find the "Token" section and click "Copy" to copy your bot's token.

    • Paste this token into the token field in your plugin's configuration file.

  4. Invite the Bot to Your Discord Server:

    • In the Developer Portal, navigate to the "OAuth2" tab.

    • Under "Scopes", select "bot". Then, in "Bot Permissions", select the permissions your bot needs.

    • Use the generated URL to invite the bot to your Discord server.

  5. Configure Server and Channel IDs:

    • Guild ID: Right-click your server name and click "Copy ID" to get the guild ID. Paste this into the guild field.

    • Channel ID: Right-click the channel where you want notifications sent and click "Copy ID". Paste this into the channel field.

  6. Customize Notification Appearance:

    • Image URL: Optionally, add an image-url to display an image in the notification.

    • Color: Choose a color for the notification embed. For example, for blue, you'd set color: "BLUE".

  7. Customize Messages:

    • Under messages, configure the message settings for different events, such as registration. You can enable/disable notifications, set titles, subtitles, and message content using placeholders.

Example Configuration

yamlCopy codediscord-hook:
  enabled: true
  token: "discordbottoken"
  guild: "discordserverguild"
  channel: "discordserverchannel"
  image-url: "imageurl"
  color: "BLUE"
  messages:
    register:
      enabled: true
      title: "Documents Registered"
      subtitle: "%player% has been registered"
      msg: "Name: %name% | Surname: %surname% | Age: %age% | Gender: %gender%"

This configuration ensures that when players register their documents, a notification is sent to the specified Discord channel, including details about the registration. Adjust the title, subtitle, and msg fields to match your desired notification format.

Final Steps

After configuring the Discord hook as described, ensure your Discord bot is online and your plugin is correctly set up to listen for the relevant events. Test the functionality by simulating a document registration and checking the designated Discord channel for the notification.

Last updated