mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-22 01:57:54 +02:00
Invite Guard, Topic Parsing Changes
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { MessageEmbed } = require('discord.js');
|
||||
const { stripIndents } = require('common-tags');
|
||||
const { parseTopic, parseTopicMsg } = require('../../structures/Util');
|
||||
const { filterTopics, parseTopic } = require('../../structures/Util');
|
||||
|
||||
module.exports = class WarnCommand extends Command {
|
||||
constructor(client) {
|
||||
@@ -33,7 +33,7 @@ module.exports = class WarnCommand extends Command {
|
||||
}
|
||||
|
||||
async run(msg, args) {
|
||||
const modlogs = parseTopic(msg.guild.channels, 'modlog', this.client.user).first();
|
||||
const modlogs = filterTopics(msg.guild.channels, 'modlog').first();
|
||||
const { member, reason } = args;
|
||||
if (member.id === msg.author.id) return msg.say('I don\'t think you want to warn yourself...');
|
||||
if (!member.kickable) return msg.say('This member is not warnable. Perhaps they have a higher role than me?');
|
||||
@@ -47,7 +47,7 @@ module.exports = class WarnCommand extends Command {
|
||||
});
|
||||
if (!msgs.size || !['y', 'yes'].includes(msgs.first().content.toLowerCase())) return msg.say('Aborting.');
|
||||
try {
|
||||
const message = parseTopicMsg(modlogs.topic, 'modmessage')
|
||||
const message = parseTopic(modlogs.topic, 'modmessage')
|
||||
.replace(/{{action}}/gi, 'warned')
|
||||
.replace(/{{moderator}}/gi, msg.author.tag)
|
||||
.replace(/{{server}}/gi, msg.guild.name);
|
||||
@@ -59,7 +59,7 @@ module.exports = class WarnCommand extends Command {
|
||||
await msg.say('Failed to Send DM.');
|
||||
}
|
||||
await msg.say(`Successfully warned ${member.user.tag}.`);
|
||||
if (!modlogs || !modlogs.permissionsFor(this.client.user).has('SEND_MESSAGES')) {
|
||||
if (!modlogs) {
|
||||
return msg.say('Could not log the warn to the mod logs.');
|
||||
} else if (modlogs.permissionsFor(this.client.user).has('EMBED_LINKS')) {
|
||||
const embed = new MessageEmbed()
|
||||
|
||||
Reference in New Issue
Block a user