Skip to content
Embed & Message dmChannelID

$dmChannelID

The $dmChannelID[] function returns the DM channel ID (private conversation) between the bot and a given user.

Syntax

$dmChannelID[(userID)]

Parameters

Parameter Description
userID Optional. Accepted (0 or 1 argument) but ignored by the engine.

Return value

  • Type: Snowflake (string)
  • The value of the context variable user.dmChannelId, or an empty string if it is not set.
  • The engine does not create or look up a DM channel.

Behavior

  • The user ID argument does not change the result: the value comes from the command context (user.dmChannelId).
  • When no DM channel ID is present in the context, the result is empty.
  • Nothing in the engine sets user.dmChannelId, so unless the command context is given a variable with that name the result is always an empty string.

Examples

Retrieving the DM ID

$var[dmChannel;$dmChannelID[$authorID]]
$sendMessage[DM channel from the context: $var[dmChannel]]

Logging of DM channel

$log[DM channel of <@$authorID>: $dmChannelID[$authorID]]

Notes

  • To send a private message, use $dm[]: it does not need a channel ID.
  • Because the result is usually empty, do not rely on it to build a destination for $useChannel[].

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.