Message Commands

Message Commands are similar to User Commands in a way that they perform a single, specific action on a message.

Like User Commands, the names for these commands can contain mixed cases and spaces.

These commands live in the messages directory, and use the defineMessageCommand Definition Function for type support.

TIP

For more advanced uses, visit the Setup Method guide.

Basic Command

import { defineMessageCommand } from 'chooksie'

export default defineMessageCommand({
  name: 'First Word',
  async execute(ctx) {
    const message = ctx.interaction.targetMessage
    const firstWord = message.content.split(' ')[0]
    await ctx.interaction.reply(`The first word is '${firstWord}'!`)
  },
})
import { defineMessageCommand } from 'chooksie'

export default defineMessageCommand({
  name: 'First Word',
  async execute(ctx) {
    const message = ctx.interaction.targetMessage
    const firstWord = message.content.split(' ')[0]
    await ctx.interaction.reply(`The first word is '${firstWord}'!`)
  },
})
const { defineMessageCommand } = require('chooksie')

module.exports = defineMessageCommand({
  name: 'First Word',
  async execute(ctx) {
    const message = ctx.interaction.targetMessage
    const firstWord = message.content.split(' ')[0]
    await ctx.interaction.reply(`The first word is '${firstWord}'!`)
  },
})