mirror of
https://github.com/danbulant/Shasha
synced 2026-06-19 14:21:37 +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",
|
||||
description: "The Life exclusive command for Quote of the day.",
|
||||
guildOnly: true,
|
||||
userPermissions:["ADMINISTRATOR"]
|
||||
userPermissions: ["ADMINISTRATOR"]
|
||||
});
|
||||
}
|
||||
async run(msg, arg) {
|
||||
|
|
@ -33,21 +33,20 @@ module.exports = class newquoteotd extends commando.Command {
|
|||
const author = mes.guild.member(mes.author);
|
||||
let description = mes.content;
|
||||
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;
|
||||
if (author.displayName) {
|
||||
name = author.displayName;
|
||||
} else {
|
||||
name = author.username;
|
||||
}
|
||||
emb
|
||||
.setTitle(name)
|
||||
.setDescription(description)
|
||||
.setThumbnail(thumbnail)
|
||||
.setFooter(quoteOTD.footerText || "", quoteOTD.footerIcon)
|
||||
.setColor(color[Math.floor(Math.random()*color.length)]);
|
||||
emb.setTitle(name)
|
||||
.setDescription(description)
|
||||
.setThumbnail(thumbnail)
|
||||
.setFooter(quoteOTD.footerText || "", quoteOTD.footerIcon)
|
||||
.setColor(color[Math.floor(Math.random() * color.length)]);
|
||||
const sent = await trySend(this.client, quoteOTD.channel, emb);
|
||||
if (sent) {
|
||||
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;
|
||||
auditPerm = true;
|
||||
}
|
||||
emb.addField("Current Nickname", "`" + membernew.displayName + "`")
|
||||
.addField("Original Nickname", "`" + memberold.displayName + "`");
|
||||
emb.addField("Nickname", "Changed from `" + memberold.displayName + "` to `" + membernew.displayName + "`");
|
||||
if (audit.executor) {
|
||||
if (!audit.executor.bot) nullReason = 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" +
|
||||
(audit?.executor ? ` by \`${audit.executor.tag}\`` : ""))
|
||||
.setColor(getColor("blue"));
|
||||
if (emb.fields?.[0]?.name !== "Avatar")
|
||||
emb.setFooter(emb.footer.text, NEWAV);
|
||||
if (emb.fields[0]?.name !== "Avatar")
|
||||
emb.setFooter(emb.footer.text || "", NEWAV);
|
||||
if (!nullReason) {
|
||||
if (auditPerm) {
|
||||
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) {
|
||||
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) {
|
||||
|
|
@ -110,23 +152,19 @@ module.exports = async (oldGuild, newGuild) => {
|
|||
};
|
||||
|
||||
if (cached.iconURL && cached.iconURL !== newIcon) {
|
||||
const newEmb = new MessageEmbed(emb);
|
||||
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);
|
||||
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);
|
||||
};
|
||||
|
||||
if (oldBanner || newBanner) {
|
||||
const newEmb = new MessageEmbed(emb);
|
||||
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);
|
||||
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);
|
||||
};
|
||||
|
||||
if (oldSplash || newSplash) {
|
||||
const newEmb = new MessageEmbed(emb);
|
||||
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);
|
||||
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);
|
||||
};
|
||||
|
||||
if (oldSDisc || newSDisc) {
|
||||
const newEmb = new MessageEmbed(emb);
|
||||
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);
|
||||
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);
|
||||
};
|
||||
|
||||
if (!emb.fields.length) return;
|
||||
|
|
@ -140,10 +178,11 @@ module.exports = async (oldGuild, newGuild) => {
|
|||
newGuild.updateCached("iconURL", newIcon);
|
||||
}
|
||||
|
||||
async function elseImageEmbed(channel, embed, fieldName, fieldValue, thumbnail, image) {
|
||||
embed.fields = [];
|
||||
embed.addField(fieldName, fieldValue)
|
||||
async function imageLogEmbed(channel, embed, fieldName, fieldValue, thumbnail, image) {
|
||||
const newEmb = new MessageEmbed(embed);
|
||||
newEmb.fields = [];
|
||||
newEmb.addField(fieldName, fieldValue)
|
||||
.setThumbnail(thumbnail)
|
||||
.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}\`` : ""))
|
||||
.setDescription(msg.content.length > 0 ? msg.content : "`[EMPTY]`")
|
||||
.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)
|
||||
emb.setAuthor(emb.author.name, audit.executor.displayAvatarURL({ size: 128, format: "png", dynamic: true }));
|
||||
if (msg.attachments?.size > 0) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue