30 lines
927 B
JavaScript
30 lines
927 B
JavaScript
const scenarios = require('../scenario/scenario.js');
|
|
const _ = require('underscore');
|
|
|
|
const helptext = `The \`!alias\` command can be used to find alternative commands that cannot be found with \`!help\``;
|
|
|
|
function alias(context) {
|
|
return new Promise((resolve, reject) => {
|
|
if(context.isHelpRequest) {
|
|
context.message.reply(helptext)
|
|
.then(() => {
|
|
console.info(`[${context.id}] ? alias`);
|
|
resolve();
|
|
}).catch(err => reject(err));
|
|
} else {
|
|
let text = 'Listing aliases\n```';
|
|
_.each(_.keys(context.alias), key => text += `\n${key}`);
|
|
text += '\n```'
|
|
context.message.reply(text)
|
|
.then(() => {
|
|
console.info(`[${context.id}] List alias -> [${context.message.author.id}]`)
|
|
resolve();
|
|
}).catch(err => reject(err));
|
|
}
|
|
});
|
|
}
|
|
|
|
module.exports = commands => {
|
|
commands.alias = alias;
|
|
};
|