Skip to content
Entity Info serverID

$serverID[] — Server Identifier

$serverID[] returns the identifier (Snowflake) of the current Discord server.

Syntax

$serverID

Parameters

No parameters.

Return Value

  • Type: string
  • The value of the guild.id context variable supplied by the host (the ID of the current server), or an empty string if the host supplied none.

Examples

Display the ID

$sendMessage[ID of the server: $serverID]

Restrict a command to a specific server

$if[$serverID!=123456789012345678]
  $sendMessage[This command is not available on this server.]
  $stop
$endif
$sendMessage[Command executed successfully!]

Logs with identifier

$log[Action performed on server $serverID ($serverName)]
$sendMessage[Join the general channel: https://discord.com/channels/$serverID/$channelIDFromName[general]]

Notes

  • $serverID and $guildID read the same guild.id value and both accept no argument.
  • Can be used to construct Discord URLs (channels, messages, etc.).

Try it

Paste an example into the playground to preview its message (functions that act on Discord are not run), or build the same thing with blocks.