diff --git a/package.json b/package.json index ee992042..717cd74a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "kwako", - "version": "1.0.3", + "version": "1.0.4", "description": "", "main": "build/index.js", "scripts": { diff --git a/src/commands/actions/cry.ts b/src/commands/actions/cry.ts index 08ae695f..c99945e2 100644 --- a/src/commands/actions/cry.ts +++ b/src/commands/actions/cry.ts @@ -19,7 +19,7 @@ module.exports.run = async (bot: Client, msg: Message, args: any, db: any, log: return msg.channel.send(embed) .then(() => { - log.info({msg: 'cry', author: { id: msg.author.id, name: msg.author.tag }, guild: msg.guild.id}); + log.info({msg: 'cry', author: { id: msg.author.id, name: msg.author.tag }, guild: { id: msg.guild.id, name: msg.guild.name }}); }) .catch(console.error); }; diff --git a/src/commands/actions/facepalm.ts b/src/commands/actions/facepalm.ts index a256f67b..98c2d722 100644 --- a/src/commands/actions/facepalm.ts +++ b/src/commands/actions/facepalm.ts @@ -9,7 +9,7 @@ module.exports.run = async (bot: Client, msg: Message, args: any, db: any, log: return msg.channel.send(embed) .then(() => { - log.info({msg: 'facepalm', author: { id: msg.author.id, name: msg.author.tag }, guild: msg.guild.id}); + log.info({msg: 'facepalm', author: { id: msg.author.id, name: msg.author.tag }, guild: { id: msg.guild.id, name: msg.guild.name }}); }) .catch(log.error); }; diff --git a/src/commands/actions/highfive.ts b/src/commands/actions/highfive.ts index 022d220a..d643dfa3 100644 --- a/src/commands/actions/highfive.ts +++ b/src/commands/actions/highfive.ts @@ -67,7 +67,7 @@ module.exports.run = async (bot: Client, msg: Message, args: string[], db: Db, l await db.collection('user').updateOne({ '_id': { $eq: mention.id } }, { $inc: { highfive: 1 } }); return msg.channel.send(embed) .then(() => { - log.info({msg: 'highfive', author: { id: msg.author.id, name: msg.author.tag }, guild: msg.guild.id}); + log.info({msg: 'highfive', author: { id: msg.author.id, name: msg.author.tag }, guild: { id: msg.guild.id, name: msg.guild.name }}); }) .catch(log.error); } else { diff --git a/src/commands/actions/wave.ts b/src/commands/actions/wave.ts index 13507fee..32bc63d8 100644 --- a/src/commands/actions/wave.ts +++ b/src/commands/actions/wave.ts @@ -19,7 +19,7 @@ module.exports.run = async (bot: Client, msg: Message, args: any, db: any, log: return msg.channel.send(embed) .then(() => { - log.info({msg: 'wave', author: { id: msg.author.id, name: msg.author.tag }, guild: msg.guild.id}); + log.info({msg: 'wave', author: { id: msg.author.id, name: msg.author.tag }, guild: { id: msg.guild.id, name: msg.guild.name }}); }) .catch(log.error); }; diff --git a/src/commands/config/addembed.ts b/src/commands/config/addembed.ts index ff81aa25..80d70fc0 100644 --- a/src/commands/config/addembed.ts +++ b/src/commands/config/addembed.ts @@ -19,7 +19,7 @@ module.exports.run = async (bot: Client, msg: Message, args: string[], db: Db, l await db.collection('msg').insertOne({ _id: sent.id, channel: sent.channel.id }) - log.info({msg: 'addembed', author: { id: msg.author.id, name: msg.author.tag }, guild: msg.guild.id}) + log.info({msg: 'addembed', author: { id: msg.author.id, name: msg.author.tag }, guild: { id: msg.guild.id, name: msg.guild.name }}) }; module.exports.help = { diff --git a/src/commands/config/addlevelrole.ts b/src/commands/config/addlevelrole.ts index 46e8c861..dab398fc 100644 --- a/src/commands/config/addlevelrole.ts +++ b/src/commands/config/addlevelrole.ts @@ -48,7 +48,7 @@ module.exports.run = async (bot: Client, msg: Message, args: string[], db: Db, l if (previous) await msg.channel.send(`When I'll give this role, I'll remove <@&${previous}>.`) - log.info({msg: 'addlevelrole', author: { id: msg.author.id, name: msg.author.tag }, guild: msg.guild.id, level: { id: args[0], role: role }}) + log.info({msg: 'addlevelrole', author: { id: msg.author.id, name: msg.author.tag }, guild: { id: msg.guild.id, name: msg.guild.name }, level: { id: args[0], role: role }}) }; module.exports.help = { diff --git a/src/commands/config/addrole.ts b/src/commands/config/addrole.ts index 63679983..7f8a4b49 100644 --- a/src/commands/config/addrole.ts +++ b/src/commands/config/addrole.ts @@ -36,7 +36,7 @@ module.exports.run = async (bot: Client, msg: Message, args: string[], db: Db, l await db.collection('msg').updateOne({ _id: args[0] }, { $push: { roles: { "id": role, "emote": emote } } }) - log.info({msg: 'addrole', author: { id: msg.author.id, name: msg.author.tag }, guild: msg.guild.id, role: { id: role, emote: emote }}) + log.info({msg: 'addrole', author: { id: msg.author.id, name: msg.author.tag }, guild: { id: msg.guild.id, name: msg.guild.name }, role: { id: role, emote: emote }}) }; module.exports.help = { diff --git a/src/commands/config/delembed.ts b/src/commands/config/delembed.ts index 3ee6c390..529dbacd 100644 --- a/src/commands/config/delembed.ts +++ b/src/commands/config/delembed.ts @@ -21,7 +21,7 @@ module.exports.run = async (bot: Client, msg: Message, args: string[], db: Db, l await db.collection('msg').deleteOne({ _id: args[0] }) - log.info({msg: 'delembed', author: { id: msg.author.id, name: msg.author.tag }, guild: msg.guild.id}) + log.info({msg: 'delembed', author: { id: msg.author.id, name: msg.author.tag }, guild: { id: msg.guild.id, name: msg.guild.name }}) }; module.exports.help = { diff --git a/src/commands/config/dellevelrole.ts b/src/commands/config/dellevelrole.ts index d227c7e8..2646e790 100644 --- a/src/commands/config/dellevelrole.ts +++ b/src/commands/config/dellevelrole.ts @@ -24,7 +24,7 @@ module.exports.run = async (bot: Client, msg: Message, args: string[], db: Db, l await msg.channel.send(`I'll no longer give a role when members achieve the level **${args[0]}**.`); - log.info({msg: 'dellevelrole', author: { id: msg.author.id, name: msg.author.tag }, guild: msg.guild.id, level: args[0]}) + log.info({msg: 'dellevelrole', author: { id: msg.author.id, name: msg.author.tag }, guild: { id: msg.guild.id, name: msg.guild.name }, level: args[0]}) }; module.exports.help = { diff --git a/src/commands/config/delrole.ts b/src/commands/config/delrole.ts index 23121ba8..b5522b0c 100644 --- a/src/commands/config/delrole.ts +++ b/src/commands/config/delrole.ts @@ -24,7 +24,7 @@ module.exports.run = async (bot: Client, msg: Message, args: string[], db: Db, l await db.collection('msg').updateOne({ _id: args[0] }, { $pull: { roles: { "emote": emote } } }) - log.info({msg: 'delrole', author: { id: msg.author.id, name: msg.author.tag }, guild: msg.guild.id}) + log.info({msg: 'delrole', author: { id: msg.author.id, name: msg.author.tag }, guild: { id: msg.guild.id, name: msg.guild.name }}) }; module.exports.help = { diff --git a/src/commands/config/disable.ts b/src/commands/config/disable.ts index ee982320..4c863ef1 100644 --- a/src/commands/config/disable.ts +++ b/src/commands/config/disable.ts @@ -29,7 +29,7 @@ module.exports.run = async (bot: Client, msg: Message, args: string[], db: Db, l } }) - log.info({msg: 'disable', author: { id: msg.author.id, name: msg.author.tag }, guild: msg.guild.id, command: cmd.help.name}) + log.info({msg: 'disable', author: { id: msg.author.id, name: msg.author.tag }, guild: { id: msg.guild.id, name: msg.guild.name }, command: cmd.help.name}) }; module.exports.help = { diff --git a/src/commands/config/disabled.ts b/src/commands/config/disabled.ts index f5f69398..d4ebfcb6 100644 --- a/src/commands/config/disabled.ts +++ b/src/commands/config/disabled.ts @@ -21,7 +21,7 @@ module.exports.run = async (bot: Client, msg: Message, args: string[], db: Db, l await msg.channel.send(embed) - log.info({msg: 'disabled', author: { id: msg.author.id, name: msg.author.tag }, guild: msg.guild.id}) + log.info({msg: 'disabled', author: { id: msg.author.id, name: msg.author.tag }, guild: { id: msg.guild.id, name: msg.guild.name }}) }; module.exports.help = { diff --git a/src/commands/config/editembed.ts b/src/commands/config/editembed.ts index 36c1a5b2..757783cf 100644 --- a/src/commands/config/editembed.ts +++ b/src/commands/config/editembed.ts @@ -24,7 +24,7 @@ module.exports.run = async (bot: Client, msg: Message, args: string[], db: Db, l } } - log.info({msg: 'editembed', author: { id: msg.author.id, name: msg.author.tag }, guild: msg.guild.id}) + log.info({msg: 'editembed', author: { id: msg.author.id, name: msg.author.tag }, guild: { id: msg.guild.id, name: msg.guild.name }}) }; module.exports.help = { diff --git a/src/commands/config/enable.ts b/src/commands/config/enable.ts index c8ea21d4..2b0e0c35 100644 --- a/src/commands/config/enable.ts +++ b/src/commands/config/enable.ts @@ -26,7 +26,7 @@ module.exports.run = async (bot: Client, msg: Message, args: string[], db: Db, l } }) - log.info({msg: 'enable', author: { id: msg.author.id, name: msg.author.tag }, guild: msg.guild.id}) + log.info({msg: 'enable', author: { id: msg.author.id, name: msg.author.tag }, guild: { id: msg.guild.id, name: msg.guild.name }}) }; module.exports.help = { diff --git a/src/commands/config/setconf.ts b/src/commands/config/setconf.ts index 44c38b96..78ae2049 100644 --- a/src/commands/config/setconf.ts +++ b/src/commands/config/setconf.ts @@ -6,7 +6,7 @@ module.exports.run = async (bot: Client, msg: Message, args: any, db: any, log: await msg.channel.send(`**☁️ Please now use Kwako Web Dashboard to configure the bot**\nhttps://kwako.iwa.sh`); - log.info({msg: 'setconf', author: { id: msg.author.id, name: msg.author.tag }, guild: msg.guild.id}) + log.info({msg: 'setconf', author: { id: msg.author.id, name: msg.author.tag }, guild: { id: msg.guild.id, name: msg.guild.name }}) }; module.exports.help = { diff --git a/src/commands/games/8ball.ts b/src/commands/games/8ball.ts index edece221..914f86db 100644 --- a/src/commands/games/8ball.ts +++ b/src/commands/games/8ball.ts @@ -10,7 +10,7 @@ module.exports.run = async (bot: Client, msg: Message, args: string[], db: any, const embed = new MessageEmbed(); embed.setTitle(`🎱 ${reply[r]}`) embed.setColor('GREY') - log.info({msg: '8ball', author: { id: msg.author.id, name: msg.author.tag }, guild: msg.guild.id}) + log.info({msg: '8ball', author: { id: msg.author.id, name: msg.author.tag }, guild: { id: msg.guild.id, name: msg.guild.name }}) return msg.channel.send(embed) }; diff --git a/src/commands/games/flip.ts b/src/commands/games/flip.ts index dce38ff8..02c3e64d 100644 --- a/src/commands/games/flip.ts +++ b/src/commands/games/flip.ts @@ -8,7 +8,7 @@ module.exports.run = (bot: Client, msg: Message, args: any, db: any, log: Logger msg.channel.send({ "embed": { "title": ":large_blue_diamond: **Heads**" } }) else msg.channel.send({ "embed": { "title": ":large_orange_diamond: **Tails**" } }) - return log.info({msg: 'flip', author: { id: msg.author.id, name: msg.author.tag }, guild: msg.guild.id}) + return log.info({msg: 'flip', author: { id: msg.author.id, name: msg.author.tag }, guild: { id: msg.guild.id, name: msg.guild.name }}) }; module.exports.help = { diff --git a/src/commands/games/roll.ts b/src/commands/games/roll.ts index adb1554e..cb90a058 100644 --- a/src/commands/games/roll.ts +++ b/src/commands/games/roll.ts @@ -11,7 +11,7 @@ module.exports.run = (bot: Client, msg: Message, args: string[], db: any, log: L "color": 5601658 } }) - .then(() => { log.info({msg: 'roll', author: { id: msg.author.id, name: msg.author.tag }, guild: msg.guild.id, x: x}) }) + .then(() => { log.info({msg: 'roll', author: { id: msg.author.id, name: msg.author.tag }, guild: { id: msg.guild.id, name: msg.guild.name }, x: x}) }) .catch(log.error); } else { msg.channel.send({ @@ -20,7 +20,7 @@ module.exports.run = (bot: Client, msg: Message, args: string[], db: any, log: L "color": 5601658 } }) - .then(() => { log.info({msg: 'roll', author: { id: msg.author.id, name: msg.author.tag }, guild: msg.guild.id, x: 100}) }) + .then(() => { log.info({msg: 'roll', author: { id: msg.author.id, name: msg.author.tag }, guild: { id: msg.guild.id, name: msg.guild.name }, x: 100}) }) .catch(log.error); } }; diff --git a/src/commands/games/rps.ts b/src/commands/games/rps.ts index c2ee0bfa..fbfb811d 100644 --- a/src/commands/games/rps.ts +++ b/src/commands/games/rps.ts @@ -44,7 +44,7 @@ module.exports.run = (bot: Client, msg: Message, args: string[], db: any, log: L embed.setDescription(res); - log.info({msg: 'rps', author: { id: msg.author.id, name: msg.author.tag }, guild: msg.guild.id}) + log.info({msg: 'rps', author: { id: msg.author.id, name: msg.author.tag }, guild: { id: msg.guild.id, name: msg.guild.name }}) return msg.channel.send(embed).catch(log.error) }; diff --git a/src/commands/mod/ban.ts b/src/commands/mod/ban.ts index 5597a290..5db07b95 100644 --- a/src/commands/mod/ban.ts +++ b/src/commands/mod/ban.ts @@ -34,7 +34,7 @@ module.exports.run = async (bot: Client, msg: Message, args:string[], db: any, l await msg.channel.send("I can't ban this person!") } - log.info({msg: 'ban', author: { id: msg.author.id, name: msg.author.tag }, guild: msg.guild.id, target: { id: mention.id, name: mention.user.tag, reason: reason }}); + log.info({msg: 'ban', author: { id: msg.author.id, name: msg.author.tag }, guild: { id: msg.guild.id, name: msg.guild.name }, target: { id: mention.id, name: mention.user.tag, reason: reason }}); } }; diff --git a/src/commands/mod/kick.ts b/src/commands/mod/kick.ts index e7e6798e..d9f81839 100644 --- a/src/commands/mod/kick.ts +++ b/src/commands/mod/kick.ts @@ -34,7 +34,7 @@ module.exports.run = async (bot: Client, msg: Message, args:string[], db: any, l await msg.channel.send("I can't kick this person!") } - log.info({msg: 'setconf', author: { id: msg.author.id, name: msg.author.tag }, guild: msg.guild.id, target: { id: mention.id, name: mention.user.tag, reason: reason }}) + log.info({msg: 'setconf', author: { id: msg.author.id, name: msg.author.tag }, guild: { id: msg.guild.id, name: msg.guild.name }, target: { id: mention.id, name: mention.user.tag, reason: reason }}) } }; diff --git a/src/commands/mod/lock.ts b/src/commands/mod/lock.ts index 0af7c1a1..a344ce4f 100644 --- a/src/commands/mod/lock.ts +++ b/src/commands/mod/lock.ts @@ -17,7 +17,7 @@ module.exports.run = async (bot: Client, msg: Message, args: any, db: any, log: try { await msg.channel.send(embed); - log.info({msg: 'lock', author: { id: msg.author.id, name: msg.author.tag }, guild: msg.guild.id, channel: msg.channel.id}) + log.info({msg: 'lock', author: { id: msg.author.id, name: msg.author.tag }, guild: { id: msg.guild.id, name: msg.guild.name }, channel: msg.channel.id}) } catch (err) { log.error(err); } diff --git a/src/commands/mod/unlock.ts b/src/commands/mod/unlock.ts index b0982fa9..e25276c6 100644 --- a/src/commands/mod/unlock.ts +++ b/src/commands/mod/unlock.ts @@ -17,7 +17,7 @@ module.exports.run = async (bot: Client, msg: Message, args: any, db: any, log: try { await msg.channel.send(embed); - log.info({msg: 'unlock', author: { id: msg.author.id, name: msg.author.tag }, guild: msg.guild.id, channel: msg.channel.id}) + log.info({msg: 'unlock', author: { id: msg.author.id, name: msg.author.tag }, guild: { id: msg.guild.id, name: msg.guild.name }, channel: msg.channel.id}) } catch (err) { log.error(err); } diff --git a/src/commands/profile/fc.ts b/src/commands/profile/fc.ts index f883314e..d6d73ab9 100644 --- a/src/commands/profile/fc.ts +++ b/src/commands/profile/fc.ts @@ -7,10 +7,10 @@ module.exports.run = async (bot: Client, msg: Message, args: string[], db: Db, l if (msg.mentions.everyone) return; let mention = msg.mentions.users.first() if (!mention) return; - log.info({msg: 'fc', author: { id: msg.author.id, name: msg.author.tag }, guild: msg.guild.id, target: { id: mention.id, name: mention.tag }}); + log.info({msg: 'fc', author: { id: msg.author.id, name: msg.author.tag }, guild: { id: msg.guild.id, name: msg.guild.name }, target: { id: mention.id, name: mention.tag }}); return printFc(bot, msg, db, mention.id, guildConf.prefix); } else { - log.info({msg: 'fc', author: { id: msg.author.id, name: msg.author.tag }, guild: msg.guild.id, target: { id: msg.author.id, name: msg.author.tag, }}); + log.info({msg: 'fc', author: { id: msg.author.id, name: msg.author.tag }, guild: { id: msg.guild.id, name: msg.guild.name }, target: { id: msg.author.id, name: msg.author.tag, }}); return printFc(bot, msg, db, msg.author.id, guildConf.prefix); } }; diff --git a/src/commands/profile/profile.ts b/src/commands/profile/profile.ts index c9abd440..43565fc5 100644 --- a/src/commands/profile/profile.ts +++ b/src/commands/profile/profile.ts @@ -48,7 +48,7 @@ async function profileImg(bot: Client, msg: Message, db: Db, log: Logger, id: st let file = await imGenerator(user); try { - log.info({msg: 'profile', author: { id: msg.author.id, name: msg.author.tag }, guild: msg.guild.id, target: { id: userDiscord.id, name: userDiscord.tag }}); + log.info({msg: 'profile', author: { id: msg.author.id, name: msg.author.tag }, guild: { id: msg.guild.id, name: msg.guild.name }, target: { id: userDiscord.id, name: userDiscord.tag }}); return msg.channel.send('', { files: [file] }).then(() => { msg.channel.stopTyping(true) }); } catch (err) { log.error(err) @@ -79,7 +79,7 @@ async function profileImg(bot: Client, msg: Message, db: Db, log: Logger, id: st let file = await imGenerator(user); try { - log.info({msg: 'profile', author: { id: msg.author.id, name: msg.author.tag }, guild: msg.guild.id, target: { id: userDiscord.id, name: userDiscord.tag }}); + log.info({msg: 'profile', author: { id: msg.author.id, name: msg.author.tag }, guild: { id: msg.guild.id, name: msg.guild.name }, target: { id: userDiscord.id, name: userDiscord.tag }}); return msg.channel.send('', { files: [file] }).then(() => { msg.channel.stopTyping(true) }); } catch (err) { log.error(err) diff --git a/src/commands/profile/setbackground.ts b/src/commands/profile/setbackground.ts index 1819047f..e86fe716 100644 --- a/src/commands/profile/setbackground.ts +++ b/src/commands/profile/setbackground.ts @@ -78,7 +78,7 @@ module.exports.run = async (bot: Client, msg: Message, args: string[], db: Db, l } }) - log.info({msg: 'setbackground', author: { id: msg.author.id, name: msg.author.tag }, guild: msg.guild.id, image: url }); + log.info({msg: 'setbackground', author: { id: msg.author.id, name: msg.author.tag }, guild: { id: msg.guild.id, name: msg.guild.name }, image: url }); }; module.exports.help = { diff --git a/src/commands/profile/setbirthday.ts b/src/commands/profile/setbirthday.ts index cf5a6d00..ebd570d9 100644 --- a/src/commands/profile/setbirthday.ts +++ b/src/commands/profile/setbirthday.ts @@ -51,7 +51,7 @@ module.exports.run = async (bot: Client, msg: Message, args: string[], db: Db, l embed.setColor('AQUA') try { - log.info({msg: 'setbirthday', author: { id: msg.author.id, name: msg.author.tag }, guild: msg.guild.id, date: today}); + log.info({msg: 'setbirthday', author: { id: msg.author.id, name: msg.author.tag }, guild: { id: msg.guild.id, name: msg.guild.name }, date: today}); return msg.channel.send(embed); } catch (err) { log.error(err); diff --git a/src/commands/profile/setfc.ts b/src/commands/profile/setfc.ts index 58d03345..71b51a16 100644 --- a/src/commands/profile/setfc.ts +++ b/src/commands/profile/setfc.ts @@ -21,7 +21,7 @@ module.exports.run = async (bot: Client, msg: Message, args: string[], db: Db, l log.error(ex) } } - log.info({msg: 'setfc', author: { id: msg.author.id, name: msg.author.tag }, guild: msg.guild.id, fc: 'off'}); + log.info({msg: 'setfc', author: { id: msg.author.id, name: msg.author.tag }, guild: { id: msg.guild.id, name: msg.guild.name }, fc: 'off'}); return msg.channel.send({ "embed": { "author": { @@ -43,7 +43,7 @@ module.exports.run = async (bot: Client, msg: Message, args: string[], db: Db, l embed.setTitle(`**${content}**`) embed.setColor('AQUA') try { - log.info({msg: 'setfc', author: { id: msg.author.id, name: msg.author.tag }, guild: msg.guild.id, fc: content}); + log.info({msg: 'setfc', author: { id: msg.author.id, name: msg.author.tag }, guild: { id: msg.guild.id, name: msg.guild.name }, fc: content}); return msg.channel.send(embed); } catch (err) { log.error(err); diff --git a/src/commands/suggestions/approve.ts b/src/commands/suggestions/approve.ts index f9c285e9..0623d18f 100644 --- a/src/commands/suggestions/approve.ts +++ b/src/commands/suggestions/approve.ts @@ -42,7 +42,7 @@ module.exports.run = async (bot: Client, msg: Message, args: string[], db: Db, l await suggestion.edit(embed); - log.info({msg: 'approve', author: { id: msg.author.id, name: msg.author.tag }, guild: msg.guild.id}); + log.info({msg: 'approve', author: { id: msg.author.id, name: msg.author.tag }, guild: { id: msg.guild.id, name: msg.guild.name }}); return msg.react('✅'); }; diff --git a/src/commands/suggestions/consider.ts b/src/commands/suggestions/consider.ts index 5bd1b3cc..ca1d7f17 100644 --- a/src/commands/suggestions/consider.ts +++ b/src/commands/suggestions/consider.ts @@ -42,7 +42,7 @@ module.exports.run = async (bot: Client, msg: Message, args: string[], db: Db, l await suggestion.edit(embed); - log.info({msg: 'consider', author: { id: msg.author.id, name: msg.author.tag }, guild: msg.guild.id}); + log.info({msg: 'consider', author: { id: msg.author.id, name: msg.author.tag }, guild: { id: msg.guild.id, name: msg.guild.name }}); return msg.react('✅'); }; diff --git a/src/commands/suggestions/deny.ts b/src/commands/suggestions/deny.ts index 8df09a3e..0961ed1c 100644 --- a/src/commands/suggestions/deny.ts +++ b/src/commands/suggestions/deny.ts @@ -42,7 +42,7 @@ module.exports.run = async (bot: Client, msg: Message, args: string[], db: Db, l await suggestion.edit(embed); - log.info({msg: 'deny', author: { id: msg.author.id, name: msg.author.tag }, guild: msg.guild.id}); + log.info({msg: 'deny', author: { id: msg.author.id, name: msg.author.tag }, guild: { id: msg.guild.id, name: msg.guild.name }}); return msg.react('✅'); }; diff --git a/src/commands/suggestions/implemented.ts b/src/commands/suggestions/implemented.ts index d73fd8d3..44399592 100644 --- a/src/commands/suggestions/implemented.ts +++ b/src/commands/suggestions/implemented.ts @@ -37,7 +37,7 @@ module.exports.run = async (bot: Client, msg: Message, args: string[], db: Db, l await suggestion.edit(embed); - log.info({msg: 'implemented', author: { id: msg.author.id, name: msg.author.tag }, guild: msg.guild.id}); + log.info({msg: 'implemented', author: { id: msg.author.id, name: msg.author.tag }, guild: { id: msg.guild.id, name: msg.guild.name }}); return msg.react('✅'); }; diff --git a/src/commands/utility/anime.ts b/src/commands/utility/anime.ts index 19de7e1d..6a7316cb 100644 --- a/src/commands/utility/anime.ts +++ b/src/commands/utility/anime.ts @@ -68,7 +68,7 @@ module.exports.run = (bot: Client, msg: Message, args: string[], db: any, log: L embed.setColor('BLUE') embed.setURL(info.siteUrl) - log.info({msg: 'anime', author: { id: msg.author.id, name: msg.author.tag }, guild: msg.guild.id, request: req}); + log.info({msg: 'anime', author: { id: msg.author.id, name: msg.author.tag }, guild: { id: msg.guild.id, name: msg.guild.name }, request: req}); return msg.channel.send(embed) }).catch((err: any) => { log.error(err) diff --git a/src/commands/utility/help.ts b/src/commands/utility/help.ts index 795d5ba4..cad98d84 100644 --- a/src/commands/utility/help.ts +++ b/src/commands/utility/help.ts @@ -67,10 +67,11 @@ module.exports.run = async (bot: Client, msg: Message, args: string[], db: Db, l embed.addField("Usage", `\`${guildConf.prefix}${cmd.help.usage}\``, true); if (cmd.help.aliases) { + let aliases = [...cmd.help.aliases] for(let i = 0; i < cmd.help.aliases.length; i++) - cmd.help.aliases[i] = `${guildConf.prefix}${cmd.help.aliases[i]}`; + aliases[i] = `${guildConf.prefix}${cmd.help.aliases[i]}`; - embed.addField("Aliases", `${cmd.help.aliases.toString()}`, true); + embed.addField("Aliases", `${aliases.toString()}`, true); } embed.addField("Description", `${cmd.help.desc}`); @@ -79,7 +80,7 @@ module.exports.run = async (bot: Client, msg: Message, args: string[], db: Db, l } else sendHelp(msg, guildConf); - log.info({msg: 'help', author: { id: msg.author.id, name: msg.author.tag }, guild: msg.guild.id}); + log.info({msg: 'help', author: { id: msg.author.id, name: msg.author.tag }, guild: { id: msg.guild.id, name: msg.guild.name }}); } module.exports.help = { diff --git a/src/commands/utility/invite.ts b/src/commands/utility/invite.ts index 8a4e00ad..01571712 100644 --- a/src/commands/utility/invite.ts +++ b/src/commands/utility/invite.ts @@ -8,7 +8,7 @@ module.exports.run = async (bot: Client, msg: Message, args: any, db: any, log: "description": "https://kwako.iwa.sh/", "color": 16774804} }) - .then(() => { log.info({msg: 'invite', author: { id: msg.author.id, name: msg.author.tag }, guild: msg.guild.id}) }) + .then(() => { log.info({msg: 'invite', author: { id: msg.author.id, name: msg.author.tag }, guild: { id: msg.guild.id, name: msg.guild.name }}) }) .catch(log.error); }; diff --git a/src/commands/utility/leaderboard.ts b/src/commands/utility/leaderboard.ts index d13d1f5a..485f6d69 100644 --- a/src/commands/utility/leaderboard.ts +++ b/src/commands/utility/leaderboard.ts @@ -98,7 +98,7 @@ async function leaderboard (bot: Client, msg: Message, db: Db, log: Logger, type embed.setDescription(desc) msg.channel.send(embed) .then(() => { - log.info({msg: 'leaderboard', author: { id: msg.author.id, name: msg.author.tag }, guild: msg.guild.id, type: type}); + log.info({msg: 'leaderboard', author: { id: msg.author.id, name: msg.author.tag }, guild: { id: msg.guild.id, name: msg.guild.name }, type: type}); }).catch(log.error) }); } \ No newline at end of file diff --git a/src/commands/utility/link.ts b/src/commands/utility/link.ts index dc6671a6..47ee8ca1 100644 --- a/src/commands/utility/link.ts +++ b/src/commands/utility/link.ts @@ -8,7 +8,7 @@ module.exports.run = async (bot: Client, msg: Message, args: any, db: any, log: "description": "https://kwako.iwa.sh/", "color": 16774804} }) - .then(() => { log.info({msg: 'link', author: { id: msg.author.id, name: msg.author.tag }, guild: msg.guild.id}) }) + .then(() => { log.info({msg: 'link', author: { id: msg.author.id, name: msg.author.tag }, guild: { id: msg.guild.id, name: msg.guild.name }}) }) .catch(log.error); }; diff --git a/src/commands/utility/manga.ts b/src/commands/utility/manga.ts index a25c141e..ebb8cb5a 100644 --- a/src/commands/utility/manga.ts +++ b/src/commands/utility/manga.ts @@ -67,7 +67,7 @@ module.exports.run = (bot: Client, msg: Message, args: string[], db: any, log: L embed.setColor('BLUE') embed.setURL(info.siteUrl) - log.info({msg: 'manga', author: { id: msg.author.id, name: msg.author.tag }, guild: msg.guild.id, request: req}); + log.info({msg: 'manga', author: { id: msg.author.id, name: msg.author.tag }, guild: { id: msg.guild.id, name: msg.guild.name }, request: req}); return msg.channel.send(embed) }).catch((err: any) => { log.error(err) diff --git a/src/commands/utility/ping.ts b/src/commands/utility/ping.ts index 001a77dc..0e5de4c3 100644 --- a/src/commands/utility/ping.ts +++ b/src/commands/utility/ping.ts @@ -4,7 +4,7 @@ import { Logger } from 'pino'; module.exports.run = async (bot: Client, msg: Message, args: any, db: any, log: Logger) => { let ping = Math.ceil(bot.ws.ping) await msg.channel.send(`:ping_pong: Pong ! \`${ping}ms\``) - .then(() => { log.info({msg: 'ping', author: { id: msg.author.id, name: msg.author.tag }, guild: msg.guild.id}) }) + .then(() => { log.info({msg: 'ping', author: { id: msg.author.id, name: msg.author.tag }, guild: { id: msg.guild.id, name: msg.guild.name }}) }) .catch(log.error); }; diff --git a/src/commands/utility/pong.ts b/src/commands/utility/pong.ts index 829c3372..4c047ebb 100644 --- a/src/commands/utility/pong.ts +++ b/src/commands/utility/pong.ts @@ -4,7 +4,7 @@ import { Logger } from 'pino'; module.exports.run = async (bot: Client, msg: Message, args: any, db: any, log: Logger) => { let ping = Math.ceil(bot.ws.ping) await msg.channel.send(`:ping_pong: Ping ! \`${ping}ms\``) - .then(() => { log.info({msg: 'ping', author: { id: msg.author.id, name: msg.author.tag }, guild: msg.guild.id}) }) + .then(() => { log.info({msg: 'ping', author: { id: msg.author.id, name: msg.author.tag }, guild: { id: msg.guild.id, name: msg.guild.name }}) }) .catch(log.error); }; diff --git a/src/index.ts b/src/index.ts index 816b1df2..ebf24ac4 100644 --- a/src/index.ts +++ b/src/index.ts @@ -112,10 +112,12 @@ bot.on('message', async (msg: Discord.Message) => { if (cmd.help.perms && !msg.guild.me.hasPermission(cmd.help.perms)) return msg.channel.send(`**❌ Sorry, I need the following permissions to execute this command**\n\`${cmd.help.perms.join('`, `')}\``).catch(() => { return; }); - talkedRecently.add(msg.author.id); - setTimeout(() => { - talkedRecently.delete(msg.author.id); - }, 3000); + if (!msg.member.hasPermission('MANAGE_GUILD')) { + talkedRecently.add(msg.author.id); + setTimeout(() => { + talkedRecently.delete(msg.author.id); + }, 3000); + } await cmd.run(bot, msg, args, db, log, commands, guildConf); } @@ -131,6 +133,8 @@ bot.on("guildMemberAdd", async member => { let userDB = await db.collection('user').findOne({ _id: member.id }); let guildDB = `exp.${member.guild.id.toString()}` if (userDB) { + if(!userDB.exp) return; + if(userDB.exp[member.guild.id] < 0) { await db.collection('user').updateOne({ _id: member.id }, { $mul: { [guildDB]: -1 }}); userDB.exp[member.guild.id] *= -1; @@ -138,7 +142,9 @@ bot.on("guildMemberAdd", async member => { let levelroles:string = guild.levelroles || "[]"; let levelrolesMap:Map> = new Map(JSON.parse(levelroles)); - let lvl = utilities.levelInfo(userDB.exp[member.guild.id]); + + let exp = userDB.exp[member.guild.id] || 0; + let lvl = utilities.levelInfo(exp); levelrolesMap.forEach(async (value, key) => { if(key <= lvl.level) { @@ -210,13 +216,13 @@ bot.on('guildCreate', async guild => { await db.collection('settings').insertOne({ '_id': guild.id }); http.get('http://localhost:8080/api/guilds/update').on("error", log.error); - log.info({msg: 'new guild', guild: guild.id}); + log.info({msg: 'new guild', guild: { id: guild.id, name: guild.name }}); }); bot.on("guildDelete", async guild => { await db.collection('settings').deleteOne({ '_id': { $eq: guild.id } }); http.get('http://localhost:8080/api/guilds/update').on("error", log.error); - log.info({msg: 'guild removed', guild: guild.id}); + log.info({msg: 'guild removed', guild: { id: guild.id, name: guild.name }}); }); diff --git a/src/utils/actions.ts b/src/utils/actions.ts index c2f6b8d4..40e06a7b 100644 --- a/src/utils/actions.ts +++ b/src/utils/actions.ts @@ -65,7 +65,7 @@ export default async function actionsRun(bot: Client, msg: Message, args: string embed.setImage(`https://${process.env.CDN_URL}/img/${type}/${n}.gif`) return msg.channel.send(embed) - .then(() => { log.info({msg: type, cmd: type, author: { id: msg.author.id, name: msg.author.tag }, guild: msg.guild.id}); }) + .then(() => { log.info({msg: type, cmd: type, author: { id: msg.author.id, name: msg.author.tag }, guild: { id: msg.guild.id, name: msg.guild.name }}); }) .catch(log.error); } @@ -123,7 +123,7 @@ export default async function actionsRun(bot: Client, msg: Message, args: string return msg.channel.send(embed) .then(() => { - log.info({msg: type, author: { id: msg.author.id, name: msg.author.tag }, guild: msg.guild.id}); + log.info({msg: type, author: { id: msg.author.id, name: msg.author.tag }, guild: { id: msg.guild.id, name: msg.guild.name }}); }) .catch(log.error); } diff --git a/src/utils/music.ts b/src/utils/music.ts index 8e6c7d8e..eea221a1 100644 --- a/src/utils/music.ts +++ b/src/utils/music.ts @@ -231,7 +231,7 @@ export default class music { msg.channel.send(embed) - log.info({msg: 'remove', author: { id: msg.author.id, name: msg.author.tag }, guild: msg.guild.id, song: { title: data.title, url: data.shortUrl }}); + log.info({msg: 'remove', author: { id: msg.author.id, name: msg.author.tag }, guild: { id: msg.guild.id, name: msg.guild.name }, song: { title: data.title, url: data.shortUrl }}); queu.splice(queueID, 1); queue.set(msg.guild.id, queu); } @@ -251,7 +251,7 @@ export default class music { if (queu.length <= 1) { embed.setTitle("**:cd: The queue is empty.**") msg.channel.send(embed); - log.info({msg: 'queue', author: { id: msg.author.id, name: msg.author.tag }, guild: msg.guild.id}) + log.info({msg: 'queue', author: { id: msg.author.id, name: msg.author.tag }, guild: { id: msg.guild.id, name: msg.guild.name }}) } else { msg.channel.startTyping(); embed.setTitle("**:cd: Music Queue**") @@ -288,7 +288,7 @@ export default class music { msg.channel.send(embed); msg.channel.stopTyping(true); - log.info({msg: 'queue', author: { id: msg.author.id, name: msg.author.tag }, guild: msg.guild.id}) + log.info({msg: 'queue', author: { id: msg.author.id, name: msg.author.tag }, guild: { id: msg.guild.id, name: msg.guild.name }}) } } @@ -323,7 +323,7 @@ export default class music { embed.setAuthor("Your voteskip has been registered!", msg.author.avatarURL({ format: 'png', dynamic: false, size: 128 })) msg.channel.send(embed) - log.info({msg: 'voteskip', author: { id: msg.author.id, name: msg.author.tag }, guild: msg.guild.id}) + log.info({msg: 'voteskip', author: { id: msg.author.id, name: msg.author.tag }, guild: { id: msg.guild.id, name: msg.guild.name }}) if (reqs >= Math.ceil((voiceChannel.members.size - 1) / 2)) { let dispatcher = voiceConnection.dispatcher @@ -333,7 +333,7 @@ export default class music { msg.channel.send(embed) loop.set(msg.guild.id, false); dispatcher.end() - log.info({msg: 'skipping song', author: { id: msg.author.id, name: msg.author.tag }, guild: msg.guild.id}) + log.info({msg: 'skipping song', author: { id: msg.author.id, name: msg.author.tag }, guild: { id: msg.guild.id, name: msg.guild.name }}) } else { const embed = new MessageEmbed(); embed.setColor('BRIGHT_RED') @@ -357,7 +357,7 @@ export default class music { await msg.react('✅'); - log.info({msg: 'clear', author: { id: msg.author.id, name: msg.author.tag }, guild: msg.guild.id}) + log.info({msg: 'clear', author: { id: msg.author.id, name: msg.author.tag }, guild: { id: msg.guild.id, name: msg.guild.name }}) } /** @@ -374,7 +374,7 @@ export default class music { await msg.react('✅'); voiceChannel.leave() - log.info({msg: 'stop', author: { id: msg.author.id, name: msg.author.tag }, guild: msg.guild.id}) + log.info({msg: 'stop', author: { id: msg.author.id, name: msg.author.tag }, guild: { id: msg.guild.id, name: msg.guild.name }}) } } @@ -406,7 +406,7 @@ export default class music { dispatcher.end() - return log.info({msg: 'forceskip', author: { id: msg.author.id, name: msg.author.tag }, guild: msg.guild.id}) + return log.info({msg: 'forceskip', author: { id: msg.author.id, name: msg.author.tag }, guild: { id: msg.guild.id, name: msg.guild.name }}) } /** @@ -417,14 +417,14 @@ export default class music { let loo = loop.get(msg.guild.id) || false if (!loo) { loop.set(msg.guild.id, true) - log.info({msg: 'loop', author: { id: msg.author.id, name: msg.author.tag }, guild: msg.guild.id, enable: true}) + log.info({msg: 'loop', author: { id: msg.author.id, name: msg.author.tag }, guild: { id: msg.guild.id, name: msg.guild.name }, enable: true}) const embed = new MessageEmbed(); embed.setAuthor("🔂 Looping the current song...", msg.author.avatarURL({ format: 'png', dynamic: false, size: 128 })); embed.setColor('GREEN') return msg.channel.send(embed) } else if (loo) { loop.set(msg.guild.id, false) - log.info({msg: 'loop', author: { id: msg.author.id, name: msg.author.tag }, guild: msg.guild.id, enable: false}) + log.info({msg: 'loop', author: { id: msg.author.id, name: msg.author.tag }, guild: { id: msg.guild.id, name: msg.guild.name }, enable: false}) const embed = new MessageEmbed(); embed.setAuthor("This song will no longer be looped...", msg.author.avatarURL({ format: 'png', dynamic: false, size: 128 })); embed.setColor('GREEN') @@ -436,14 +436,14 @@ export default class music { let loo = loopqueue.get(msg.guild.id) || false if (!loo) { loopqueue.set(msg.guild.id, true) - log.info({msg: 'loopqueue', author: { id: msg.author.id, name: msg.author.tag }, guild: msg.guild.id, enable: true}) + log.info({msg: 'loopqueue', author: { id: msg.author.id, name: msg.author.tag }, guild: { id: msg.guild.id, name: msg.guild.name }, enable: true}) const embed = new MessageEmbed(); embed.setAuthor("🔁 Looping the queue...", msg.author.avatarURL({ format: 'png', dynamic: false, size: 128 })); embed.setColor('GREEN') return msg.channel.send(embed) } else if (loo) { loopqueue.set(msg.guild.id, false) - log.info({msg: 'loopqueue', author: { id: msg.author.id, name: msg.author.tag }, guild: msg.guild.id, enable: false}) + log.info({msg: 'loopqueue', author: { id: msg.author.id, name: msg.author.tag }, guild: { id: msg.guild.id, name: msg.guild.name }, enable: false}) const embed = new MessageEmbed(); embed.setAuthor("The queue will no longer be looped...", msg.author.avatarURL({ format: 'png', dynamic: false, size: 128 })); embed.setColor('GREEN') @@ -499,7 +499,7 @@ export default class music { msg.channel.send(embed) msg.channel.stopTyping(true); - log.info({msg: 'nowplaying', author: { id: msg.author.id, name: msg.author.tag }, guild: msg.guild.id}) + log.info({msg: 'nowplaying', author: { id: msg.author.id, name: msg.author.tag }, guild: { id: msg.guild.id, name: msg.guild.name }}) } /** @@ -515,7 +515,7 @@ export default class music { await msg.react('✅'); } - log.info({msg: 'pause', author: { id: msg.author.id, name: msg.author.tag }, guild: msg.guild.id}) + log.info({msg: 'pause', author: { id: msg.author.id, name: msg.author.tag }, guild: { id: msg.guild.id, name: msg.guild.name }}) } /** @@ -531,7 +531,7 @@ export default class music { await msg.react('✅'); } - log.info({msg: 'resume', author: { id: msg.author.id, name: msg.author.tag }, guild: msg.guild.id}) + log.info({msg: 'resume', author: { id: msg.author.id, name: msg.author.tag }, guild: { id: msg.guild.id, name: msg.guild.name }}) } static async shuffle(bot: Client, msg: Message, log: Logger) { @@ -553,7 +553,7 @@ export default class music { await msg.react('✅'); } - log.info({msg: 'shuffle', author: { id: msg.author.id, name: msg.author.tag }, guild: msg.guild.id}) + log.info({msg: 'shuffle', author: { id: msg.author.id, name: msg.author.tag }, guild: { id: msg.guild.id, name: msg.guild.name }}) } } @@ -593,7 +593,7 @@ async function playSong(msg: Message, voiceConnection: VoiceConnection, voiceCha let thumbnail = infos.thumbnails embed.setThumbnail(thumbnail.high.url) msg.channel.send(embed) - log.info({msg: 'music playing', author: { id: msg.author.id, name: msg.author.tag }, guild: msg.guild.id, song: { name: Util.escapeMarkdown(videoData.title), url: videoData.shortUrl}}); + log.info({msg: 'music playing', author: { id: msg.author.id, name: msg.author.tag }, guild: { id: msg.guild.id, name: msg.guild.name }, song: { name: Util.escapeMarkdown(videoData.title), url: videoData.shortUrl}}); } }).on('finish', () => { let loo = loop.get(msg.guild.id) || false @@ -669,7 +669,7 @@ async function launchPlay(msg: Message, voiceChannel: VoiceChannel, video_url: s embed.setColor('LUMINOUS_VIVID_PINK') msg.channel.stopTyping() await msg.channel.send(embed) - log.info({msg: 'music added to queue', author: { id: msg.author.id, name: msg.author.tag }, guild: msg.guild.id, song: { name: Util.escapeMarkdown(data.videoDetails.title), url: data.videoDetails.video_url}}); + log.info({msg: 'music added to queue', author: { id: msg.author.id, name: msg.author.tag }, guild: { id: msg.guild.id, name: msg.guild.name }, song: { name: Util.escapeMarkdown(data.videoDetails.title), url: data.videoDetails.video_url}}); } else { msg.channel.stopTyping() diff --git a/src/utils/staff.ts b/src/utils/staff.ts index d7904b90..bb4b9873 100644 --- a/src/utils/staff.ts +++ b/src/utils/staff.ts @@ -23,7 +23,7 @@ export default class staff { let nb = parseInt(args[0]) msg.channel.bulkDelete(nb) .then(() => { - log.info({msg: 'bulk', author: { id: msg.author.id, name: msg.author.tag }, guild: msg.guild.id, bulk: { channel: channel.id, name: channel.name, x: nb }}); + log.info({msg: 'bulk', author: { id: msg.author.id, name: msg.author.tag }, guild: { id: msg.guild.id, name: msg.guild.name }, bulk: { channel: channel.id, name: channel.name, x: nb }}); }) .catch(log.error); } @@ -69,7 +69,7 @@ export default class staff { await mention.roles.add(muteRole) let reply = await msg.channel.send(embed) - log.info({msg: 'mute', author: { id: msg.author.id, name: msg.author.tag }, guild: msg.guild.id}) + log.info({msg: 'mute', author: { id: msg.author.id, name: msg.author.tag }, guild: { id: msg.guild.id, name: msg.guild.name }}) if(modLogChannel) { let channel = await bot.channels.fetch(modLogChannel); diff --git a/src/utils/utilities.ts b/src/utils/utilities.ts index 29aa9a69..b4a1763c 100644 --- a/src/utils/utilities.ts +++ b/src/utils/utilities.ts @@ -33,7 +33,7 @@ export default class utilities { } try { - log.info({msg: 'info', author: { id: msg.author.id, name: msg.author.tag }, guild: msg.guild.id}); + log.info({msg: 'info', author: { id: msg.author.id, name: msg.author.tag }, guild: { id: msg.guild.id, name: msg.guild.name }}); await msg.author.send(embed) } catch (ex) { return msg.channel.send("**:x: > Please open your DMs!**")