mirror of
https://github.com/citra-emu/discord-bot.git
synced 2025-07-01 12:28:15 +00:00
22 lines
931 B
TypeScript
22 lines
931 B
TypeScript
import state from '../state';
|
|
import * as data from '../data';
|
|
import logger from '../logging';
|
|
import discord = require('discord.js');
|
|
|
|
export const roles = ['Admins', 'Moderators'];
|
|
export function command (message: discord.Message) {
|
|
message.mentions.users.map((user) => {
|
|
const count = state.warnings.filter(x => x.id === user.id && !x.cleared);
|
|
if (count != null && count.length > 0) {
|
|
count.forEach(warning => { warning.cleared = true; });
|
|
data.flushWarnings();
|
|
message.channel.send(`${user.toString()}, your warnings have been cleared.`);
|
|
} else {
|
|
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}].`);
|
|
state.logChannel.send(`${message.author.toString()} has cleared all warnings for ${user.toString()} [${count.length}].`);
|
|
});
|
|
};
|