onLeave

Command executes when a user leaves the guild.

Event: onLeave Type: leaveCommand

Prerequisites

Add the onLeave Event:

bot.addEvent([
    "onMessage",
    "onInteraction",
    "onLeave" //This is what you need to add
])

Add the GUILD_MEMBERS Intent:

const dbd = require("dbd.ts")

const bot = new dbd.Bot({
    intents: ["GUILDS", "GUILD_MESSAGES", "GUILD_MEMBERS"],
    prefix: "PREFIX"
})
//The rest of your index.js file here

Example

bot.commands.add({
  type: "leaveCommand",
  code: `$channelSendMessage[773363417338609674;Sad to see $userTag[$authorID] go :(]`
})

You should use server variables in $channelSendMessage[] (if your bot is in more than 1 server).

Last updated