Discordapierror: Invalid Form Body DICT_TYPE_CONVERT: Only Dictionaries may be used in a Dicttype

Asked

Viewed 356 times

0

I am making a bot for Discord with Node.js and Discord.js. When I went to make the error command, the error that is in the title occurs:

Discordapierror: Invalid Form Body DICT_TYPE_CONVERT: Only Dictionaries may be used in a Dicttype

Code:

    client.on('message', function(msg) {
        if (msg.content.startsWith(config.prefix) || !msg.author.bot) {
            const user = msg.member;
            const args = msg.content.slice(config.prefix.length).trim().split(' ');
            const command = args.shift();
            var mentionedUser = msg.mentions.members.first();
            if (command === 'ban' && user.hasPermission('BAN_MEMBERS')) {
                mentionedUser.ban(args.join()).then(function() {
                    msg.reply(mentionedUser.toString() + ' banido com sucesso!');
                }).catch(function(e) {
                    msg.reply('Não foi possível banir ' + mentionedUser.toString() + ' devido ao seguinte erro: ' + e);
                });
            }
        }
    });

1 answer

0


For documentation .ban expects these arguments in that specific format:

guildMember.ban({ days: 7, reason: 'They deserved it' })

Try to pass the information in this same format, it should solve your problem

Browser other questions tagged

You are not signed in. Login or sign up in order to post.