Skip to content

Commit

Permalink
[v3.2.0] Agregado i18n; Mejorado !embedroles
Browse files Browse the repository at this point in the history
  • Loading branch information
imkuroneko committed Jul 29, 2023
1 parent a840d66 commit 220c0f0
Show file tree
Hide file tree
Showing 23 changed files with 137 additions and 109 deletions.
82 changes: 44 additions & 38 deletions commands/admin/embedroles.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ const { ActionRowBuilder, ButtonBuilder, ButtonStyle } = require('discord.js');
const path = require('path');

// Load configuration files ================================================================================================
const { ownerId } = require(path.resolve('./config/bot'));
const { ownerId, embedColor } = require(path.resolve('./config/bot'));
const embedRoles = require(path.resolve('./data/i18n/roles'));
const roles = require(path.resolve('./config/roles'));

// Module script ===========================================================================================================
exports.run = (client, message, args) => {
Expand All @@ -12,43 +14,47 @@ exports.run = (client, message, args) => {
return message.reply("🚨 **no tienes permiso para ejecutar este comando!**");
}

// ======================= Roles de alertas ========================
message.channel.send({ embeds: [{
color: 0xc676f5,
title: '**📣 Roles de Alertas**',
description: 'Si deseas recibir alertas específicas, haz clic en los botones de abajo para recibir el rol y estar al tanto de ello',
}], components: [ new ActionRowBuilder().addComponents(
new ButtonBuilder().setCustomId('rolesManager;665208554726359064').setLabel('RaffleAlert').setStyle(ButtonStyle.Secondary).setEmoji('🎫'),
new ButtonBuilder().setCustomId('rolesManager;606674875557478416').setLabel('StreamAlert').setStyle(ButtonStyle.Secondary).setEmoji('🎥'),
) ] });


// ======================= Roles de hobbies ========================
message.channel.send({ embeds: [{
color: 0xc676f5,
title: '**🌌 Roles de Hobbies**',
description: 'Haz clic en los botones de abajo para recibir el rol de cada hobbie con el que te identifiques',
}], components: [ new ActionRowBuilder().addComponents(
new ButtonBuilder().setCustomId('rolesManager;461330378691444767').setLabel('Developer').setStyle(ButtonStyle.Secondary).setEmoji('💻'),
new ButtonBuilder().setCustomId('rolesManager;488012857909182464').setLabel('Artist').setStyle(ButtonStyle.Secondary).setEmoji('🎨'),
new ButtonBuilder().setCustomId('rolesManager;467854409284452362').setLabel('Gamer').setStyle(ButtonStyle.Secondary).setEmoji('🎮'),
new ButtonBuilder().setCustomId('rolesManager;528826642156748802').setLabel('Streamer').setStyle(ButtonStyle.Secondary).setEmoji('🎥'),
) ] });


// ==================== Roles de colores únicos ====================
message.channel.send({ embeds: [{
color: 0xc676f5,
title: '**🎨 Roles de Colores**',
description: 'Haz clic en los botones de abajo para tener el rol con el color que mas te guste',
}], components: [ new ActionRowBuilder().addComponents(
new ButtonBuilder().setCustomId('rolesManager;908324747098595368').setLabel('#93b97d').setStyle(ButtonStyle.Secondary).setEmoji('878063019022753813'),
new ButtonBuilder().setCustomId('rolesManager;908324738252820520').setLabel('#66c1bc').setStyle(ButtonStyle.Secondary).setEmoji('878063019182145536'),
new ButtonBuilder().setCustomId('rolesManager;908324743814467595').setLabel('#ebda79').setStyle(ButtonStyle.Secondary).setEmoji('878063019110850610'),
new ButtonBuilder().setCustomId('rolesManager;908324749615181824').setLabel('#7982ef').setStyle(ButtonStyle.Secondary).setEmoji('878063019110838312'),
new ButtonBuilder().setCustomId('rolesManager;908324733706207303').setLabel('#ef7993').setStyle(ButtonStyle.Secondary).setEmoji('878063018955636747'),
) ] });

const stackable = roles.stackables;
Object.keys(stackable).forEach(key => {
if(!embedRoles[key]) { return; }

let buttonsRoles = [];
stackable[key].forEach((rol) => {
buttonsRoles.push(new ButtonBuilder().setCustomId(`rolesManager;${rol.id}`).setLabel(rol.name).setStyle(ButtonStyle.Secondary).setEmoji(rol.emoji));
});

message.channel.send({
embeds: [{
color: parseInt(embedColor, 16),
title: embedRoles[key].title,
description: embedRoles[key].description,
}],
components: [ new ActionRowBuilder().addComponents(buttonsRoles) ]
}).catch((error) => {
console.error('[cmdPrefix:embedroles:stackable]', error.message);
});
});

const unique = roles.unique;
Object.keys(unique).forEach(key => {
if(!embedRoles[key]) { return; }

let buttonsRoles = [];
unique[key].forEach((rol) => {
buttonsRoles.push(new ButtonBuilder().setCustomId(`rolesManager;${rol.id}`).setLabel(rol.name).setStyle(ButtonStyle.Secondary).setEmoji(rol.emoji));
});

message.channel.send({
embeds: [{
color: parseInt(embedColor, 16),
title: embedRoles[key].title,
description: embedRoles[key].description,
}],
components: [ new ActionRowBuilder().addComponents(buttonsRoles) ]
}).catch((error) => {
console.error('[cmdPrefix:embedroles:unique]', error.message);
});
});
} catch(error) {
console.error('[cmdPrefix:embedroles]', error.message);
}
Expand Down
3 changes: 2 additions & 1 deletion config/bot.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ module.exports = {
"embedColor" : "cc3366",

// Se envía con imagen el mensaje de bienvenida?
"welcomeHasImage" : false,
"welcomeSendImage" : true,
"welcomeSendEmbed" : true,

// Zona horaria para cronjobs
"timezoneSv" : "America/Asuncion"
Expand Down
22 changes: 11 additions & 11 deletions config/roles.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,25 @@ module.exports = {
// Roles que se pueden acumular por categoría
"stackables" : {
"alertas" : [
{ "name" : "🎫⠀RaffleAlert", "id" : "665208554726359064" },
{ "name" : "🎥⠀StreamAlert", "id" : "606674875557478416" }
{ "name" : "RaffleAlert", "id" : "665208554726359064", "emoji": "🎫" },
{ "name" : "StreamAlert", "id" : "606674875557478416", "emoji": "🎥" }
],
"hobbies" : [
{ "name" : "💻⠀Developer", "id" : "461330378691444767" },
{ "name" : "🎨⠀Artist", "id" : "488012857909182464" },
{ "name" : "🎮⠀Gamer", "id" : "467854409284452362" },
{ "name" : "🎥⠀Streamer", "id" : "528826642156748802" }
{ "name" : "Developer", "id" : "461330378691444767", "emoji": "💻" },
{ "name" : "Artist", "id" : "488012857909182464", "emoji": "🎨" },
{ "name" : "Gamer", "id" : "467854409284452362", "emoji": "🎮" },
{ "name" : "Streamer", "id" : "528826642156748802", "emoji": "🎥" }
]
},

// Roles únicos por categoría
"unique" : {
"colores" : [
{ "name" : "#93b97d", "id" : "908324747098595368" },
{ "name" : "#66c1bc", "id" : "908324738252820520" },
{ "name" : "#ebda79", "id" : "908324743814467595" },
{ "name" : "#7982ef", "id" : "908324749615181824" },
{ "name" : "#ef7993", "id" : "908324733706207303" }
{ "name" : "#93b97d", "id" : "908324747098595368", "emoji" : "878063019022753813" },
{ "name" : "#66c1bc", "id" : "908324738252820520", "emoji" : "878063019182145536" },
{ "name" : "#ebda79", "id" : "908324743814467595", "emoji" : "878063019110850610" },
{ "name" : "#7982ef", "id" : "908324749615181824", "emoji" : "878063019110838312" },
{ "name" : "#ef7993", "id" : "908324733706207303", "emoji" : "878063018955636747" }
]
}
}
19 changes: 19 additions & 0 deletions data/i18n/members.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
module.exports = {
// ==== on:guildMemberAdd
"memberJoinPublic" : {
"title" : "",
"description" :
"Bienvenido al servidor 👋🏻 Esperamos disfrutes tu estadía en el servidor.\n\n"+
"**Sobre Mí:** <#637941772063866890>\n"+
"**Reglas del servidor:** <#751891992178327573>\n"+
"**Obtén roles geniales:** <#938245623495393300>"
},
"memberJoinLog" : {
"title" : "👋🏻 Un usuario se acaba de unir al servidor"
},

// ==== on:guildMemberRemove
"memberLeftLog" : {
"title" : "👋🏻 Un usuario se acaba de ir del servidor"
}
}
15 changes: 15 additions & 0 deletions data/i18n/roles.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module.exports = {
"alertas" : {
"title" : "**📣 Roles de Alertas**",
"description" : "Si deseas recibir alertas específicas, haz clic en los botones de abajo para recibir el rol y estar al tanto de ello"
},
"hobbies" : {
"title" : "**🌌 Roles de Hobbies**",
"description" : "Haz clic en los botones de abajo para recibir el rol de cada hobbie con el que te identifiques"
},

"colores" : {
"title" : "**🎨 Roles de Colores**",
"description" : "Haz clic en los botones de abajo para tener el rol con el color que mas te guste"
},
}
5 changes: 2 additions & 3 deletions data/json/i18n/tickets.json → data/i18n/tickets.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
module.exports = {
"footer" : {
"url" : "https://kuroneko.im",
"text" : "🦄 by kuroneko | Todos los derechos reservados"
"text" : "🦄 by kuroneko"
},

"template" : {
Expand Down Expand Up @@ -31,5 +31,4 @@
"description" : "Este ticket será eliminado en {seconds} segundos."
}
}

}
18 changes: 0 additions & 18 deletions data/json/i18n/members.json

