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
  • Usage
  • Example

Was this helpful?

  1. Functions

$clearMessages

Clear messages from a channel.

Usage

$clearMessages[channelID;amount;returnDeletedMessageCount]

This function has three params.

Param
Description
Type
Required

channelID

The channel to clear messages in.

Snowflake

Yes

amount

The amount of message to delete.

Integer

Yes

returnDeletedMessageCount

Whether to return the actual amount of deleted messages.

Boolean

No

Example

bot.commands.add({
  type: "basicCommand",
  name: "clear",
  code: `
  $onlyIf[$hasPerm[$guildID;$authorID;managemessages]==true;You need the manage_messages permission to use that!]
  Successfully purged \`$clearMessages[$channelID;$message;yes]\` messages.
  $onlyIf[$isNumber[$message]==true;Please provide how many messages to clear. Usage: \`!clear (amount)\`]`
})
Previous$clearAllReactionsNext$clearUserMessages

Last updated 3 years ago

Was this helpful?