Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate over to Slash Commands #38

Open
Olian04 opened this issue Apr 11, 2021 · 0 comments
Open

Migrate over to Slash Commands #38

Olian04 opened this issue Apr 11, 2021 · 0 comments

Comments

@Olian04
Copy link
Owner

Olian04 commented Apr 11, 2021

Prerequisites:

Implementation mock: (based on docs by PR #5448 author)

// The data for our command
const eventCommandData = {
  name: 'event',
  description: 'Create an event!',
  options: [{
    name: 'title',
    type: 'STRING',
    description: 'The title of the event',
    required: true,
  }],
};

client.once('ready', () => {
  // Creating a global command
  client.application.commands.create(eventCommandData);
});

client.on('interaction', interaction => {
  // If the interaction isn't a slash command, return
  if (!interaction.isCommand()) return;

  // Check if it is the correct command
  if (interaction.commandName === 'event') {
    // Get the input of the user
    const title = interaction.options[0].value;

    createEvent(interaction.channel, title);
  }
});

Possible issues:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant