跳到主要内容

Discord Link Manifest

Configure Discord linking and role synchronization

Manifest entry configuring how Discord linking behaves inside TypeWriter. The /{commandName} command (with its unlink subcommand) is registered through the engine's [CustomCommandEntry] pipeline, so it follows engine reloads without any reflection.

字段

字段类型默认值描述
commandNameStringdiscordlinkCommand players run to generate a link code; '<command> unlink' removes the link
storageRef<DiscordLinkArtifactEntry>—Artifact entry used to persist link information
webhookRef<WebhookDefinitionEntry>—Webhook used to post link instructions/confirmations
botDiscordBotSettings—Discord Bot configuration for listening to codes and syncing roles
DiscordBotSettings(4)
字段类型默认值描述
enabledBooleanfalseEnable the bot (required for code verification & role sync)
botTokenString—Bot token from the Discord Developer Portal
guildIdString—Discord server (guild) ID where the bot operates
messagesDiscordBotVerificationMessages—Messages sent by the bot in the verification channel
DiscordBotVerificationMessages(2)
字段类型默认值描述
successStringCode accepted for {player}.Reply posted when a code is accepted (placeholders: {player}, {code})占位符多行
failureStringInvalid code for {player}.Reply posted when a code is rejected/invalid (placeholders: {player}, {code})占位符多行
verificationChannelIdString—Discord text channel ID where the bot listens for verification codes
codeLengthInt6Number of characters for generated verification codes
codeValidityMinutesLong10Validity duration (in minutes) for generated codes
autoOverwriteExistingLinkBooleanfalseAutomatically overwrite existing links when a new code is confirmed
notifyPermissionStringdiscordlink.notifyPermission required to receive link notifications (empty disables them)
groupPermissionFormatStringgroup.{group}Permission checked per mapping to pick the player's group. {group} is replaced by the mapping's Minecraft group
roleMappingsList<RoleMapping>emptyMappings between Minecraft groups and Discord Role IDs
RoleMapping(2)
字段类型默认值描述
minecraftGroupStringdefault—
discordRoleIdString000000000000000000—
onLinkTriggersList<Ref<TriggerableEntry>>emptyEntries triggered for the player when their Discord link is confirmed
messagesDiscordLinkMessages—Player facing messages, including menu text (placeholders: {code}, {duration}, {discord}, {player})
DiscordLinkMessages(11)
字段类型默认值描述
alreadyLinkedStringYou have already linked your Discord account.—
linkInstructionsStringUse the code **{code}** within {duration} on Discord to complete the link.—
codeGeneratedStringA new Discord verification code has been generated: {code} (expires in {duration}).—
pendingExistsStringYou already have a pending code: {code} (expires in {duration}).—
linkConfirmedStringDiscord account {discord} is now linked to {player}.—
linkRevokedStringThe link with {discord} has been revoked.—
unlinkSuccessStringYour Discord account has been unlinked successfully.—
unlinkNoLinkStringYou don't have a Discord account linked.—
linkUnavailableStringDiscord linking is not configured on this server.—
embedLinkedTitleStringDiscord account linked—
embedUnlinkedTitleStringDiscord account unlinked—

How to use it​

This entry registers the player command (commandName, default discordlink) and runs the bot used by the rest of the extension.

  1. Set bot.enabled, bot.botToken and bot.guildId. Without an enabled bot there is no verification and no role sync, and the chat relay, console channel and slash commands cannot work either.
  2. Set storage to a Discord Link Storage artifact, and webhook to the destination where link messages are posted (optional).
  3. Set verificationChannelId: the Discord channel where the player types the code.
  4. The player runs /discordlink, receives a code of codeLength letters and digits valid for codeValidityMinutes, and types it in the channel. The bot reacts with a check or a cross, and deletes an accepted code.
  5. roleMappings pairs a minecraftGroup with a discordRoleId. A player gets the role of the first mapping whose permission (groupPermissionFormat, where {group} is replaced by the group) they hold. Roles are synced when the link is confirmed and each time the player joins.
  6. onLinkTriggers runs entries for the player when the link is confirmed, for example a reward.

The messages can use {code}, {duration}, {discord} and {player} depending on the message.