LogoLogo
  • What is WildBeast?
  • Guides
    • Linux guides
      • Setup
      • Running as a service
  • Fundamentals
    • Commands
      • Slash commands
        • Subcommands
        • Options
        • Buttons
      • Context menu actions
    • Jobs
  • Extras
    • VPS recommendations
    • Creating a bot account
    • Adding your bot to your server
Powered by GitBook
On this page

Was this helpful?

Export as PDF
  1. Fundamentals
  2. Commands

Context menu actions

Add commands to context menus shown on right-click for users and messages

PreviousButtonsNextJobs

Last updated 3 years ago

Was this helpful?

There are 2 types of context menu actions, depending on what the end user is opening the context menu on.

import { Interaction } from 'detritus-client'
import { MessageFlags } from 'detritus-client/lib/constants'

import { BaseContextMenuUserCommand, ContextMenuUserArgs } from '../../base'

export default class InformationCommand extends BaseContextMenuUserCommand {
  name = 'Avatar'

  async run (context: Interaction.InteractionContext, args: ContextMenuUserArgs): Promise<void> {
    await context.editOrRespond({
      embed: {
        description: `${args.user.mention}'s avatar`,
        image: {
          url: `${args.user.avatarUrl}?size=512`
        }
      },
      flags: MessageFlags.EPHEMERAL
    })
  }
}
import { Interaction } from 'detritus-client'
import { MessageFlags } from 'detritus-client/lib/constants'

import { BaseContextMenuMessageCommand, ContextMenuMessageArgs } from '../../base'

export default class InformationCommand extends BaseContextMenuMessageCommand {
  name = 'Message ID'

  async run (context: Interaction.InteractionContext, args: ContextMenuMessageArgs): Promise<void> {
    await context.editOrRespond({
      embed: {
        description: `Message ID: ${args.message.id}`
      },
      flags: MessageFlags.EPHEMERAL
    })
  }
}