I'm trying to write a discord bot.
Now there is one command in which another user is selected. So far, all commands work except for one, checking for the existence of a user.
That's how I do it
if (!userToMarry) {
return message.channel.send('Please try again with a valid user.')}
If there is no such user, then a corresponding message should be displayed.
But instead I get this message:
You provided an invalid userToMarry. Please try again. Respond with cancel to cancel the command. The command will automatically be cancelled in 30 seconds.
How can this be fixed?
The second part of the error bothers me more, because of it the first one occurs, as far as I understand, this is a built-in command from discord.js-commando
Can it be turned off somehow?
Please try again. Respond with cancel to cancel the command. The command will automatically be cancelled in 30 seconds.
const { Command } = require('discord.js-commando');
const db = require("quick.db");
module.exports = class MarryCommand extends Command {
constructor(client) {
super(client, {
name: 'marry',
memberName: 'marry',
group: 'test',
description: 'Marry the mentioned user',
guildOnly: true,
args: [
{
key: 'userToMarry',
prompt: 'Please select the member you wish to marry.',
type: 'member'
}
]
});
}
run(message, { userToMarry }) {
const exists = db.get(`${message.author.id}.user`);
const married = db.get(`${userToMarry.id}.user`);
if (!userToMarry) {
return message.channel.send('Please try again with a valid user.')}
Via Active questions tagged javascript - Stack Overflow https://ift.tt/FUSptel
Comments
Post a Comment