Skip to content

Commit

Permalink
👰‍♀️ v3.1.0 Mejoras varias
Browse files Browse the repository at this point in the history
Actualización de versión de recursos
Reordenado y documentado algunos comandos y archivos de configuración
Actualizado archivos de configuración de JSON a JS para agregar comentarios
Unificado formato de logs de error
Pruebas menores
  • Loading branch information
imkuroneko committed Jul 14, 2023
1 parent 84316eb commit 23dac30
Show file tree
Hide file tree
Showing 50 changed files with 150 additions and 117 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules/
node_modules/
package-lock.json
2 changes: 1 addition & 1 deletion commands/admin/embedroles.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const { ActionRowBuilder, ButtonBuilder, ButtonStyle } = require('discord.js');
const path = require('path');

// Load configuration files ================================================================================================
const { ownerId } = require(path.resolve('./config/bot.json'));
const { ownerId } = require(path.resolve('./config/bot'));

// Module script ===========================================================================================================
exports.run = (client, message, args) => {
Expand Down
4 changes: 2 additions & 2 deletions commands/admin/embedverificacion.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ const { ActionRowBuilder, ButtonBuilder, ButtonStyle } = require('discord.js');
const path = require('path');

// Load configuration files ================================================================================================
const { ownerId } = require(path.resolve('./config/bot.json'));
const { defaultRole } = require(path.resolve('./config/roles.json'));
const { ownerId } = require(path.resolve('./config/bot'));
const { defaultRole } = require(path.resolve('./config/roles'));

// Module script ===========================================================================================================
exports.run = (client, message, args) => {
Expand Down
2 changes: 1 addition & 1 deletion commands/admin/restartbot.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const { color } = require('console-log-colors');
const path = require('path');

// Load configuration files ================================================================================================
const { ownerId } = require(path.resolve('./config/bot.json'));
const { ownerId } = require(path.resolve('./config/bot'));

// Module script ===========================================================================================================
exports.run = (client, message, args) => {
Expand Down
2 changes: 1 addition & 1 deletion commands/admin/slashdeleter.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const { Routes } = require('discord.js');
const { REST } = require('@discordjs/rest');

// Load configuration files ================================================================================================
const { clientId, ownerId, token } = require(path.resolve('./config/bot.json'))
const { clientId, ownerId, token } = require(path.resolve('./config/bot'))

// Module script ===========================================================================================================
exports.run = (client, message, args) => {
Expand Down
2 changes: 1 addition & 1 deletion commands/admin/slashregister.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const { Routes } = require('discord.js');
const { REST } = require('@discordjs/rest');

// Load configuration files ================================================================================================
const { clientId, ownerId, token } = require(path.resolve('./config/bot.json'))
const { clientId, ownerId, token } = require(path.resolve('./config/bot'))

// Module script ===========================================================================================================
exports.run = (client, message, args) => {
Expand Down
18 changes: 18 additions & 0 deletions config/bot.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module.exports = {

// Parámetros del bot
"token" : "*****************************************",
"clientId" : "815807932653633547",

// Guild donde funcionará
"guildId" : "123456789123456789",

// Owner del bot
"ownerId" : "123456789123456789",

// Prefijo para comandos del owner
"prefix" : "!",

// Zona horaria para cronjobs
"timezoneSv" : "America/Asuncion"
}
8 changes: 0 additions & 8 deletions config/bot.json

This file was deleted.

11 changes: 11 additions & 0 deletions config/channels.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = {

// Canal (de voz) para que el bot esté conectado
"presenceVoice" : "873703613820731412", // "id del canal" o false

// Canal para mensajes de bienvenida a los usuarios nuevos
"welcomeChannel" : "481650214181011467", // "id del canal" o false

// Canal de logs de entrada/salida al servidor
"log_JoinLeft" : "798679522500673597" // "id del canal" o false
}
5 changes: 0 additions & 5 deletions config/channels.json

This file was deleted.

8 changes: 6 additions & 2 deletions config/roles.json → config/roles.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{
module.exports = {

// Rol default : utilizado para el evento de verificación
"defaultRole" : "979387907343261726",

// Roles que se pueden acumular por categoría
"stackables" : {
"alertas" : [
{ "name" : "🎫⠀RaffleAlert", "id" : "665208554726359064" },
Expand All @@ -14,6 +17,7 @@
]
},

// Roles únicos por categoría
"unique" : {
"colores" : [
{ "name" : "#93b97d", "id" : "908324747098595368" },
Expand All @@ -23,4 +27,4 @@
{ "name" : "#ef7993", "id" : "908324733706207303" }
]
}
}
}
10 changes: 10 additions & 0 deletions config/tickets.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = {
// ID del rol del staff que podrá visualizar/gestionar los tickets
"staffRole" : "",

// Segundos para que el ticket se elimine una vez triggereado el evento de eliminar
"secDelTicket" : 10,

// Control al salir usuario del servidor; borrar sus tickets?
"deleteTicketOnLeft" : true
}
5 changes: 0 additions & 5 deletions config/tickets.json

This file was deleted.

9 changes: 9 additions & 0 deletions config/twitch.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = {

// Credenciales de twitch : obtener en https://dev.twitch.tv/console (app; no extensión)
"clientId" : "",
"clientSecret" : "",

// Para alertar a los usuarios del guild; opciones disponibles: "id_numerico_del_rol" o "everyone"
"tagAlert" : ""
}
5 changes: 0 additions & 5 deletions config/twitch.json

This file was deleted.

4 changes: 2 additions & 2 deletions crons/displayTwitchAlert.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ const path = require('path');
const cron = require('cron');

// Load configuration files ================================================================================================
const { timezoneSv } = require(path.resolve('./config/bot.json'));
const { tagAlert } = require(path.resolve('./config/twitch.json'));
const { timezoneSv } = require(path.resolve('./config/bot'));
const { tagAlert } = require(path.resolve('./config/twitch'));

// Load custom functions ===================================================================================================
const twitch = require(path.resolve('./functions/twitch'));
Expand Down
4 changes: 2 additions & 2 deletions data/json/embeds.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"footer" : {
"url" : "https://unicodesoft.net",
"text" : "🦄 by Unicodesoft | Todos los derechos reservados"
"url" : "https://kuroneko.im",
"text" : "🦄 by kuroneko | Todos los derechos reservados"
},

"template" : {
Expand Down
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.0.0",
version : "3.1.0",

script : "./index.js",
exec_mode : "fork",
Expand Down
17 changes: 8 additions & 9 deletions events/misc/guildMemberAdd.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ const { Events } = require('discord.js');
const path = require('path');

// Load configuration files ================================================================================================
const { welcomeChannel, log_JoinLeft } = require(path.resolve('./config/channels.json'));
const { clientId } = require(path.resolve('./config/bot.json'));
const { welcomeChannel, log_JoinLeft } = require(path.resolve('./config/channels'));
const { clientId } = require(path.resolve('./config/bot'));

// Module script ===========================================================================================================
module.exports = {
Expand All @@ -17,20 +17,19 @@ module.exports = {
const userTag = member.user.tag;
const userId = member.user.id;

if(welcomeChannel.length > 0) {
if(welcomeChannel) {
const sender_welcome = member.guild.channels.cache.get(welcomeChannel);
sender_welcome.send({ embeds: [{
color: 0xcc3366,
description:
`Bienvenido <@${userId}> al servidor 👋🏻 Esperamos disfrutes tu estadía en el servidor.\n\n
**Sobre Mí:** <#637941772063866890>
**Reglas del servidor:** <#751891992178327573>
**Obtén roles geniales:** <#938245623495393300>
`
`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>`
}] });
}

if(log_JoinLeft.length > 0) {
if(log_JoinLeft) {
const sender_log = member.guild.channels.cache.get(log_JoinLeft);
sender_log.send({ embeds: [{
color: 0x89db4f,
Expand Down
6 changes: 3 additions & 3 deletions events/misc/guildMemberRemove.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ const { Events } = require('discord.js');
const path = require('path');

// Load configuration files ================================================================================================
const { log_JoinLeft } = require(path.resolve('./config/channels.json'));
const { clientId } = require(path.resolve('./config/bot.json'));
const { log_JoinLeft } = require(path.resolve('./config/channels'));
const { clientId } = require(path.resolve('./config/bot'));

// Module script ===========================================================================================================
module.exports = {
Expand All @@ -16,7 +16,7 @@ module.exports = {
const user = member.user.tag;
const userId = member.user.id;

if(log_JoinLeft.length > 0) {
if(log_JoinLeft) {
const sender_log = member.guild.channels.cache.get(log_JoinLeft);
sender_log.send({ embeds: [{
color: 0xe35d5d,
Expand Down
2 changes: 1 addition & 1 deletion events/misc/messageCreate.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const { Events } = require('discord.js');
const path = require('path');

// Load configuration files ================================================================================================
const { prefix } = require(path.resolve('./config/bot.json'));
const { prefix } = require(path.resolve('./config/bot'));

// Module script ===========================================================================================================
module.exports = {
Expand Down
2 changes: 1 addition & 1 deletion events/misc/ready.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const fs = require('fs');
const { joinVoiceChannel, VoiceConnectionStatus } = require('@discordjs/voice');

// Load configuration files ================================================================================================
const { presenceVoice } = require(path.resolve('./config/channels.json'));
const { presenceVoice } = require(path.resolve('./config/channels'));
const activity = require(path.resolve('./data/json/activity.json'));

// Module script ===========================================================================================================
Expand Down
6 changes: 3 additions & 3 deletions events/misc/voiceStateUpdate.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ const path = require('path');
const { joinVoiceChannel } = require('@discordjs/voice');

// Load configuration files ================================================================================================
const channels = require(path.resolve('./config/channels.json'));
const config = require(path.resolve('./config/bot.json'));
const channels = require(path.resolve('./config/channels'));
const config = require(path.resolve('./config/bot'));

// Module script ===========================================================================================================
module.exports = {
name: Events.VoiceStateUpdate,
async execute(oldState, newState) {
try {
if((newState.channelID === null || typeof newState.channelID == 'undefined') && newState.id == config.clientId) {
if(channels.presenceVoice.length > 0) {
if(channels.presenceVoice) {
const voiceChannelReconn = newState.guild.channels.cache.get(channels.presenceVoice);
joinVoiceChannel({
channelId: voiceChannelReconn.id,
Expand Down
2 changes: 1 addition & 1 deletion events/tickets/guildMemberRemove.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const { Events } = require('discord.js');
const path = require('path');

// Load configuration files ================================================================================================
const { deleteTicketOnLeft } = require(path.resolve('./config/tickets.json'));
const { deleteTicketOnLeft } = require(path.resolve('./config/tickets'));

// Load SQLite Helper ======================================================================================================
const sqlite = require(path.resolve('./functions/tickets.js'))
Expand Down
2 changes: 1 addition & 1 deletion functions/tickets.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const timezone = require('dayjs/plugin/timezone');
const { color } = require('console-log-colors');

// Load configuration files ================================================================================================
const { timezoneSv } = require(path.resolve('./config/bot.json'));
const { timezoneSv } = require(path.resolve('./config/bot'));

// Database ================================================================================================================
const sql = new SQLite(path.resolve('./data/db/tickets.sqlite'));
Expand Down
4 changes: 2 additions & 2 deletions functions/twitch.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ const timezone = require('dayjs/plugin/timezone');
const path = require('path');

// Load configuration files ================================================================================================
const { timezoneSv } = require(path.resolve('./config/bot.json'));
const { clientId, clientSecret } = require(path.resolve('./config/twitch.json'));
const { timezoneSv } = require(path.resolve('./config/bot'));
const { clientId, clientSecret } = require(path.resolve('./config/twitch'));

// Load database ===========================================================================================================
const sql = new SQLite(path.resolve('./data/db/twitch.sqlite'));
Expand Down
6 changes: 2 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// Load required resources =================================================================================================
const { Client, GatewayIntentBits, Partials, Collection } = require('discord.js');
const { color } = require('console-log-colors');
const path = require('path');
const fs = require('fs');
const { Client, GatewayIntentBits, Partials, Collection } = require('discord.js');

// Load configuration files ================================================================================================
const { token } = require(path.resolve('./config/bot.json'));
const { token } = require(path.resolve('./config/bot'));

// Define client Intents ===================================================================================================
const client = new Client({
Expand Down Expand Up @@ -63,8 +63,6 @@ try {
console.error(color.red('[load:interactions:slash]'), error.message);
}

return;

// Interactions :: Buttons =================================================================================================
try {
client.interactionsButtons = new Collection();
Expand Down
2 changes: 1 addition & 1 deletion interactions/buttons/misc/rolesManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
const path = require('path');

// Load configuration files ================================================================================================
const roles = require(path.resolve('./config/roles.json'));
const roles = require(path.resolve('./config/roles'));

// Module script ===========================================================================================================
module.exports = {
Expand Down
2 changes: 1 addition & 1 deletion interactions/buttons/misc/securityCheck.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
const path = require('path');

// Load configuration files ================================================================================================
const { defaultRole } = require(path.resolve('./config/roles.json'));
const { defaultRole } = require(path.resolve('./config/roles'));

// Module script ===========================================================================================================
module.exports = {
Expand Down
8 changes: 4 additions & 4 deletions interactions/buttons/tickets/closeTicket.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// Load required resources =================================================================================================
const { color } = require('console-log-colors');
const { ButtonBuilder, ActionRowBuilder, ButtonStyle } = require('discord.js');
const { color } = require('console-log-colors');
const path = require('path');

// Load configuration files ================================================================================================
const { clientId } = require(path.resolve('./config/bot.json'));
const { staffRole } = require(path.resolve('./config/tickets.json'));
const { clientId } = require(path.resolve('./config/bot'));
const { staffRole } = require(path.resolve('./config/tickets'));
const { template } = require(path.resolve('./data/json/embeds.json'));

// Load SQLite Helper ======================================================================================================
Expand Down Expand Up @@ -61,7 +61,7 @@ module.exports = {
channelEdit.edit({ permissionOverwrites: channelPermissions });
});
} catch(error) {
console.error(color.red('[interaction:buttons:closeticket]'), error);
console.error(color.red('[interaction:buttons:closeticket]'), error.message);
}
}
};
Loading

0 comments on commit 23dac30

Please sign in to comment.