0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

discord.js/buildersのoption設定で出るArgumentErrorについて

Posted at

コード

const { SlashCommandBuilder } = require('@discordjs/builders');

module.exports = {
    data : new SlashCommandBuilder()
        .setName("add")
        .setDescription("---")
        .addIntegerOption(option=>
            option.setName("A")
                .setDescription("---")
                .setRequired(true)),
    async execute(interaction){
    }

エラー内容

 throw new argument_error_1.ArgumentError(message, main, errors);
            ^

ArgumentError: Expected string `name` to be lowercase, got `A`
    at Object.ow [as default]

解決方法

option.setNameに大文字や英語以外を入れるとエラーが出ます。英語の小文字を入力するようにしましょう。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?