fix: eventlog

This commit is contained in:
Neko-Life 2021-07-22 13:06:28 +07:00
parent 8d865361ef
commit 6833668a04
2 changed files with 5 additions and 5 deletions

View file

@ -19,15 +19,15 @@ module.exports = class eventlog extends commando.Command {
if (!msg.guild.DB) await msg.guild.dbLoad();
const set = parseDoubleDash(arg);
let eventChannels = msg.guild.DB.settings.eventChannels;
if (set.length < 2 && set[0].length === 0) return trySend(this.client, msg, await resultEmbed(this));
if (!set || set.length < 2 && set[0].length === 0) return trySend(this.client, msg, await resultEmbed(this));
let report = "", joinlog, leavelog, channellog, banlog, unbanlog, mesEdlog = { channel: undefined, ignore: [] }, invitelog, rolelog,
guildlog, membernicklog, emotelog, memberroleslog, remove = false, [setMesEdIgnore, setMesDelIgnore] = [false, false], mesDellog = { channel: undefined, ignore: [] };
for (const args of set) {
if (args.startsWith("rm ")) remove = true;
if (args.startsWith("j ")) {
if (remove) eventChannels.join = undefined; else {
leavelog = getChannel(msg, args.slice("j".length).trim(), ["category", "voice"])?.id;
if (!leavelog) report += "**[JOIN]** Unknown channel.\n";
joinlog = getChannel(msg, args.slice("j ".length).trim(), ["category", "voice"])?.id;
if (!joinlog) report += "**[JOIN]** Unknown channel.\n";
}
}
if (args.startsWith("l ")) {
@ -245,7 +245,7 @@ module.exports = class eventlog extends commando.Command {
async function resultEmbed(the) {
const emb = defaultImageEmbed(msg, null, "Event Log Channels Configuration");
emb
.setDescription(`Set configuration using \`\`\`js\n${msg.guild.commandPrefix + the.name} [--rm] --<Category> <Channel_[Mention | Name | ID]>\`\`\`**Categories:** \`\`\`js\n[MESSAGE[EDIT, DELETE]: --[e, d] IGNORE: -i, JOIN: --j, LEAVE: --l, MEMBER: --p, MEMBERROLE: --mr, BAN: --b, UNBAN: --u, GUILD: --g, ROLE: --r, CHANNEL: --c, EMOJI: --em, INVITE: --i]\`\`\``)
.setDescription(`Set configuration using \`\`\`js\n${msg.guild.commandPrefix + the.name} [--rm] --<Category> <Channel_[Mention | Name | ID]>\`\`\`**Categories:** \`\`\`js\n[MESSAGE[EDIT, DELETE]: --[e, d] IGNORE: -i [none], JOIN: --j, LEAVE: --l, MEMBER: --p, MEMBERROLE: --mr, BAN: --b, UNBAN: --u, GUILD: --g, ROLE: --r, CHANNEL: --c, EMOJI: --em, INVITE: --i]\`\`\``)
.addField(`Message Edit`, eventChannels?.mesEd?.channel ? `<#${eventChannels?.mesEd.channel}>\n**Ignores:** ${eventChannels?.mesEd?.ignore?.length > 0 ?
"<#" + eventChannels?.mesEd.ignore.join(">, <#") + ">" : "None"}`
: "Not set", true)

View file

@ -11,7 +11,7 @@ const getColor = require("../getColor");
*/
module.exports = async (msg) => {
if (msg.partial) return;
const ignored = msg.guild.DB.settings.eventChannels.mesDel?.ignore.includes(msg.channel.id) ?? false;
const ignored = msg.guild.DB.settings.eventChannels.mesDel?.ignore?.includes(msg.channel.id) ?? false;
let check = false;
if (msg.channel.id === msg.guild.DB.settings.eventChannels.mesDel?.channel && msg.author ? msg.author !== msg.client.user : false && ignored === false) check = true;
if (msg.guild.DB.settings.eventChannels.mesDel?.channel !== msg.channel.id && ignored === false || check) {