This file was deleted.

2 changes: 1 addition & 1 deletion ecosystem.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = {
apps : [{
name : "TheiBot",
version : "3.1.0",
version : "3.2.0",

script : "./index.js",
exec_mode : "fork",
Expand Down
38 changes: 22 additions & 16 deletions events/members/guildMemberAdd.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ const path = require('path');

// Load configuration files ================================================================================================
const { welcomeChannel, log_JoinLeft } = require(path.resolve('./config/channels'));
const { clientId, welcomeHasImage, embedColor } = require(path.resolve('./config/bot'));
const { clientId, welcomeSendImage, welcomeSendEmbed, embedColor } = require(path.resolve('./config/bot'));
const { memberJoinPublic, memberJoinLog } = require(path.resolve('./data/i18n/members'));

// Module script ===========================================================================================================
module.exports = {
Expand All @@ -22,8 +23,11 @@ module.exports = {
sender_log.send({
embeds: [{
color: 0x89db4f,
title: `👋🏻 Un usuario se acaba de unir al servidor`,
fields: [ { name: 'Usuario', value: userTag }, { name: 'User ID', value: userId } ]
title: memberJoinLog.title,
fields: [
{ name: 'Usuario', value: userTag },
{ name: 'User ID', value: userId }
]
}]
});
} catch(error) {
Expand All @@ -35,8 +39,10 @@ module.exports = {
try {
const sender_welcome = member.guild.channels.cache.get(welcomeChannel);

let filesAttach = [];
if(welcomeHasImage) {
let attachFiles = [];
let attachEmbed = [];

if(welcomeSendImage) {
// Crear lienzo
const canvas = Canvas.createCanvas(700, 250);
const ctx = canvas.getContext('2d');
Expand Down Expand Up @@ -77,20 +83,20 @@ module.exports = {
// Adjuntar contenido multimedia
const mediaAttachment = new AttachmentBuilder(canvas.toBuffer(), 'img.png')

filesAttach =[ mediaAttachment ];
attachFiles =[ mediaAttachment ];
}

sender_welcome.send({
files: filesAttach,
embeds: [{
if(welcomeSendEmbed) {
attachEmbed = [{
color: parseInt(embedColor, 16),
description:
`Bienvenido <@${userId}> al servidor 👋🏻 Esperamos disfrutes tu estadía en el servidor.\n\n`+
`**Sobre Mí:** <#637941772063866890>\n`+
`**Reglas del servidor:** <#751891992178327573>\n`+
`**Obtén roles geniales:** <#938245623495393300>`
}]
});
title: memberJoinPublic.title,
description: memberJoinPublic.description
}];
}

if(!welcomeSendImage && !welcomeSendEmbed) { return; }

sender_welcome.send({ files: attachFiles, embeds: attachEmbed });
} catch(error) {
console.error('[event:guildMemberAdd:welcome]', error.message);
}
Expand Down
16 changes: 11 additions & 5 deletions events/members/guildMemberRemove.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const path = require('path');
// Load configuration files ================================================================================================
const { log_JoinLeft } = require(path.resolve('./config/channels'));
const { clientId } = require(path.resolve('./config/bot'));
const { memberLeftLog } = require(path.resolve('./data/i18n/members'));

// Module script ===========================================================================================================
module.exports = {
Expand All @@ -18,11 +19,16 @@ module.exports = {

if(log_JoinLeft) {
const sender_log = member.guild.channels.cache.get(log_JoinLeft);
sender_log.send({ embeds: [{
color: 0xe35d5d,
title: `👋🏻 Un usuario se acaba de ir del servidor`,
fields: [ { name: 'Usuario', value: user }, { name: 'User ID', value: userId } ]
}] });
sender_log.send({
embeds: [{
color: 0xe35d5d,
title: memberLeftLog.title,
fields: [
{ name: 'Usuario', value: user },
{ name: 'User ID', value: userId }
]
}]
});
}
} catch(error) {
console.error('[event:clientMemberRemove]', error.message);
Expand Down
2 changes: 1 addition & 1 deletion interactions/buttons/tickets/closeTicket.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const path = require('path');
// Load configuration files ================================================================================================
const { clientId } = require(path.resolve('./config/bot'));
const { staffRole } = require(path.resolve('./config/tickets'));
const { template } = require(path.resolve('./data/json/i18n/tickets.json'));
const { template } = require(path.resolve('./data/i18n/tickets'));

// Load SQLite Helper ======================================================================================================
const sqlite = require(path.resolve('./functions/tickets.js'));
Expand Down
2 changes: 1 addition & 1 deletion interactions/buttons/tickets/deleteTicket.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const wait = require('node:timers/promises').setTimeout;

// Load configuration files ================================================================================================
const { secDelTicket } = require(path.resolve('./config/tickets'));
const { template } = require(path.resolve('./data/json/i18n/tickets.json'));
const { template } = require(path.resolve('./data/i18n/tickets'));

// Load SQLite Helper ======================================================================================================
const sqlite = require(path.resolve('./functions/tickets.js'));
Expand Down
2 changes: 1 addition & 1 deletion interactions/buttons/tickets/reopenTicket.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const path = require('path');
// Load configuration files ================================================================================================
const { clientId } = require(path.resolve('./config/bot'));
const { staffRole } = require(path.resolve('./config/tickets'));
const { template } = require(path.resolve('./data/json/i18n/tickets.json'));
const { template } = require(path.resolve('./data/i18n/tickets'));

// Load SQLite Helper ======================================================================================================
const sqlite = require(path.resolve('./functions/tickets.js'));
Expand Down
2 changes: 1 addition & 1 deletion interactions/selectMenu/tickets/createTicket.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const wait = require('node:timers/promises').setTimeout;
// Load configuration files ================================================================================================
const { clientId } = require(path.resolve('./config/bot'));
const { staffRole } = require(path.resolve('./config/tickets'));
const { template, footer } = require(path.resolve('./data/json/i18n/tickets.json'));
const { template, footer } = require(path.resolve('./data/i18n/tickets'));

// Load SQLite Helper ======================================================================================================
const sqlite = require(path.resolve('./functions/tickets.js'));
Expand Down
2 changes: 1 addition & 1 deletion interactions/slashCommands/misc/host.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const path = require('path');
const os = require('os');

// Load custom functions ===================================================================================================
const { footer } = require(path.resolve('./data/json/i18n/tickets.json'));
const { footer } = require(path.resolve('./data/i18n/tickets'));
const helpers = require(path.resolve('./functions/helpers.js'));

// Module script ===========================================================================================================
Expand Down
2 changes: 1 addition & 1 deletion interactions/slashCommands/misc/nuggots.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module.exports = {
.setDMPermission(false),
async execute(interaction) {
try {
return interaction.reply('**Nuggots for the confederation!** <:theiNuggot:1041412115728191598>');
return interaction.reply('**Nuggots for the confederation!** 🍗');
} catch(error) {
console.error('[interaction:slashcmd:nuggots]', error.message);
}
Expand Down
1 change: 0 additions & 1 deletion interactions/slashCommands/misc/server.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Load required resources =================================================================================================
const { SlashCommandBuilder } = require('discord.js');
const { color } = require('console-log-colors');
const path = require('path');

// Load configuration files ================================================================================================
Expand Down
1 change: 0 additions & 1 deletion interactions/slashCommands/tickets/categorias_modificar.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Load required resources =================================================================================================
const { SlashCommandBuilder } = require('discord.js');
const { color } = require('console-log-colors');
const path = require('path');

// Load SQLite Helper ======================================================================================================
Expand Down
Loading

0 comments on commit 220c0f0

Please sign in to comment.