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?
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.')}