Hello, I’m making a discord bot. And I have added a command. In this command, bot detects first argument and other argument. Here my code:
const Printer = require ('fs') const Accounts = JSON.parse (Printer.readFileSync ('./Bot/Database/Accounts.json', 'utf8')) const matchAccount = JSON.parse (Printer.readFileSync ('./Bot/Database/Match Account.json', 'utf8')) exports.Run (Bot, Message, Argument, Permission, Time, Error) => { const User = Argument [0] const findUser = mathAccount [User] const Text = Argument.slice ().join (' ') - User const Author = Message.author const Account = Account [Author.id] const messageNotification = new RichEmbed () .setColor ('#1f1fff') .setTitle (`There is a message from ${User}!`) .setDescription (Text) if (Account) { if (!Text || !User) { if (!Text) Error.setDescription ('Type a text.') if (!User) Error.setDescription ('Type tag of an user. ') Message.channel.send (Error) } else { if (Text.length > 1) { Message.channel.send ( new RichEmbed () .setColor ('#000000') .setDescription ('The message has sent!') ) Bot.users.get (findUser).send (messageSent) } else { Error.setDescription ('The WHAT?') Message.channel.send (Error) } } } else { Error.setDescription ('You must create an account for this.') Message.channel.send (Error) } } exports.Config = { enabled: true, guildOnly: true, Aliases: ['message'], permLevel: 0 } exports.Info = { Name: 'Send Message' }
I type 2 arguments, but it errors Type a text.
How can I fix this?
I may do a mistake at English, if true, sorry.