Moderation
unpinMessage
$unpinMessage
The function $unpinMessage[] allows removing a message from the pinned messages list of a channel.
Syntax
$unpinMessage[channelID;messageID;(reason)]
Parameters
| Parameter | Description |
|---|---|
channelID |
The ID of the channel containing the message. |
messageID |
The ID of the message to unpin. |
reason |
Optional. Reason recorded in the server’s audit log (up to 512 characters). Empty, or absent, uses the reason set with $auditLogReason, if any. |
Return Value
None (empty string). An error is raised if an ID is invalid or if the bot lacks permissions.
Behavior
- The bot must have the
View ChannelandPin Messagespermissions in the channel (errorMissing permissions for the message operation.otherwise). - The message is fetched first: an ID that does not exist or a channel that does not support messages raises an error.
- The message is not deleted, only unpinned.
Examples
Unpin After Action
$unpinMessage[$channelID;$noMentionMessage]
$sendMessage[Message unpinned.]
Unpin by ID
$unpinMessage[$channelID;$noMentionMessage]
$sendMessage[Message $noMentionMessage is no longer pinned.]
Announcement Rotation
$unpinMessage[$channelID;123456789012345678]
$title[New Announcement]
$description[$noMentionMessage]
$sendMessage[New announcement posted]
$pinMessage
Notes
- A message can be re-pinned after having been unpinned.
- Combine with
$pinMessage[]to manage rotating announcements.
Audit log reason
The last, optional argument reason is the reason shown next to this action in the server’s audit log (Discord’s X-Audit-Log-Reason). Without it, the reason set earlier in the script with $auditLogReason is used; with neither, no reason is recorded.
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.