From 34beee24487f5104f930056cb02def8faacf0bc4 Mon Sep 17 00:00:00 2001 From: Ibrahim Ansari Date: Sat, 8 Sep 2018 18:24:47 +0530 Subject: [PATCH] Fix bot callback, port more commands. Update architecture. I think we should update the architecture and remove... ...curried functions from the equation. --- server/bot/client.ts | 29 +- server/bot/commands/admin.ts | 88 +++---- server/bot/commands/admin/ban.ts | 102 ++++--- server/bot/commands/admin/warn.ts | 248 +++++++++--------- server/bot/{oldCommands => commands}/games.ts | 64 ++--- .../bot/{oldCommands => commands}/gunfight.ts | 16 +- server/bot/commands/tools.ts | 75 +++--- server/bot/imports/types.ts | 9 +- server/bot/index.ts | 6 +- 9 files changed, 312 insertions(+), 325 deletions(-) rename server/bot/{oldCommands => commands}/games.ts (85%) rename server/bot/{oldCommands => commands}/gunfight.ts (93%) diff --git a/server/bot/client.ts b/server/bot/client.ts index 79c82ef..99d1e65 100644 --- a/server/bot/client.ts +++ b/server/bot/client.ts @@ -28,11 +28,12 @@ function isEquivalent (a: { [index: string]: boolean }, b: { [index: string]: bo export class Command { name: string // eslint-disable-next-line no-undef aliases: string[] // eslint-disable-next-line no-undef - generators: (client: Client, db?: DB, mongoDB?: Db) => ({ // eslint-disable-next-line no-undef - generator: IveBotCommandGenerator, - // eslint-disable-next-line no-undef - postGenerator?: (message: Message, args: string[], sent?: Message) => void - }) + // eslint-disable-next-line no-undef + generator: (client: Client, db?: DB, mongoDB?: Db) => IveBotCommandGenerator + // eslint-disable-next-line no-undef + postGenerator?: (client: Client, db?: DB, mongoDB?: Db) => ( + message: Message, args: string[], sent?: Message // eslint-disable-line no-undef + ) => void argsRequired: boolean // eslint-disable-line no-undef caseInsensitive: boolean // eslint-disable-line no-undef deleteCommand: boolean // eslint-disable-line no-undef @@ -42,6 +43,7 @@ export class Command { fullDescription: string // eslint-disable-line no-undef usage: string // eslint-disable-line no-undef example: string // eslint-disable-line no-undef + invalidUsageMessage: string // eslint-disable-line no-undef hidden: boolean // eslint-disable-line no-undef // eslint-disable-next-line no-undef requirements: { // eslint-disable-next-line no-undef @@ -56,9 +58,11 @@ export class Command { // Key functions. this.name = command.name this.aliases = command.aliases - this.generators = command.generators + this.generator = command.generator + this.postGenerator = command.postGenerator // Options. this.argsRequired = command.opts.argsRequired === undefined || command.opts.argsRequired + this.invalidUsageMessage = command.opts.invalidUsageMessage || 'Invalid usage.' // No impl for next. this.caseInsensitive = command.opts.caseInsensitive === undefined || command.opts.caseInsensitive this.deleteCommand = command.opts.deleteCommand @@ -133,7 +137,11 @@ export default class CommandParser { async executeCommand (command: Command, message: Message) { // We give our generators what they need. - const session = command.generators(this.client, this.tempDB, this.db) + const session = { + generator: command.generator(this.client, this.tempDB, this.db), + postGenerator: command.postGenerator + ? command.postGenerator(this.client, this.tempDB, this.db) : undefined + } const args = message.content.split(' ') args.shift() // We check for requirements and arguments. @@ -143,7 +151,7 @@ export default class CommandParser { ) return } else if (args.length === 0 && command.argsRequired) { - message.channel.createMessage('Invalid usage.') + message.channel.createMessage(command.invalidUsageMessage) return // Guild and DM only. } else if (command.guildOnly && message.channel.type !== 0) return @@ -162,7 +170,10 @@ export default class CommandParser { } onMessage (message: Message) { - if (!message.content.split(' ')[0].startsWith('/')) return // Don't process it if it's not a command. + if (!message.content.split(' ')[0].startsWith('/')) { + botCallback(message, this.client, this.tempDB, this.db) + return // Don't process it if it's not a command. + } const commandExec = message.content.split(' ')[0].substr(1).toLowerCase() // Webhook and bot protection. try { if (message.author.bot) return } catch (e) { return } diff --git a/server/bot/commands/admin.ts b/server/bot/commands/admin.ts index 4450a2e..adad130 100644 --- a/server/bot/commands/admin.ts +++ b/server/bot/commands/admin.ts @@ -24,24 +24,22 @@ export const handlePurge: Command = { ) } }, - generators: (client) => ({ - generator: async (message, args) => { - // Check if usage is correct. - if ( - isNaN(+args[0]) || args.length !== 1 || +args[0] <= 0 || +args[0] > 100 - ) { return 'Correct usage: /purge ' } - // Pre-defined variables. - let messages: Array - // Get the list of messages. - try { - messages = await client.getMessages(message.channel.id, +args.shift(), message.id) - } catch (e) { return 'Could not retrieve messages.' } - // Delete the messages. - try { - client.deleteMessages(message.channel.id, messages.map(i => i.id), args.join(' ') || 'Purge') - } catch (e) { return 'Could not delete messages. Are the messages older than 2 weeks?' } - } - }) + generator: (client) => async (message, args) => { + // Check if usage is correct. + if ( + isNaN(+args[0]) || args.length !== 1 || +args[0] <= 0 || +args[0] > 100 + ) { return 'Correct usage: /purge ' } + // Pre-defined variables. + let messages: Array + // Get the list of messages. + try { + messages = await client.getMessages(message.channel.id, +args.shift(), message.id) + } catch (e) { return 'Could not retrieve messages.' } + // Delete the messages. + try { + client.deleteMessages(message.channel.id, messages.map(i => i.id), args.join(' ') || 'Purge') + } catch (e) { return 'Could not delete messages. Are the messages older than 2 weeks?' } + } } export const handleKick: Command = { @@ -54,34 +52,32 @@ export const handleKick: Command = { example: '/kick voldemort you is suck', requirements: { permissions: { 'kickMembers': true } } }, - generators: (client) => ({ - generator: async (message, args) => { - // Find the user ID. - let user = getUser(message, args.shift()) - if (!user) return `Specify a valid member of this guild, ${getInsult()}.` - // If the user cannot kick the person.. - if ( - checkRolePosition(message.member.guild.members.find(i => i.user === user)) >= - checkRolePosition(message.member) - ) { - return `You cannot kick this person, you ${getInsult()}.` - } - // Now we kick the person. - try { - await client.kickGuildMember(message.member.guild.id, user.id, args.join(' ')) - } catch (e) { return 'I am unable to kick that user.' } - client.createMessage((await client.getDMChannel(user.id)).id, args.length !== 0 - ? `You have been kicked from ${message.member.guild.name} for ${args.join(' ')}.` - : `You have been kicked from ${message.member.guild.name}.` + generator: (client) => async (message, args) => { + // Find the user ID. + let user = getUser(message, args.shift()) + if (!user) return `Specify a valid member of this guild, ${getInsult()}.` + // If the user cannot kick the person.. + if ( + checkRolePosition(message.member.guild.members.find(i => i.user === user)) >= + checkRolePosition(message.member) + ) { + return `You cannot kick this person, you ${getInsult()}.` + } + // Now we kick the person. + try { + await client.kickGuildMember(message.member.guild.id, user.id, args.join(' ')) + } catch (e) { return 'I am unable to kick that user.' } + client.createMessage((await client.getDMChannel(user.id)).id, args.length !== 0 + ? `You have been kicked from ${message.member.guild.name} for ${args.join(' ')}.` + : `You have been kicked from ${message.member.guild.name}.` + ) + // WeChill + if (message.member.guild.id === '402423671551164416') { + client.createMessage('402437089557217290', args.length !== 0 + ? `**${user.username}#${user.discriminator}** has been kicked for **${args.join(' ')}**.` + : `**${user.username}#${user.discriminator}** has been kicked for not staying chill >:L ` ) - // WeChill - if (message.member.guild.id === '402423671551164416') { - client.createMessage('402437089557217290', args.length !== 0 - ? `**${user.username}#${user.discriminator}** has been kicked for **${args.join(' ')}**.` - : `**${user.username}#${user.discriminator}** has been kicked for not staying chill >:L ` - ) - } - return `**${user.username}#${user.discriminator}** has been kicked. **rip.**` } - }) + return `**${user.username}#${user.discriminator}** has been kicked. **rip.**` + } } diff --git a/server/bot/commands/admin/ban.ts b/server/bot/commands/admin/ban.ts index 32f2c2a..00d5f19 100644 --- a/server/bot/commands/admin/ban.ts +++ b/server/bot/commands/admin/ban.ts @@ -14,44 +14,42 @@ export const handleBan: Command = { requirements: { permissions: { 'banMembers': true } } }, aliases: ['banana', 'nuke'], - generators: (client) => ({ - generator: async (message, args) => { - // Find the user ID. - const userSpecified = args.shift() - let user: FalseUser|User = getUser(message, userSpecified) - if (!user && client.users.find(i => i.username === userSpecified)) { - user = client.users.find(i => i.username === userSpecified) - } else if (!user && client.users.find(i => i.id === userSpecified)) { - user = client.users.find(i => i.id === userSpecified) - } else if (!user && userSpecified.length === 18 && !isNaN(+userSpecified)) { - user = { id: userSpecified, username: 'Unknown', discriminator: 'user' } - } else return 'I cannot find that user.' - if (!user) return `Specify a valid member of this guild, ${getInsult()}.` - // If the user cannot ban the person.. - if ( - checkRolePosition(message.member.guild.members.find(i => i.user === user)) >= - checkRolePosition(message.member) - ) { - return `You cannot ban this person, you ${getInsult()}.` - } - // Now we ban the person. - try { - await client.banGuildMember(message.member.guild.id, user.id, 0, args.join(' ')) - } catch (e) { return 'That person could not be banned.' } - client.createMessage((await client.getDMChannel(user.id)).id, args.length !== 0 - ? `You have been banned from ${message.member.guild.name} for ${args.join(' ')}.` - : `You have been banned from ${message.member.guild.name}.` + generator: (client) => async (message, args) => { + // Find the user ID. + const userSpecified = args.shift() + let user: FalseUser|User = getUser(message, userSpecified) + if (!user && client.users.find(i => i.username === userSpecified)) { + user = client.users.find(i => i.username === userSpecified) + } else if (!user && client.users.find(i => i.id === userSpecified)) { + user = client.users.find(i => i.id === userSpecified) + } else if (!user && userSpecified.length === 18 && !isNaN(+userSpecified)) { + user = { id: userSpecified, username: 'Unknown', discriminator: 'user' } + } else return 'I cannot find that user.' + if (!user) return `Specify a valid member of this guild, ${getInsult()}.` + // If the user cannot ban the person.. + if ( + checkRolePosition(message.member.guild.members.find(i => i.user === user)) >= + checkRolePosition(message.member) + ) { + return `You cannot ban this person, you ${getInsult()}.` + } + // Now we ban the person. + try { + await client.banGuildMember(message.member.guild.id, user.id, 0, args.join(' ')) + } catch (e) { return 'That person could not be banned.' } + client.createMessage((await client.getDMChannel(user.id)).id, args.length !== 0 + ? `You have been banned from ${message.member.guild.name} for ${args.join(' ')}.` + : `You have been banned from ${message.member.guild.name}.` + ) + // WeChill + if (message.member.guild.id === '402423671551164416') { + client.createMessage('402437089557217290', args.length !== 0 + ? `**${user.username}#${user.discriminator}** has been banned for **${args.join(' ')}**.` + : `**${user.username}#${user.discriminator}** has been banned for not staying chill >:L ` ) - // WeChill - if (message.member.guild.id === '402423671551164416') { - client.createMessage('402437089557217290', args.length !== 0 - ? `**${user.username}#${user.discriminator}** has been banned for **${args.join(' ')}**.` - : `**${user.username}#${user.discriminator}** has been banned for not staying chill >:L ` - ) - } - return `**${user.username}#${user.discriminator}** has been banned. **rip.**` } - }) + return `**${user.username}#${user.discriminator}** has been banned. **rip.**` + } } export const handleUnban: Command = { @@ -64,21 +62,19 @@ export const handleUnban: Command = { guildOnly: true, requirements: { permissions: { 'banMembers': true } } }, - generators: (client) => ({ - generator: async (message, args) => { - // Find the user ID. - const userSpecified = args.shift() - let user: User - if (client.users.find(i => i.username === userSpecified)) { - user = client.users.find(i => i.username === userSpecified) - } else if (client.users.find(i => i.id === userSpecified)) { - user = client.users.find(i => i.id === userSpecified) - } else return 'I cannot find that user.' - // Now we unban the person. - try { - await client.unbanGuildMember(message.member.guild.id, user.id, args.join(' ')) - } catch (e) { return 'That user could not be unbanned.' } - return `**${user.username}#${user.discriminator}** has been unbanned.` - } - }) + generator: (client) => async (message, args) => { + // Find the user ID. + const userSpecified = args.shift() + let user: User + if (client.users.find(i => i.username === userSpecified)) { + user = client.users.find(i => i.username === userSpecified) + } else if (client.users.find(i => i.id === userSpecified)) { + user = client.users.find(i => i.id === userSpecified) + } else return 'I cannot find that user.' + // Now we unban the person. + try { + await client.unbanGuildMember(message.member.guild.id, user.id, args.join(' ')) + } catch (e) { return 'That user could not be unbanned.' } + return `**${user.username}#${user.discriminator}** has been unbanned.` + } } diff --git a/server/bot/commands/admin/warn.ts b/server/bot/commands/admin/warn.ts index 40ed1ee..50b438e 100644 --- a/server/bot/commands/admin/warn.ts +++ b/server/bot/commands/admin/warn.ts @@ -14,49 +14,47 @@ export const handleWarn: Command = { guildOnly: true, requirements: { permissions: { 'manageMessages': true } } }, - generators: ({ createMessage, getDMChannel }, tempDB, db) => ({ - generator: async (message, args) => { - // If improper arguments were provided, then we must inform the user. - if (args.length < 2) return 'Correct usage: /warn ' - // Now find the user ID. - let user = getUser(message, args[0]) - if (!user) return `Specify a valid member of this guild, ${getInsult()}.` - // Respect role order. - if ( - checkRolePosition(message.member.guild.members.find(i => i.user === user)) >= - checkRolePosition(message.member) - ) { - return `You cannot warn this person, you ${getInsult()}.` - } - // Warn the person internally. - args.shift() - await db.collection('warnings').insertOne({ - warnedID: user.id, - warnerID: message.author.id, - reason: args.join(' '), - serverID: message.member.guild.id, - date: new Date().toUTCString() + generator: ({ createMessage, getDMChannel }, tempDB, db) => async (message, args) => { + // If improper arguments were provided, then we must inform the user. + if (args.length < 2) return 'Correct usage: /warn ' + // Now find the user ID. + let user = getUser(message, args[0]) + if (!user) return `Specify a valid member of this guild, ${getInsult()}.` + // Respect role order. + if ( + checkRolePosition(message.member.guild.members.find(i => i.user === user)) >= + checkRolePosition(message.member) + ) { + return `You cannot warn this person, you ${getInsult()}.` + } + // Warn the person internally. + args.shift() + await db.collection('warnings').insertOne({ + warnedID: user.id, + warnerID: message.author.id, + reason: args.join(' '), + serverID: message.member.guild.id, + date: new Date().toUTCString() + }) + createMessage( + (await getDMChannel(user.id)).id, + `You have been warned in ${message.member.guild.name} for: ${args.join(' ')}.` + ) + if (message.member.guild.id === '402423671551164416') { + createMessage('402435742925848578', { + content: `**${user.username}#${user.discriminator}** has been warned:`, + embed: { + color: 0x00AE86, + type: 'rich', + title: 'Information', + description: ` + *| Moderator:** ${message.author.username}#${message.author.discriminator} **| Reason:** ${args.join(' ')} + *| Date:** ${moment(new Date().toUTCString()).format('dddd, MMMM Do YYYY, h:mm:ss A')}` + } }) - createMessage( - (await getDMChannel(user.id)).id, - `You have been warned in ${message.member.guild.name} for: ${args.join(' ')}.` - ) - if (message.member.guild.id === '402423671551164416') { - createMessage('402435742925848578', { - content: `**${user.username}#${user.discriminator}** has been warned:`, - embed: { - color: 0x00AE86, - type: 'rich', - title: 'Information', - description: ` - **| Moderator:** ${message.author.username}#${message.author.discriminator} **| Reason:** ${args.join(' ')} - **| Date:** ${moment(new Date().toUTCString()).format('dddd, MMMM Do YYYY, h:mm:ss A')}` - } - }) - } - return `**${user.username}#${user.discriminator}** has been warned. **lol.**` } - }) + return `**${user.username}#${user.discriminator}** has been warned. **lol.**` + } } export const handleWarnings: Command = { @@ -76,43 +74,41 @@ export const handleWarnings: Command = { ) } }, - generators: (client, tempDB, db) => ({ - generator: async (message, args) => { - // If improper arguments were provided, then we must inform the user. - if (args.length > 1) return 'Correct usage: /warnings (user by ID/username/mention)' - // Now find the user ID. - let user = getUser(message, args[0]) - if (!user && args.length) return `Specify a valid member of this guild, ${getInsult()}.` - else user = message.author - // Get a list of warnings. - const warns = await db.collection('warnings').find({ - warnedID: user.id, serverID: message.member.guild.id - }).toArray() - // If the person has no warnings.. - if (warns.length === 0) return '**No** warnings found.' - // Generate the response. - const format = 'dddd, MMMM Do YYYY, h:mm:ss A' // Date format. - return { - content: `๐Ÿ›ƒ **Warnings for ${message.member.username}#${message.member.discriminator}:**`, - embed: { - color: 0x00AE86, - type: 'rich', - title: 'Warnings', - // This function generates the fields. - fields: warns.map((warning, index) => { - // If we could find the warner then we specify his/her username+discriminator else ID. - const warner = client.users.find(i => i.id === warning.warnerID) - const mod = warner ? `${warner.username}#${warner.discriminator}` : warning.warnerID - return { - name: `Warning ${index + 1}`, - value: `**| Moderator:** ${mod} **| Reason:** ${warning.reason} - **| ID:** ${warning._id} **| Date:** ${moment(warning.date).format(format)}` - } - }) - } + generator: (client, tempDB, db) => async (message, args) => { + // If improper arguments were provided, then we must inform the user. + if (args.length > 1) return 'Correct usage: /warnings (user by ID/username/mention)' + // Now find the user ID. + let user = getUser(message, args[0]) + if (!user && args.length) return `Specify a valid member of this guild, ${getInsult()}.` + else user = message.author + // Get a list of warnings. + const warns = await db.collection('warnings').find({ + warnedID: user.id, serverID: message.member.guild.id + }).toArray() + // If the person has no warnings.. + if (warns.length === 0) return '**No** warnings found.' + // Generate the response. + const format = 'dddd, MMMM Do YYYY, h:mm:ss A' // Date format. + return { + content: `๐Ÿ›ƒ **Warnings for ${message.member.username}#${message.member.discriminator}:**`, + embed: { + color: 0x00AE86, + type: 'rich', + title: 'Warnings', + // This function generates the fields. + fields: warns.map((warning, index) => { + // If we could find the warner then we specify his/her username+discriminator else ID. + const warner = client.users.find(i => i.id === warning.warnerID) + const mod = warner ? `${warner.username}#${warner.discriminator}` : warning.warnerID + return { + name: `Warning ${index + 1}`, + value: `**| Moderator:** ${mod} **| Reason:** ${warning.reason} +**| ID:** ${warning._id} **| Date:** ${moment(warning.date).format(format)}` + } + }) } } - }) + } } export const handleClearwarns: Command = { @@ -126,30 +122,28 @@ export const handleClearwarns: Command = { example: '/clearwarns voldemort', requirements: { permissions: { 'manageMessages': true } } }, - generators: ({ createMessage, getDMChannel }, tempDB, db) => ({ - generator: async (message, args) => { - // If improper arguments were provided, then we must inform the user. - if (args.length !== 1) return 'Correct usage: /clearwarns ' - // Now find the user ID. - let user = getUser(message, args.shift()) - if (!user) return `Specify a valid member of this guild, ${getInsult()}.` - // Respect role order. - if ( - checkRolePosition(message.member.guild.members.find(i => i.user === user)) >= - checkRolePosition(message.member) - ) { - return `You cannot clear the warnings of this person, you ${getInsult()}.` - } - // Clear the warns of the person internally. - try { - await db.collection('warnings').deleteMany({ - warnedID: user.id, serverID: message.member.guild.id - }) - } catch (err) { return `Something went wrong ๐Ÿ‘พ Error: ${err}` } - // Return response. - return `Warnings of **${user.username}#${user.discriminator}** have been **cleared**.` + generator: ({ createMessage, getDMChannel }, tempDB, db) => async (message, args) => { + // If improper arguments were provided, then we must inform the user. + if (args.length !== 1) return 'Correct usage: /clearwarns ' + // Now find the user ID. + let user = getUser(message, args.shift()) + if (!user) return `Specify a valid member of this guild, ${getInsult()}.` + // Respect role order. + if ( + checkRolePosition(message.member.guild.members.find(i => i.user === user)) >= + checkRolePosition(message.member) + ) { + return `You cannot clear the warnings of this person, you ${getInsult()}.` } - }) + // Clear the warns of the person internally. + try { + await db.collection('warnings').deleteMany({ + warnedID: user.id, serverID: message.member.guild.id + }) + } catch (err) { return `Something went wrong ๐Ÿ‘พ Error: ${err}` } + // Return response. + return `Warnings of **${user.username}#${user.discriminator}** have been **cleared**.` + } } export const handleRemovewarn: Command = { @@ -163,37 +157,35 @@ export const handleRemovewarn: Command = { example: '/removewarn voldemort 5adf7a0e825aa7005a4e7be2', requirements: { permissions: { 'manageMessages': true } } }, - generators: ({ createMessage, getDMChannel }, tempDB, db) => ({ - generator: async (message, args) => { - // If improper arguments were provided, then we must inform the user. - if (args.length !== 2) return 'Correct usage: /removewarn ' - // Now find the user ID. - let user = getUser(message, args.shift()) - if (!user) return `Specify a valid member of this guild, ${getInsult()}.` - // Respect role order. - if ( - checkRolePosition(message.member.guild.members.find(i => i.user === user)) >= - checkRolePosition(message.member) - ) { - return `You cannot remove a warning from this person, you ${getInsult()}.` + generator: ({ createMessage, getDMChannel }, tempDB, db) => async (message, args) => { + // If improper arguments were provided, then we must inform the user. + if (args.length !== 2) return 'Correct usage: /removewarn ' + // Now find the user ID. + let user = getUser(message, args.shift()) + if (!user) return `Specify a valid member of this guild, ${getInsult()}.` + // Respect role order. + if ( + checkRolePosition(message.member.guild.members.find(i => i.user === user)) >= + checkRolePosition(message.member) + ) { + return `You cannot remove a warning from this person, you ${getInsult()}.` + } + // Remove the warning of the person internally. + try { + const warn = await db.collection('warnings').findOne({ + _id: new ObjectID(args[0]), serverID: message.member.guild.id + }) + if (!warn) return 'This warning does not exist..' + else if (warn.warnedID !== user.id) { + return 'This warning does not belong to the specified user..' } - // Remove the warning of the person internally. try { - const warn = await db.collection('warnings').findOne({ + await db.collection('warnings').deleteOne({ _id: new ObjectID(args[0]), serverID: message.member.guild.id }) - if (!warn) return 'This warning does not exist..' - else if (warn.warnedID !== user.id) { - return 'This warning does not belong to the specified user..' - } - try { - await db.collection('warnings').deleteOne({ - _id: new ObjectID(args[0]), serverID: message.member.guild.id - }) - } catch (e) { return `Something went wrong ๐Ÿ‘พ Error: ${e}` } - } catch (err) { return `Something went wrong ๐Ÿ‘พ Error: ${err}` } - // Return response. - return '**Warning has been deleted.**' - } - }) + } catch (e) { return `Something went wrong ๐Ÿ‘พ Error: ${e}` } + } catch (err) { return `Something went wrong ๐Ÿ‘พ Error: ${err}` } + // Return response. + return '**Warning has been deleted.**' + } } diff --git a/server/bot/oldCommands/games.ts b/server/bot/commands/games.ts similarity index 85% rename from server/bot/oldCommands/games.ts rename to server/bot/commands/games.ts index 949b914..b963e9a 100644 --- a/server/bot/oldCommands/games.ts +++ b/server/bot/commands/games.ts @@ -1,4 +1,4 @@ -import { IveBotCommand } from '../imports/types' +import { Command } from '../imports/types' import { getDesc } from '../imports/tools' import { eval as eva } from 'mathjs' @@ -23,36 +23,36 @@ const characters = [ // TODO de adaugat u0e49 '\u0356', '\u0359', '\u035a', '\u0323' ] -export const handleChoose: IveBotCommand = (client) => ({ +export const handleChoose: Command = { name: 'choose', + aliases: ['cho'], opts: { - aliases: ['cho'], description: 'Choose between multiple options.', fullDescription: 'Choose between multiple options.', example: '/choose cake|ice cream|pasta', usage: '/choose