dbd.ts
  • Welcome
  • Changelog
  • Guides
    • Adding Events
    • Author-Only Interactions
    • Bot Options
    • Command Handler
    • Context Menus
    • Custom Functions
    • Slash Commands
    • Statuses
    • Variables
  • Callbacks
    • onBotJoin
    • onBotLeave
    • onJoin
    • onLeave
    • onReactionAdd
    • onReactionRemove
    • onReady
    • Space Commands
  • Functions
    • $addActionRow
    • $addButton
    • $addCmdReactions
    • $addField
    • $addSelectMenu
    • $addSelectMenuOption
    • $addThreadMember
    • $addTimestamp
    • $akarui
    • $allMembersCount
    • $approximateMemberCount
    • $approximatePrecenseCount
    • $archiveThread
    • $argCount
    • $attachment
    • $author
    • $authorAvatar
    • $authorID
    • $awaitMessage
    • $ban
    • $banCount
    • $botCount
    • $botLeave
    • $botOwnerID
    • $callFunction
    • $channelCategoryID
    • $channelExists
    • $channelGuildID
    • $channelID
    • $channelName
    • $channelNSFW
    • $channelSendMessage
    • $channelTopic
    • $channelType
    • $checkCondition
    • $clearAllReactions
    • $clearMessages
    • $clearUserMessages
    • $clientID
    • $clientToken
    • $cloneChannel
    • $color
    • $cooldown
    • $cpu
    • $createContextMenuApplication
    • $createFile
    • $createObject
    • $createSlashCommand
    • $createTextChannel
    • $dbPing
    • $defer
    • $delete
    • $deleteChannels
    • $deletecommand
    • $deleteEmojis
    • $deleteMessage
    • $deleteMessageRow
    • $deleteMessageRows
    • $deleteRoles
    • $description
    • $discriminator
    • $divide
    • $djsEval
    • $editMEssage
    • $editMessageRows
    • $endsWith
    • $ephemeral
    • $eval
    • $executionTime
    • $fetchGuildMembers
    • $filter
    • $footer
    • $formatMS
    • $functionCount
    • $get
    • $getChannelSlowmode
    • $getCooldownTime
    • $getServerInvite
    • $getSlashCommandData
    • $getSlashCommandOption
    • $getTimestamp
    • $getUserBadges
    • $guildID
    • $if
    • $ignoreCode
    • $includes
    • $indexOf
    • $isBot
    • $isNumber
    • $kick
    • $let
    • $log
    • $makeReturn
    • $math
    • $packageName
    • $ram
    • $readyTimestamp
    • $replaceText
    • $round
  • Typedefs
    • ApplicationCommandTypes
    • ButtonStyles
    • ComparisonSymbols
    • ImageSizes
    • SlashCommandOptionProperty
    • SlashCommandProperty
Powered by GitBook
On this page
  • Example
  • Events

Was this helpful?

  1. Guides

Adding Events

Events allow you to use callbacks or command types that revolve around a Discord event (e.g. a user joining the server).

bot.addEvent([
    "onMessage", //every bot should have this
    "event2",
    "event3"
])

Example

This example adds every event currently available to the bot. This is not recommended, as you shouldn't use events you don't need. Feel free to edit this code to your needs.

const dbd = require("dbd.ts")

const bot = new dbd.Bot({
    intents: ["GUILDS", "GUILD_MESSAGES"],
    prefix: "PREFIX"
})

bot.addEvent([
    "onMessage",
    "onReady",
    "onInteraction",
    "onJoin",
    "onLeave",
    "onBotJoin",
    "onBotLeave",
    "onReactionAdd",
    "onReactionRemove",
    "onLavalinkSongStart",
    "onLavalinkSongFinish"
])

bot.commands.add({
    type: "basicCommand",
    name: "ping",
    code: `🏓 Pong! $pingms`
})

bot.commands.add({
    type: "basicCommand",
    name: "eval",
    code: `$onlyForIDs[$botOwnerID;]
$eval[$message]`
})

bot.login("TOKEN")

Events

  • onMessage

  • onReady

  • onInteraction

  • onJoin

  • onLeave

  • onBotJoin

  • onBotLeave

  • onReactionAdd

  • onReactionRemove

  • onLavalinkSongStart

  • onLavalinkSongFinish

PreviousChangelogNextAuthor-Only Interactions

Last updated 3 years ago

Was this helpful?