diff --git a/src/commands/ban.ts b/src/commands/ban.ts index 6803751..f9d97f0 100644 --- a/src/commands/ban.ts +++ b/src/commands/ban.ts @@ -10,7 +10,7 @@ export function command (message: discord.Message) { const count = state.warnings.filter(x => x.id === user.id && !x.cleared).length || 0; logger.info(`${message.author.toString()} has banned ${user.toString()} ${user} ${user.username}.`); - state.logChannel.send(`${message.author} has banned ${user} ${user.username} [${count}].`); + state.logChannel.send(`${message.author.toString()} has banned ${user} ${user.toString()} [${count}].`); state.bans.push(new UserBan(user.id, user.username, message.author.id, message.author.username, count)); diff --git a/src/commands/clearWarnings.ts b/src/commands/clearWarnings.ts index 80ed4fc..76f4b04 100644 --- a/src/commands/clearWarnings.ts +++ b/src/commands/clearWarnings.ts @@ -10,9 +10,9 @@ export function command (message: discord.Message) { if (count != null && count.length > 0) { count.forEach(warning => { warning.cleared = true; }); data.flushWarnings(); - message.channel.send(`${user}, your warnings have been cleared.`); + message.channel.send(`${user.toString()}, your warnings have been cleared.`); } else { - message.channel.send(`${user}, you have no warnings to clear.`); + message.channel.send(`${user.toString()}, you have no warnings to clear.`); } logger.info(`${message.author.username} has cleared all warnings for ${user} ${user.username} [${count.length}].`); diff --git a/src/commands/warnings.ts b/src/commands/warnings.ts index 26b0030..52e517e 100644 --- a/src/commands/warnings.ts +++ b/src/commands/warnings.ts @@ -4,6 +4,6 @@ import discord = require('discord.js'); exports.command = function (message: discord.Message) { message.mentions.users.map((user) => { const warnings = state.warnings.filter(x => x.id === user.id && !x.cleared); - message.channel.send(`${user}, you have ${warnings.length} total warnings.`); + message.channel.send(`${user.toString()}, you have ${warnings.length} total warnings.`); }); }; diff --git a/src/server.ts b/src/server.ts index ae8fd79..65d9df9 100644 --- a/src/server.ts +++ b/src/server.ts @@ -72,7 +72,7 @@ client.on('messageDelete', message => { if (message.content && message.content.startsWith('.') === false && message.author.bot === false) { const deletionEmbed = new discord.MessageEmbed() .setAuthor(message.author.tag, message.author.displayAvatarURL()) - .setDescription(`Message deleted in ${message.channel}`) + .setDescription(`Message deleted in ${message.channel.toString()}`) .addField('Content', message.cleanContent, false) .setTimestamp() .setColor('RED'); @@ -93,7 +93,7 @@ client.on('messageUpdate', (oldMessage, newMessage) => { if (oldMessage.content !== newMessage.content && oldM && newM) { const editedEmbed = new discord.MessageEmbed() .setAuthor(oldMessage.author.tag, oldMessage.author.displayAvatarURL()) - .setDescription(`Message edited in ${oldMessage.channel} [Jump To Message](${newMessage.url})`) + .setDescription(`Message edited in ${oldMessage.channel.toString()} [Jump To Message](${newMessage.url})`) .addField('Before', oldM, false) .addField('After', newM, false) .setTimestamp() @@ -112,7 +112,7 @@ client.on('message', message => { if (message.guild == null && state.responses.pmReply) { // We want to log PM attempts. logger.info(`${message.author.username} ${message.author} [PM]: ${message.content}`); - state.logChannel.send(`${message.author} [PM]: ${message.content}`); + state.logChannel.send(`${message.author.toString()} [PM]: ${message.content}`); message.reply(state.responses.pmReply); return; } @@ -157,8 +157,8 @@ client.on('message', message => { if (!cachedModule) return; // Not a valid command. // Check access permissions. - if (cachedModule.roles !== undefined && findArray(message.member.roles.cache.map(x => x.name), cachedModule.roles) === false) { - state.logChannel.send(`${message.author} attempted to use admin command: ${message.content}`); + if (cachedModule.roles && findArray(message.member.roles.cache.map(x => x.name), cachedModule.roles) === false) { + state.logChannel.send(`${message.author.toString()} attempted to use admin command: ${message.content}`); logger.info(`${message.author.username} ${message.author} attempted to use admin command: ${message.content}`); return false; }