Allow modlog channel to be swapped

This commit is contained in:
Daniel Odendahl Jr
2017-06-24 21:14:12 +00:00
parent fbf50718c6
commit 29a1c9b947
8 changed files with 28 additions and 8 deletions
+5 -1
View File
@@ -33,7 +33,11 @@ module.exports = class BanCommand extends Command {
}
async run(msg, args) {
const modlogs = msg.guild.channels.find('name', 'mod-log');
const modlogs = msg.guild.channels.filter((c) => {
const topic = c.topic || '';
if (topic.includes('<modlog>')) return true;
else return false;
}).first() || member.guild.channels.find('name', 'mod-log');
const { member, reason } = args;
if (!member.bannable) return msg.say('This member is not bannable. Perhaps they have a higher role than me?');
await msg.say(`Are you sure you want to ban ${member.user.tag} (${member.id})?`);
+5 -1
View File
@@ -33,7 +33,11 @@ module.exports = class KickCommand extends Command {
}
async run(msg, args) {
const modlogs = msg.guild.channels.find('name', 'mod-log');
const modlogs = msg.guild.channels.filter((c) => {
const topic = c.topic || '';
if (topic.includes('<modlog>')) return true;
else return false;
}).first() || member.guild.channels.find('name', 'mod-log');
const { member, reason } = args;
if (!member.kickable) return msg.say('This member is not kickable. Perhaps they have a higher role than me?');
await msg.say(`Are you sure you want to kick ${member.user.tag} (${member.id})?`);
+5 -1
View File
@@ -33,7 +33,11 @@ module.exports = class SoftbanCommand extends Command {
}
async run(msg, args) {
const modlogs = msg.guild.channels.find('name', 'mod-log');
const modlogs = msg.guild.channels.filter((c) => {
const topic = c.topic || '';
if (topic.includes('<modlog>')) return true;
else return false;
}).first() || member.guild.channels.find('name', 'mod-log');
const { member, reason } = args;
if (!member.bannable) return msg.say('This member is not bannable. Perhaps they have a higher role than me?');
await msg.say(`Are you sure you want to softban ${member.user.tag} (${member.id})?`);
+5 -1
View File
@@ -33,7 +33,11 @@ module.exports = class UnbanCommand extends Command {
}
async run(msg, args) {
const modlogs = msg.guild.channels.find('name', 'mod-log');
const modlogs = msg.guild.channels.filter((c) => {
const topic = c.topic || '';
if (topic.includes('<modlog>')) return true;
else return false;
}).first() || member.guild.channels.find('name', 'mod-log');
const { id, reason } = args;
const bans = await msg.guild.fetchBans();
if (!bans.has(id)) return msg.say('This ID is not in the Guild Banlist.');
+5 -1
View File
@@ -32,7 +32,11 @@ module.exports = class WarnCommand extends Command {
}
async run(msg, args) {
const modlogs = msg.guild.channels.find('name', 'mod-log');
const modlogs = msg.guild.channels.filter((c) => {
const topic = c.topic || '';
if (topic.includes('<modlog>')) return true;
else return false;
}).first() || member.guild.channels.find('name', 'mod-log');
const { member, reason } = args;
await msg.say(`Are you sure you want to warn ${member.user.tag} (${member.id})?`);
const msgs = await msg.channel.awaitMessages((res) => res.author.id === msg.author.id, {
+1 -1
View File
@@ -12,7 +12,7 @@
<div class="xiaobox2">
<h2>Notes</h2>
<ol>
<li>Moderation commands require a channel named mod-log to send Ban/Kick/Softban/Unban/Warn logs.</li>
<li>Moderation commands require a channel with &lt;modlog&gt; in the topic to send Ban/Kick/Softban/Unban/Warn logs.</li>
<li>To use member join/leave logging, place &lt;memberlog&gt; in the channel topic. Custom messages can be set with &lt;joinmessage&gt;messagegoeshere&lt;/joinmessage&gt; and &lt;leavemessage&gt;messagegoeshere&lt;/leavemessage&gt;</li>
<li>To use invite guard, place &lt;inviteguard&gt; in the default channel topic.</li>
<li>Use x;help to view a command list</li>
+1 -1
View File
@@ -67,7 +67,7 @@
</ol>
<h2>Notes</h2>
<ol>
<li>Moderation commands require a channel named mod-log to send Ban/Kick/Softban/Unban/Warn logs.</li>
<li>Moderation commands require a channel with &lt;modlog&gt; in the topic to send Ban/Kick/Softban/Unban/Warn logs.</li>
<li>To use member join/leave logging, place &lt;memberlog&gt; in the channel topic. Custom messages can be set with &lt;joinmessage&gt;messagegoeshere&lt;/joinmessage&gt; and &lt;leavemessage&gt;messagegoeshere&lt;/leavemessage&gt;</li>
<li>To use invite guard, place &lt;inviteguard&gt; in the default channel topic.</li>
<li>Use x;help to view a command list</li>
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiaobot",
"version": "25.1.1",
"version": "25.2.0",
"description": "Your personal server companion.",
"main": "Shard.js",
"scripts": {