-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add multi-language support for events
- Loading branch information
Derek
committed
Apr 3, 2021
1 parent
afd6dbe
commit 16fb37a
Showing
16 changed files
with
319 additions
and
260 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,23 @@ | ||
const Discord = require("discord.js"); | ||
const colors = require('../lib/colors.json') | ||
|
||
module.exports = (client, emoji) => { | ||
let settings = client.getSettings(emoji.guild.id); | ||
if (settings.logEmojiUpdates == "true") { | ||
let modLogChannel = settings.modLogChannel; | ||
let settings = client.getSettings(emoji.guild.id); | ||
const language = settings.language | ||
const lang = require("../lib/languages/" + language + ".json") | ||
|
||
if (modLogChannel && emoji.guild.channels.cache.find(c => c.name === settings.modLogChannel)) { | ||
let embed = new Discord.MessageEmbed() | ||
.setTitle("Emoji Create") | ||
.setColor("#eeeeee") | ||
.setDescription(`Name: ${emoji.name}\nID: ${emoji.id}`) | ||
.addField("Emoji URL", emoji.url); | ||
if (settings.logEmojiUpdates == "true") { | ||
let modLogChannel = settings.modLogChannel; | ||
|
||
emoji.guild.channels.cache.find(c => c.name === settings.modLogChannel).send(embed); | ||
if (modLogChannel && emoji.guild.channels.cache.find(c => c.name === settings.modLogChannel)) { | ||
let embed = new Discord.MessageEmbed() | ||
.setTitle(`🙂 ${lang.EmojiCreated}`) | ||
.setColor(colors.green) | ||
.setDescription(`${lang.Name}: ${emoji.name}\n${lang.ID}: ${emoji.id}`) | ||
.addField(lang.EmojiURL, emoji.url) | ||
.setTimestamp() | ||
|
||
emoji.guild.channels.cache.find(c => c.name === settings.modLogChannel).send(embed); | ||
} | ||
} | ||
} | ||
}; |
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 |
---|---|---|
@@ -1,18 +1,23 @@ | ||
const Discord = require("discord.js"); | ||
const colors = require('../lib/colors.json') | ||
|
||
module.exports = (client, emoji) => { | ||
let settings = client.getSettings(emoji.guild.id); | ||
if (settings.logEmojiUpdates == "true") { | ||
let modLogChannel = settings.modLogChannel; | ||
let settings = client.getSettings(emoji.guild.id) | ||
const language = settings.language | ||
const lang = require("../lib/languages/" + language + ".json") | ||
|
||
if (modLogChannel && emoji.guild.channels.cache.find(c => c.name === settings.modLogChannel)) { | ||
let embed = new Discord.MessageEmbed() | ||
.setTitle("Emoji Delete") | ||
.setColor("#eeeeee") | ||
.setDescription(`Name: ${emoji.name}\nID: ${emoji.id}`) | ||
.addField("Emoji URL", emoji.url); | ||
if (settings.logEmojiUpdates == "true") { | ||
let modLogChannel = settings.modLogChannel; | ||
|
||
emoji.guild.channels.cache.find(c => c.name === settings.modLogChannel).send(embed); | ||
if (modLogChannel && emoji.guild.channels.cache.find(c => c.name === settings.modLogChannel)) { | ||
let embed = new Discord.MessageEmbed() | ||
.setTitle(`🙂 ${lang.EmojiDeleted}`) | ||
.setColor(colors.red) | ||
.setDescription(`${lang.Name}: ${emoji.name}\n${lang.ID}: ${emoji.id}`) | ||
.addField(lang.EmojiURL, emoji.url) | ||
.setTimestamp() | ||
|
||
emoji.guild.channels.cache.find(c => c.name === settings.modLogChannel).send(embed); | ||
} | ||
} | ||
} | ||
}; |
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 |
---|---|---|
@@ -1,21 +1,24 @@ | ||
const Discord = require("discord.js"); | ||
const Discord = require("discord.js"); | ||
const colors = require('../lib/colors.json') | ||
|
||
module.exports = (client, oldemoji, newemoji) => { | ||
let settings = client.getSettings(newemoji.guild.id); // Get settings | ||
if (settings.logEmojiUpdates == "true") { // If the "log emoji update" setting is set to true, then we should do this. | ||
let modLogChannel = settings.modLogChannel; // Set the logging channel | ||
let settings = client.getSettings(newemoji.guild.id); | ||
const language = settings.language | ||
const lang = require("../lib/languages/" + language + ".json") | ||
|
||
if (modLogChannel && newemoji.guild.channels.cache.find(c => c.name === settings.modLogChannel)) { | ||
let embed = new Discord.MessageEmbed() // Create embed | ||
.setTitle("Emoji Update") // Set embed title | ||
.setColor("#eeeeee") // Set color in HEX | ||
.setDescription(`New Name: ${newemoji.name}\nOld Name: ${oldemoji.name}\nID: ${newemoji.id}`) // Description of the embed | ||
.addField("New Emoji URL", newemoji.url) // URL link to the New™ Emoji® | ||
.addField("Old Emoji URL", oldemoji.url); // Url link to the old Emoji® | ||
if (settings.logEmojiUpdates == "true") { | ||
let modLogChannel = settings.modLogChannel; | ||
|
||
newemoji.guild.channels.cache.find(c => c.name === settings.modLogChannel).send(embed); // And then we send all that to the logging channel. | ||
} | ||
} | ||
}; | ||
if (modLogChannel && newemoji.guild.channels.cache.find(c => c.name === settings.modLogChannel)) { | ||
let embed = new Discord.MessageEmbed() | ||
.setTitle(`🙂 ${lang.EmojiUpdated}`) | ||
.setColor(colors.default) | ||
.setDescription(`${lang.NewName}: ${newemoji.name}\n${lang.OldName}: ${oldemoji.name}\n${lang.ID}: ${newemoji.id}`) | ||
.addField(lang.NewURL, newemoji.url) | ||
.addField(lang.OldURL, oldemoji.url) | ||
.setTimestamp() | ||
|
||
// comments by odysssssssssssssssssssssssssssssssssssssssssssssssssssey346 | ||
newemoji.guild.channels.cache.find(c => c.name === settings.modLogChannel).send(embed); | ||
} | ||
} | ||
}; |
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
const Discord = require("discord.js"); | ||
module.exports = async (client, error) => { | ||
if (JSON.stringify(error).toLowerCase().includes("discordapierror")) return; | ||
client.logger.log(error.message, "error"); // Log error | ||
client.channels.cache.get("751473673474539560").send(error.message); | ||
}; | ||
if (JSON.stringify(error).toLowerCase().includes("discordapierror")) return; | ||
client.logger.log(error.message, "error"); // Log error | ||
client.channels.cache.get("828038899825508352").send(error.message); | ||
}; |
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 |
---|---|---|
@@ -1,26 +1,28 @@ | ||
const Discord = require('discord.js') | ||
const Discord = require('discord.js') | ||
const colors = require('../lib/colors.json') | ||
|
||
module.exports = (client, guild, user) => { | ||
const settings = client.getSettings(guild.id) | ||
const modLogChannel = guild.channels.cache.find(c => c.name === settings.modLogChannel) | ||
const settings = client.getSettings(guild.id) | ||
const language = settings.language | ||
const lang = require("../lib/languages/" + language + ".json") | ||
const modLogChannel = guild.channels.cache.find(c => c.name === settings.modLogChannel) | ||
|
||
if (guild === null) return | ||
if (guild === null) return | ||
|
||
if (settings.logMessageUpdates == 'true') { | ||
if (settings.modLogChannel && guild.channels.cache.find(c => c.name == settings.modLogChannel)) { | ||
const modLogChannel = guild.channels.cache.find(c => c.name == settings.modLogChannel) | ||
if (!modLogChannel.permissionsFor(guild.me).has('VIEW_CHANNEL')) return | ||
if (!modLogChannel.permissionsFor(guild.me).has('SEND_MESSAGES')) return | ||
if (settings.logMessageUpdates == 'true') { | ||
if (settings.modLogChannel && guild.channels.cache.find(c => c.name == settings.modLogChannel)) { | ||
const modLogChannel = guild.channels.cache.find(c => c.name == settings.modLogChannel) | ||
if (!modLogChannel.permissionsFor(guild.me).has('VIEW_CHANNEL')) return | ||
if (!modLogChannel.permissionsFor(guild.me).has('SEND_MESSAGES')) return | ||
|
||
const embed = new Discord.MessageEmbed() | ||
.setTitle('🔨 Member banned') | ||
.setColor(colors.red) | ||
.setDescription(`**Total member count:** \`${guild.memberCount}\`\n<@${user.id}> was banned from the Discord.`) | ||
.setThumbnail(user.displayAvatarURL) | ||
.setTimestamp() | ||
const embed = new Discord.MessageEmbed() | ||
.setTitle(`🔨 ${lang.UserBanned}`) | ||
.setColor(colors.red) | ||
.setDescription(`**${lang.TotalMemberCount}:** \`${guild.memberCount}\`\n<@${user.id}> ${lang.BannedFromDiscord}`) | ||
.setThumbnail(user.displayAvatarURL) | ||
.setTimestamp() | ||
|
||
modLogChannel.send(embed) | ||
modLogChannel.send(embed) | ||
} | ||
} | ||
} | ||
} | ||
} |
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
Oops, something went wrong.