-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Mod-logs feature, Bug fixes, and small updates
- Loading branch information
Showing
11 changed files
with
208 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
const config = require('../../config'); | ||
const ExtendedClient = require('../../class/ExtendedClient'); | ||
const { EmbedBuilder } = require('discord.js'); | ||
const { time } = require('../../functions'); | ||
|
||
module.exports = { | ||
event: 'guildBanAdd', | ||
/** | ||
* | ||
* @param {ExtendedClient} client | ||
* @param {import('discord.js').GuildBan} ban | ||
* @returns | ||
*/ | ||
run: async (client, ban) => { | ||
|
||
if (!(config.channels.modLogs.enabled && config.channels.modLogs.channel)) return; | ||
|
||
const modLogsChannel = client.channels.cache.get(config.channels.modLogs.channel); | ||
|
||
if (!modLogsChannel || modLogsChannel.guildId !== ban.guild.id) return; | ||
|
||
try { | ||
const data = [ | ||
`**User**: ${ban.user.toString()}`, | ||
`**Reason**: ${ban.reason}`, | ||
`**Date**: ${time(Date.now(), 'D')} (${time(Date.now(), 'R')})`, | ||
]; | ||
|
||
await modLogsChannel.send({ | ||
embeds: [ | ||
new EmbedBuilder() | ||
.setTitle('Guild Ban Add') | ||
.setThumbnail(message.author.displayAvatarURL()) | ||
.setDescription(data.join('\n')) | ||
.setColor('Red') | ||
] | ||
}); | ||
} catch (err) { | ||
console.error(err); | ||
}; | ||
|
||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
const config = require('../../config'); | ||
const ExtendedClient = require('../../class/ExtendedClient'); | ||
const { EmbedBuilder } = require('discord.js'); | ||
const { time } = require('../../functions'); | ||
|
||
module.exports = { | ||
event: 'messageDelete', | ||
/** | ||
* | ||
* @param {ExtendedClient} client | ||
* @param {import('discord.js').Message} message | ||
* @returns | ||
*/ | ||
run: async (client, message) => { | ||
|
||
if (!(config.channels.modLogs.enabled && config.channels.modLogs.channel)) return; | ||
|
||
const modLogsChannel = client.channels.cache.get(config.channels.modLogs.channel); | ||
|
||
if (!modLogsChannel || modLogsChannel.guildId !== message.guild.id) return; | ||
|
||
if (message.author.bot) return; | ||
|
||
try { | ||
const data = [ | ||
`**Content**: ${message.content}`, | ||
`**Author**: ${message.author.toString()}`, | ||
`**Date**: ${time(Date.now(), 'D')} (${time(Date.now(), 'R')})`, | ||
]; | ||
|
||
await modLogsChannel.send({ | ||
embeds: [ | ||
new EmbedBuilder() | ||
.setTitle('Message Delete') | ||
.setThumbnail(message.author.displayAvatarURL()) | ||
.setDescription(data.join('\n')) | ||
.setColor('Yellow') | ||
] | ||
}); | ||
} catch (err) { | ||
console.error(err); | ||
}; | ||
|
||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
const config = require('../../config'); | ||
const ExtendedClient = require('../../class/ExtendedClient'); | ||
const { EmbedBuilder } = require('discord.js'); | ||
const { time, log } = require('../../functions'); | ||
|
||
module.exports = { | ||
event: 'messageUpdate', | ||
/** | ||
* | ||
* @param {ExtendedClient} client | ||
* @param {import('discord.js').Message} oldMessage | ||
* @param {import('discord.js').Message} newMessage | ||
* @returns | ||
*/ | ||
run: async (client, oldMessage, newMessage) => { | ||
|
||
if (!(config.channels.modLogs.enabled && config.channels.modLogs.channel)) return; | ||
|
||
const modLogsChannel = client.channels.cache.get(config.channels.modLogs.channel); | ||
|
||
if (!modLogsChannel || modLogsChannel.guildId !== newMessage.guildId) return; | ||
|
||
if (oldMessage.author.bot || newMessage.author.bot) return; | ||
|
||
try { | ||
const data = [ | ||
`**Old**: ${oldMessage.content}`, | ||
`**Updated**: ${newMessage.content}`, | ||
`**Author**: ${newMessage.author.toString()}`, | ||
`**Date**: ${time(Date.now(), 'D')} (${time(Date.now(), 'R')})`, | ||
]; | ||
|
||
await modLogsChannel.send({ | ||
embeds: [ | ||
new EmbedBuilder() | ||
.setTitle('Message Update') | ||
.setThumbnail(newMessage.author.displayAvatarURL()) | ||
.setDescription(data.join('\n')) | ||
.setColor('Yellow') | ||
] | ||
}); | ||
} catch (err) { | ||
console.error(err); | ||
}; | ||
|
||
} | ||
}; |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters