mirror of
https://github.com/danbulant/Shasha
synced 2026-07-06 03:21:00 +00:00
more logged event guildUpdate.js
This commit is contained in:
parent
5ac9ab7169
commit
e6028c02f8
4 changed files with 64 additions and 27 deletions
|
|
@ -13,7 +13,7 @@ module.exports = class newquoteotd extends commando.Command {
|
||||||
group: "utility",
|
group: "utility",
|
||||||
description: "The Life exclusive command for Quote of the day.",
|
description: "The Life exclusive command for Quote of the day.",
|
||||||
guildOnly: true,
|
guildOnly: true,
|
||||||
userPermissions:["ADMINISTRATOR"]
|
userPermissions: ["ADMINISTRATOR"]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
async run(msg, arg) {
|
async run(msg, arg) {
|
||||||
|
|
@ -33,21 +33,20 @@ module.exports = class newquoteotd extends commando.Command {
|
||||||
const author = mes.guild.member(mes.author);
|
const author = mes.guild.member(mes.author);
|
||||||
let description = mes.content;
|
let description = mes.content;
|
||||||
if (!description.endsWith('.')) {
|
if (!description.endsWith('.')) {
|
||||||
description = description+'.';
|
description = description + '.';
|
||||||
}
|
}
|
||||||
const thumbnail = mes.author.displayAvatarURL({format: "png", size: 4096, dynamic: true});
|
const thumbnail = mes.author.displayAvatarURL({ format: "png", size: 4096, dynamic: true });
|
||||||
let name;
|
let name;
|
||||||
if (author.displayName) {
|
if (author.displayName) {
|
||||||
name = author.displayName;
|
name = author.displayName;
|
||||||
} else {
|
} else {
|
||||||
name = author.username;
|
name = author.username;
|
||||||
}
|
}
|
||||||
emb
|
emb.setTitle(name)
|
||||||
.setTitle(name)
|
.setDescription(description)
|
||||||
.setDescription(description)
|
.setThumbnail(thumbnail)
|
||||||
.setThumbnail(thumbnail)
|
.setFooter(quoteOTD.footerText || "", quoteOTD.footerIcon)
|
||||||
.setFooter(quoteOTD.footerText || "", quoteOTD.footerIcon)
|
.setColor(color[Math.floor(Math.random() * color.length)]);
|
||||||
.setColor(color[Math.floor(Math.random()*color.length)]);
|
|
||||||
const sent = await trySend(this.client, quoteOTD.channel, emb);
|
const sent = await trySend(this.client, quoteOTD.channel, emb);
|
||||||
if (sent) {
|
if (sent) {
|
||||||
ranLog(msg, "New quote: " + sent.content + "\nBy: " + mes.author.tag + ` (${mes.author.id})`);
|
ranLog(msg, "New quote: " + sent.content + "\nBy: " + mes.author.tag + ` (${mes.author.id})`);
|
||||||
|
|
|
||||||
|
|
@ -67,8 +67,7 @@ module.exports = async (memberold, membernew) => {
|
||||||
if (the.executor.id === memberold.id) nullReason = true;
|
if (the.executor.id === memberold.id) nullReason = true;
|
||||||
auditPerm = true;
|
auditPerm = true;
|
||||||
}
|
}
|
||||||
emb.addField("Current Nickname", "`" + membernew.displayName + "`")
|
emb.addField("Nickname", "Changed from `" + memberold.displayName + "` to `" + membernew.displayName + "`");
|
||||||
.addField("Original Nickname", "`" + memberold.displayName + "`");
|
|
||||||
if (audit.executor) {
|
if (audit.executor) {
|
||||||
if (!audit.executor.bot) nullReason = true;
|
if (!audit.executor.bot) nullReason = true;
|
||||||
emb.setAuthor(emb.author.name, audit.executor.displayAvatarURL({ size: 128, format: "png", dynamic: true }));
|
emb.setAuthor(emb.author.name, audit.executor.displayAvatarURL({ size: 128, format: "png", dynamic: true }));
|
||||||
|
|
@ -86,8 +85,8 @@ module.exports = async (memberold, membernew) => {
|
||||||
emb.setTitle("Profile `" + memberold.user.tag + "` updated" +
|
emb.setTitle("Profile `" + memberold.user.tag + "` updated" +
|
||||||
(audit?.executor ? ` by \`${audit.executor.tag}\`` : ""))
|
(audit?.executor ? ` by \`${audit.executor.tag}\`` : ""))
|
||||||
.setColor(getColor("blue"));
|
.setColor(getColor("blue"));
|
||||||
if (emb.fields?.[0]?.name !== "Avatar")
|
if (emb.fields[0]?.name !== "Avatar")
|
||||||
emb.setFooter(emb.footer.text, NEWAV);
|
emb.setFooter(emb.footer.text || "", NEWAV);
|
||||||
if (!nullReason) {
|
if (!nullReason) {
|
||||||
if (auditPerm) {
|
if (auditPerm) {
|
||||||
emb.setDescription((audit?.reason || "No reason provided") + (emb.description ? "\n\n" + emb.description : ""));
|
emb.setDescription((audit?.reason || "No reason provided") + (emb.description ? "\n\n" + emb.description : ""));
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,49 @@ module.exports = async (oldGuild, newGuild) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
if (newGuild.rulesChannelID !== oldGuild.rulesChannelID) {
|
if (newGuild.rulesChannelID !== oldGuild.rulesChannelID) {
|
||||||
emb.addField("Rules or Guidelines Channel", `Changed from <#${oldGuild.rulesChannelID}> to <#${newGuild.rulesChannelID}>`);
|
emb.addField("Rules or Guidelines Channel",
|
||||||
|
`Changed from ${oldGuild.rulesChannelID ?
|
||||||
|
"<#" + oldGuild.rulesChannelID + ">" :
|
||||||
|
"`[NONE]`"
|
||||||
|
} to ${newGuild.rulesChannelID ?
|
||||||
|
"<#" + newGuild.rulesChannelID + ">" :
|
||||||
|
"`[NONE]`"}`);
|
||||||
|
};
|
||||||
|
|
||||||
|
if (oldGuild.publicUpdatesChannelID !== newGuild.publicUpdatesChannelID) {
|
||||||
|
emb.addField("Community Updates Channel",
|
||||||
|
`Changed from ${oldGuild.publicUpdatesChannelID ?
|
||||||
|
"<#" + oldGuild.publicUpdatesChannelID + ">" :
|
||||||
|
"`[NONE]`"
|
||||||
|
} to ${newGuild.publicUpdatesChannelID ?
|
||||||
|
"<#" + newGuild.publicUpdatesChannelID + ">" :
|
||||||
|
"`[NONE]`"}`);
|
||||||
|
};
|
||||||
|
|
||||||
|
if (oldGuild.description !== newGuild.description) {
|
||||||
|
emb.addField("Current Description", newGuild.description || "`[NONE]`")
|
||||||
|
.addField("Original Description", oldGuild.description || "`[NONE]`");
|
||||||
|
};
|
||||||
|
|
||||||
|
if (oldGuild.mfaLevel !== newGuild.mfaLevel) {
|
||||||
|
const level = ["None", "Low", "Medium", "High", "Highest"];
|
||||||
|
emb.addField("Verification Level", `Changed from \`${level[oldGuild.mfaLevel]
|
||||||
|
}\` to \`${level[newGuild.mfaLevel]}\``);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (oldGuild.explicitContentFilter !== newGuild.explicitContentFilter) {
|
||||||
|
emb.addField("Explicit Media Content Filter",
|
||||||
|
`Changed from \`${oldGuild.explicitContentFilter}\` to \`${newGuild.explicitContentFilter}\``);
|
||||||
|
};
|
||||||
|
|
||||||
|
if (oldGuild.vanityURLCode !== newGuild.vanityURLCode) {
|
||||||
|
emb.addField("Vanity URL Code", `Changed from \`${oldGuild.vanityURLCode
|
||||||
|
}\` to \`${newGuild.vanityURLCode}\``);
|
||||||
|
};
|
||||||
|
|
||||||
|
if (oldGuild.ownerID !== newGuild.ownerID) {
|
||||||
|
emb.addField("Ownership", `<@${oldGuild.ownerID}> (\`${oldGuild.owner.user.tag}\` ${oldGuild.ownerID
|
||||||
|
}) have transferred Server Ownership to <@${newGuild.ownerID}> (\`${newGuild.owner.user.tag})\` ${newGuild.ownerID})`);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (oldGuild.banner !== newGuild.banner) {
|
if (oldGuild.banner !== newGuild.banner) {
|
||||||
|
|
@ -110,23 +152,19 @@ module.exports = async (oldGuild, newGuild) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
if (cached.iconURL && cached.iconURL !== newIcon) {
|
if (cached.iconURL && cached.iconURL !== newIcon) {
|
||||||
const newEmb = new MessageEmbed(emb);
|
await imageLogEmbed(logChannel, newEmb, "Icon", "This embed's thumbnail is the server's old icon.\nThe image below is the server's new icon.", cached.iconURL, newIcon);
|
||||||
await elseImageEmbed(logChannel, newEmb, "Icon", "This embed's thumbnail is the server's old icon.\nThe image below is the server's new icon.", cached.iconURL, newIcon);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (oldBanner || newBanner) {
|
if (oldBanner || newBanner) {
|
||||||
const newEmb = new MessageEmbed(emb);
|
await imageLogEmbed(logChannel, newEmb, "Banner", "This embed's thumbnail is the server's old banner.\nThe image below is the server's new banner.", oldBanner, newBanner);
|
||||||
await elseImageEmbed(logChannel, newEmb, "Banner", "This embed's thumbnail is the server's old banner.\nThe image below is the server's new banner.", oldBanner, newBanner);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (oldSplash || newSplash) {
|
if (oldSplash || newSplash) {
|
||||||
const newEmb = new MessageEmbed(emb);
|
await imageLogEmbed(logChannel, newEmb, "Splash Invite", "This embed's thumbnail is the server's old splash invite.\nThe image below is the server's new splash invite.", oldSplash, newSplash);
|
||||||
await elseImageEmbed(logChannel, newEmb, "Splash Invite", "This embed's thumbnail is the server's old splash invite.\nThe image below is the server's new splash invite.", oldSplash, newSplash);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (oldSDisc || newSDisc) {
|
if (oldSDisc || newSDisc) {
|
||||||
const newEmb = new MessageEmbed(emb);
|
await imageLogEmbed(logChannel, newEmb, "Splash Discovery", "This embed's thumbnail is the server's old splash discovery.\nThe image below is the server's new splash discovery.", oldSDisc, newSDisc);
|
||||||
await elseImageEmbed(logChannel, newEmb, "Splash Discovery", "This embed's thumbnail is the server's old splash discovery.\nThe image below is the server's new splash discovery.", oldSDisc, newSDisc);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!emb.fields.length) return;
|
if (!emb.fields.length) return;
|
||||||
|
|
@ -140,10 +178,11 @@ module.exports = async (oldGuild, newGuild) => {
|
||||||
newGuild.updateCached("iconURL", newIcon);
|
newGuild.updateCached("iconURL", newIcon);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function elseImageEmbed(channel, embed, fieldName, fieldValue, thumbnail, image) {
|
async function imageLogEmbed(channel, embed, fieldName, fieldValue, thumbnail, image) {
|
||||||
embed.fields = [];
|
const newEmb = new MessageEmbed(embed);
|
||||||
embed.addField(fieldName, fieldValue)
|
newEmb.fields = [];
|
||||||
|
newEmb.addField(fieldName, fieldValue)
|
||||||
.setThumbnail(thumbnail)
|
.setThumbnail(thumbnail)
|
||||||
.setImage(image);
|
.setImage(image);
|
||||||
return trySend(channel.client, channel, embed);
|
return trySend(channel.client, channel, newEmb);
|
||||||
}
|
}
|
||||||
|
|
@ -37,7 +37,7 @@ module.exports = async (msg) => {
|
||||||
.setTitle((!msg.webhookID ? "Message " + msg.id : "Webhook " + msg.webhookID) + " deleted" + (audit?.executor ? ` by \`${audit.executor.tag}\`` : ""))
|
.setTitle((!msg.webhookID ? "Message " + msg.id : "Webhook " + msg.webhookID) + " deleted" + (audit?.executor ? ` by \`${audit.executor.tag}\`` : ""))
|
||||||
.setDescription(msg.content.length > 0 ? msg.content : "`[EMPTY]`")
|
.setDescription(msg.content.length > 0 ? msg.content : "`[EMPTY]`")
|
||||||
.setURL(msg.url)
|
.setURL(msg.url)
|
||||||
.setFooter(emb.footer.text, msg.author.displayAvatarURL({ size: 128, format: "png", dynamic: true }));
|
.setFooter(emb.footer.text || "", msg.author.displayAvatarURL({ size: 128, format: "png", dynamic: true }));
|
||||||
if (audit.executor)
|
if (audit.executor)
|
||||||
emb.setAuthor(emb.author.name, audit.executor.displayAvatarURL({ size: 128, format: "png", dynamic: true }));
|
emb.setAuthor(emb.author.name, audit.executor.displayAvatarURL({ size: 128, format: "png", dynamic: true }));
|
||||||
if (msg.attachments?.size > 0) {
|
if (msg.attachments?.size > 0) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue