* fixing typos * merge Dynamic commands (#3) * Update README.md * Update README.md * fixing typos * dynamically read new commands inside folder. * eslint, update package.json due to moving files Co-authored-by: Marcus Netz <marcus.netz@godyo.com> * fix talent checking on empty arguments list * Origin/message embed (#4) * add first embedded message on tp.js * move db from message commands * fix missing arguments list, add need_args * add global Message Replies. * add more global Message Replies. * more embedded messages. fixing string * missing comma * adding a few more strings on talents. Co-authored-by: Marcus Netz <marcus.netz@godyo.com> * fixing creating from json file * bugfix: db not defined * possible fix for nonworking talent? * fix double msg * fix: aliases are now being used * change: show command displays now some character attributes * added various aliases to commands, added global strings. Co-authored-by: Marcus Netz <marcus.netz@godyo.com>
39 lines
1.0 KiB
JavaScript
39 lines
1.0 KiB
JavaScript
// eslint-disable-next-line no-unused-vars
|
|
const globals = require('../globals')
|
|
const Discord = require('discord.js')
|
|
const db = globals.db
|
|
|
|
module.exports = {
|
|
name: 'show',
|
|
description: '',
|
|
aliases: [],
|
|
usage: '',
|
|
needs_args: false,
|
|
|
|
async exec(message, args) {
|
|
try {
|
|
db.find({
|
|
user: message.author.tag,
|
|
}, function(err, docs) {
|
|
if (!docs.length > 0) {
|
|
return message.reply(globals.Replies.find(r => r.id === 'NOENTRY').string);
|
|
}
|
|
else {
|
|
let gender
|
|
if (docs[0].character.sex == 'female') { gender = '♀️' }
|
|
else { gender = '♂️' }
|
|
const Reply = new Discord.MessageEmbed()
|
|
Reply.setColor('#0099ff')
|
|
Reply.setTitle(gender + ' ' + docs[0].character.name)
|
|
Reply.setDescription(docs[0].character.age + ' Jahre, ' + docs[0].character.race + '/' + docs[0].character.culture)
|
|
Reply.addField(docs[0].character.professionname, docs[0].character.xp.startinglevel)
|
|
|
|
message.reply( Reply );
|
|
}
|
|
});
|
|
}
|
|
catch (e) {
|
|
throw e;
|
|
}
|
|
},
|
|
}; |