Перейти к основному содержимому

discord_link_storage

Discord link storage — misc entry.

Entry Information

PropertyValue
Entry IDdiscord_link_storage
TypeMisc
ColorPurple
Iconmdi:database

Description

Manifest entry configuring how Discord linking behaves inside TypeWriter. The /&#123;commandName&#125; command (with its unlink subcommand) is registered through the engine's [CustomCommandEntry] pipeline, so it follows engine reloads without any reflection. / @Entry( name = "discord_link_manifest", description = "Configure Discord linking and role synchronization", color = Colors.BLUE, icon = "mdi:discord", ) @Tags("discord", "link", "manifest") class DiscordLinkManifestEntry( override val id: String = "", override val name: String = "", @Help("Command players run to generate a link code; '<command> unlink' removes the link") val commandName: String = "discordlink", @Help("Artifact entry used to persist link information") val storage: Ref<DiscordLinkArtifactEntry> = emptyRef(), @Help("Webhook used to post link instructions/confirmations") val webhook: WebhookSettings = WebhookSettings(), @Help("Discord Bot configuration for listening to codes and syncing roles") val bot: DiscordBotSettings = DiscordBotSettings(), @Help("Discord text channel ID where the bot listens for verification codes") val verificationChannelId: String = "", @Help("Number of characters for generated verification codes") val codeLength: Int = 6, @Help("Validity duration (in minutes) for generated codes") val codeValidityMinutes: Long = 10, @Help("Automatically overwrite existing links when a new code is confirmed") val autoOverwriteExistingLink: Boolean = false, @Help("Permission required to receive link notifications (empty disables them)") val notifyPermission: String = "discordlink.notify", @Help("Permission checked per mapping to pick the player's group. {group} is replaced by the mapping's Minecraft group") val groupPermissionFormat: String = "group.{group}", @Help("Mappings between Minecraft groups and Discord Role IDs") val roleMappings: List<RoleMapping> = emptyList(), @Help("Entries triggered for the player when their Discord link is confirmed") val onLinkTriggers: List<Ref<com.typewritermc.engine.paper.entry.TriggerableEntry>> = emptyList(), @Help("Player facing messages, including menu text (placeholders: {code}, {duration}, {discord}, {player})") val messages: DiscordLinkMessages = DiscordLinkMessages(), ) : ManifestEntry, CustomCommandEntry { val codeValidity: Duration get() = Duration.ofMinutes(codeValidityMinutes.coerceAtLeast(1)) override fun command(): DslCommand<CommandSourceStack> = command(commandName.ifBlank { "discordlink" }) { executePlayer { player -> CommunityExtension.discordLinkService()?.requestCode(player) ?: player.sendMessage(messages.linkUnavailable.asMini()) } literal("unlink") { executePlayer { player -> CommunityExtension.discordLinkService()?.requestUnlink(player) ?: player.sendMessage(messages.linkUnavailable.asMini()) } } } } /** Artifact entry used to store Discord link data.

Fields

FieldTypeDescription
artifactIdStringUnique identifier for persisted link data

Usage Example

- entry: discord_link_storage
name: "Discord link storage"
artifactId: ""