mirror of
https://github.com/yuzu-emu/Command-fix.git
synced 2024-11-22 09:45:39 +01:00
commands: fix pinging people
This commit is contained in:
parent
3d3e466aab
commit
09867e2c0d
@ -10,7 +10,7 @@ export function command (message: discord.Message) {
|
|||||||
const count = state.warnings.filter(x => x.id === user.id && !x.cleared).length || 0;
|
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}.`);
|
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));
|
state.bans.push(new UserBan(user.id, user.username, message.author.id, message.author.username, count));
|
||||||
|
|
||||||
|
@ -10,9 +10,9 @@ export function command (message: discord.Message) {
|
|||||||
if (count != null && count.length > 0) {
|
if (count != null && count.length > 0) {
|
||||||
count.forEach(warning => { warning.cleared = true; });
|
count.forEach(warning => { warning.cleared = true; });
|
||||||
data.flushWarnings();
|
data.flushWarnings();
|
||||||
message.channel.send(`${user}, your warnings have been cleared.`);
|
message.channel.send(`${user.toString()}, your warnings have been cleared.`);
|
||||||
} else {
|
} 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}].`);
|
logger.info(`${message.author.username} has cleared all warnings for ${user} ${user.username} [${count.length}].`);
|
||||||
|
@ -4,6 +4,6 @@ import discord = require('discord.js');
|
|||||||
exports.command = function (message: discord.Message) {
|
exports.command = function (message: discord.Message) {
|
||||||
message.mentions.users.map((user) => {
|
message.mentions.users.map((user) => {
|
||||||
const warnings = state.warnings.filter(x => x.id === user.id && !x.cleared);
|
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.`);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -72,7 +72,7 @@ client.on('messageDelete', message => {
|
|||||||
if (message.content && message.content.startsWith('.') === false && message.author.bot === false) {
|
if (message.content && message.content.startsWith('.') === false && message.author.bot === false) {
|
||||||
const deletionEmbed = new discord.MessageEmbed()
|
const deletionEmbed = new discord.MessageEmbed()
|
||||||
.setAuthor(message.author.tag, message.author.displayAvatarURL())
|
.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)
|
.addField('Content', message.cleanContent, false)
|
||||||
.setTimestamp()
|
.setTimestamp()
|
||||||
.setColor('RED');
|
.setColor('RED');
|
||||||
@ -93,7 +93,7 @@ client.on('messageUpdate', (oldMessage, newMessage) => {
|
|||||||
if (oldMessage.content !== newMessage.content && oldM && newM) {
|
if (oldMessage.content !== newMessage.content && oldM && newM) {
|
||||||
const editedEmbed = new discord.MessageEmbed()
|
const editedEmbed = new discord.MessageEmbed()
|
||||||
.setAuthor(oldMessage.author.tag, oldMessage.author.displayAvatarURL())
|
.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('Before', oldM, false)
|
||||||
.addField('After', newM, false)
|
.addField('After', newM, false)
|
||||||
.setTimestamp()
|
.setTimestamp()
|
||||||
@ -112,7 +112,7 @@ client.on('message', message => {
|
|||||||
if (message.guild == null && state.responses.pmReply) {
|
if (message.guild == null && state.responses.pmReply) {
|
||||||
// We want to log PM attempts.
|
// We want to log PM attempts.
|
||||||
logger.info(`${message.author.username} ${message.author} [PM]: ${message.content}`);
|
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);
|
message.reply(state.responses.pmReply);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -157,8 +157,8 @@ client.on('message', message => {
|
|||||||
if (!cachedModule) return; // Not a valid command.
|
if (!cachedModule) return; // Not a valid command.
|
||||||
|
|
||||||
// Check access permissions.
|
// Check access permissions.
|
||||||
if (cachedModule.roles !== undefined && findArray(message.member.roles.cache.map(x => x.name), cachedModule.roles) === false) {
|
if (cachedModule.roles && findArray(message.member.roles.cache.map(x => x.name), cachedModule.roles) === false) {
|
||||||
state.logChannel.send(`${message.author} attempted to use admin command: ${message.content}`);
|
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}`);
|
logger.info(`${message.author.username} ${message.author} attempted to use admin command: ${message.content}`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user