commands: fix pinging people

This commit is contained in:
liushuyu 2020-05-02 01:23:12 -06:00
parent 3d3e466aab
commit 09867e2c0d
No known key found for this signature in database
GPG key ID: 23D1CE4534419437
4 changed files with 9 additions and 9 deletions

View file

@ -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));

View file

@ -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}].`);

View file

@ -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.`);
});
};

View file

@ -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;
}