$onMessageDelete

Triggered when a user deletes a message.

$onMessageDelete[channelID] is a callback, which means it's used in the command trigger (not the code). The command is ran when a user deletes a message.

Syntax

$onMessageDelete[channelID]

Parameters

  • channelID (Type: Snowflake || Flag: Required): The channel to which the resulting message will be sent.

Example

  1. Create a command with the trigger $onMessageDelete[channelID].

    🧙‍♂️ You must replace "channelID" with a valid channel ID or a server variable that holds the channel ID (See more here...)!

    example1

  2. Input your code/reply text.

    🧙‍♂️ You can use functions like $messageID, $getTimestamp here.

    example2

  3. Now, you have a logging message! ✨
    example3
    example4

Advanced

Per-Server $onMessageDelete

Both free and premium users can use $onMessageDelete[], and all users can put $getServerVar[] within $onMessageDelete[]. However, non-premium users can not use $getServerVar[] outside of callbacks.
If you own a public bot and want to make it so multiple different servers can use $onMessageDelete[] (e.g. set their own message logging channel), follow these steps:

  1. Create a variable named "logs" and the value set to nothing.
    image

  2. Create a command for setting the logging channel, then put the following in your code:

    $nomention
    $onlyAdmin[You need the admin permission to use that!]
    $argsCheck[>1;Please mention a channel!]
    Message logging channel updated!
    $setServerVar[logs;$mentionedChannels[1]]
    

    📝 Servers will need to setup the channel they want the logging message to send to (by running a command with the code above).

  3. Now replace $onMessageDelete[channelID] in your command trigger, with $onMessageDelete[$getServerVar[logs]] and you're all set!