Skip to content

Discord Integration

Lusamine edited this page Dec 1, 2021 · 52 revisions

Discord integration requires configuration in the Hub for it to be functional in a server.

Setup

Create a new Discord Application and Bot for your server on Discord's Developer Portal.

Under the Bot tab, make your bot private to prevent other people from inviting it to their servers and using your Switch.

  • Under Privileged Gateway Intents, enable Presence Intent, Server Members Intent, and Message Content Intent under the same tab.

To invite the Bot to your server, you must generate an OAuth2 URL with the correct permissions. Click on the OAuth2 tab in the sidebar, click URL Generator, select bot under "Scopes," and grant your bot permissions. You will need at minimum:

  • Manage Messages (deletes a user's message to hide their trade code, for privacy)
  • Send Messages
  • Read Message History
  • Attach Files (if convert is used to create a PKM file)
  • Embed Links (for the neat embeds such as in $stats)

Before Starting

Once you have added your Discord bot to your server, paste your Bot Token into the program's Hub config. Do not share the token or other people will be able to access your Discord bot account.

When you Start your bots via the GUI, the Discord bot will be launched.

Configure the bot's settings on your server. If you only want it in a few specific channels, remove all the permissions on the bot's role itself and add the role to specific channels only. Ensure that you do not have any other roles that are restricting the bot's permissions (including the "everyone" role), and you enter any extra codes needed if you have 2FA enabled.

NOTE: Restarting the program will not retain the users that have joined the queue.

Settings

Basic Settings

  • CommandPrefix: Used before all commands. Default is $.
  • ModuleBlacklist: Add the names of any modules you do not want loaded. Separate multiple module names with commas. A full list is available under $help.
  • BotGameStatus: Displays the status of the bot as the game it is playing.
  • HelloResponse: Customized response for $hi.
  • ReturnPKMs: If enabled, the bot will send users a PK8 in PMs when they interact with the trade bot functions.
  • BotColorStatusTradeOnly: If enabled, the bot's presence status on Discord will only be based on Trade-type bots.
  • ReplyCannotUseCommandInChannel: If enabled, the bot will tell users when they cannot use a command. Otherwise, it will ignore them.
  • AsyncCommands: Toggle to handle commands asynchronously or synchronously. Can be left alone.

Role Settings

image
These settings grant permissions to specific roles on Discord. Roles are case-sensitive and must be entered exactly. Comment and ID fields are unused.

  • RoleCanTrade / RoleCanSeedCheck / RoleCanClone / RoleCanDump / RoleRemoteControl: Allow certain roles to use these bot commands. If AllowIfEmpty is set to true, then all users have that permission if no roles are specified.
  • RoleSudo: Gives a role admin powers over the bot. Should not be given out lightly as sudo users can cause damage by changing your bot configurations.

User Settings

image
These settings grant permissions to specific users on Discord. To get a Discord user ID, you need to be in Developer Mode and right-click a user's name to "Copy ID". Comment and Name fields can be used for notes and do not affect function.

  • GlobalSudoList: List of user IDs that have admin powers over the bot in all servers, all channels, everywhere. Turn on AllowGlobalSudo to enable this.
    • Users can be added with the $addsudo @user command or manually edited into the configuration.
    • Users can be removed with the $removesudo @user.
  • UserBlacklist: List of Discord user IDs that cannot trade with the bot.
    • Users can also be added with the $blacklist @user or $blacklistid # commands on Discord or manually added.
    • Users can be removed with the $unblacklist @user and $unblacklistid #.
  • Trade > BannedIDs: List of Nintendo IDs that cannot trade with the bot. This does not use the Discord user ID.

Channel Settings

image
These settings whitelist specific Discord channels by ID for commands and logging. Channel IDs can be obtained in Developer Mode, or a channel can be added with the appropriate command. Comment and Name fields can be used for notes and do not affect function.

  • ChannelWhitelist: list of channel IDs where the bot acknowledges commands.
    • Channels can be whitelisted with $addchannel and removed with $removechannel.
    • If AllowIfEmpty is set to true, then the bot will acknowledge all commands in channels it can see.
  • LoggingChannels: List of channel IDs where the bot posts its logs. If this is set to a public channel, users will be able to see link codes.
    • Logging channels can be added with $loghere and removed with $startclear or $startclearall
  • TradeStartingChannels: List of channel IDs where the bot announces trades by ticket number. Use this if you want to inform users of where they are in the queue so they do not have to constantly spam $qs.
    • Trade Starting channels can be added with $starthere and removed with $logclear or $logclearall
  • EchoChannels: List of channel IDs where the bot announces status changes (e.g. start, stop, idle, queue opening/closing), result matches for EncounterBot, raid start status for RaidBot, and trade abuse detection.
    • Echo channels can be added with $echohere and removed with $echoclear or $echolearall

Refer to the specific bot page or $help commands for more details.

When setting things up (prior to hitting Start for the first time), it is recommended that you close the program afterwards so that your settings are saved -- don't kill the process (if running under a debugger like Visual Studio).

Clone this wiki locally