diff --git a/.gitignore b/.gitignore index 47adc4ae..a09cb720 100644 --- a/.gitignore +++ b/.gitignore @@ -10,7 +10,7 @@ Dockerfile ## DATABASE FILES data/base.json -src/db/giveaways.json +/JSON/giveaways.json ## CONFIDENCIAL files diff --git a/src/db/giveaways.example.json b/JSON/giveaways.example.json similarity index 100% rename from src/db/giveaways.example.json rename to JSON/giveaways.example.json diff --git a/package.json b/package.json index 7657d8fc..2152e424 100644 --- a/package.json +++ b/package.json @@ -2,11 +2,11 @@ "name": "zuly", "version": "3.0", "description": "Hi, I'm zuly, a just brazilian bot focused on anime!", - "main": "src/zuly.js", + "main": "src/zulyClusters.js", "scripts": { "dev": "nodemon", "start": "node --max_old_space_size=512 --optimize_for_size --expose-gc --gc-interval=1 .", - "forever": "forever -c \"node --max_old_space_size=512 --optimize_for_size --expose-gc --gc-interval=1\" src/zuly.js", + "forever": "forever -c \"node --max_old_space_size=512 --optimize_for_size --expose-gc --gc-interval=1\" src/zulyClusters.js", "lint": "eslint --fix --ext .js --ignore-path .gitignore ." }, "keywords": [ diff --git a/src/Commands/Info/BotinfoCommand.js b/src/Commands/Info/BotinfoCommand.js index 2996d1d5..8166db91 100644 --- a/src/Commands/Info/BotinfoCommand.js +++ b/src/Commands/Info/BotinfoCommand.js @@ -89,19 +89,19 @@ module.exports = class BotinfoCommand { components: [ { type: 2, - label: `${ctx.idioma.labels.support}`, + label: `${ctx.idioma.mention.labels.support}`, style: 5, url: 'https://discord.gg/pyyyJpw5QW' }, { type: 2, - label: `${ctx.idioma.labels.invite}`, + label: `${ctx.idioma.mention.labels.invite}`, style: 5, url: 'https://discord.com/oauth2/authorize?client_id=' + global.zuly.user.id + '&scope=bot%20applications.commands&permissions=268823622' }, { type: 2, - label: `${ctx.idioma.labels.website}`, + label: `${ctx.idioma.mention.labels.website}`, style: 5, url: 'https://zulybot.xyz/' } diff --git a/src/Commands/Info/HelpCommand.js b/src/Commands/Info/HelpCommand.js index fcd07ad3..a1de3598 100644 --- a/src/Commands/Info/HelpCommand.js +++ b/src/Commands/Info/HelpCommand.js @@ -94,19 +94,19 @@ module.exports = class Ajuda { components: [ { type: 2, - label: `${ctx.idioma.labels.support}`, + label: `${ctx.idioma.mention.labels.support}`, style: 5, url: 'https://discord.gg/pyyyJpw5QW' }, { type: 2, - label: `${ctx.idioma.labels.invite}`, + label: `${ctx.idioma.mention.labels.invite}`, style: 5, url: 'https://discord.com/oauth2/authorize?client_id=' + global.zuly.user.id + '&scope=bot%20applications.commands&permissions=268823622' }, { type: 2, - label: `${ctx.idioma.labels.website}`, + label: `${ctx.idioma.mention.labels.website}`, style: 5, url: 'https://zulybot.xyz/' } @@ -152,19 +152,19 @@ module.exports = class Ajuda { components: [ { type: 2, - label: `${ctx.idioma.labels.support}`, + label: `${ctx.idioma.mention.labels.support}`, style: 5, url: 'https://discord.gg/pyyyJpw5QW' }, { type: 2, - label: `${ctx.idioma.labels.invite}`, + label: `${ctx.idioma.mention.labels.invite}`, style: 5, url: 'https://discord.com/oauth2/authorize?client_id=' + global.zuly.user.id + '&scope=bot%20applications.commands&permissions=268823622' }, { type: 2, - label: `${ctx.idioma.labels.website}`, + label: `${ctx.idioma.mention.labels.website}`, style: 5, url: 'https://zulybot.xyz/' } @@ -197,19 +197,19 @@ module.exports = class Ajuda { components: [ { type: 2, - label: `${ctx.idioma.labels.support}`, + label: `${ctx.idioma.mention.labels.support}`, style: 5, url: 'https://discord.gg/pyyyJpw5QW' }, { type: 2, - label: `${ctx.idioma.labels.invite}`, + label: `${ctx.idioma.mention.labels.invite}`, style: 5, url: 'https://discord.com/oauth2/authorize?client_id=' + global.zuly.user.id + '&scope=bot%20applications.commands&permissions=268823622' }, { type: 2, - label: `${ctx.idioma.labels.website}`, + label: `${ctx.idioma.mention.labels.website}`, style: 5, url: 'https://zulybot.xyz/' } @@ -255,19 +255,19 @@ module.exports = class Ajuda { components: [ { type: 2, - label: `${ctx.idioma.labels.support}`, + label: `${ctx.idioma.mention.labels.support}`, style: 5, url: 'https://discord.gg/pyyyJpw5QW' }, { type: 2, - label: `${ctx.idioma.labels.invite}`, + label: `${ctx.idioma.mention.labels.invite}`, style: 5, url: 'https://discord.com/oauth2/authorize?client_id=' + global.zuly.user.id + '&scope=bot%20applications.commands&permissions=268823622' }, { type: 2, - label: `${ctx.idioma.labels.website}`, + label: `${ctx.idioma.mention.labels.website}`, style: 5, url: 'https://zulybot.xyz/' } @@ -334,19 +334,19 @@ module.exports = class Ajuda { components: [ { type: 2, - label: `${ctx.idioma.labels.support}`, + label: `${ctx.idioma.mention.labels.support}`, style: 5, url: 'https://discord.gg/pyyyJpw5QW' }, { type: 2, - label: `${ctx.idioma.labels.invite}`, + label: `${ctx.idioma.mention.labels.invite}`, style: 5, url: 'https://discord.com/oauth2/authorize?client_id=' + global.zuly.user.id + '&scope=bot%20applications.commands&permissions=268823622' }, { type: 2, - label: `${ctx.idioma.labels.website}`, + label: `${ctx.idioma.mention.labels.website}`, style: 5, url: 'https://zulybot.xyz/' } diff --git a/src/Events/interactionCreate.js b/src/Events/interactionCreate.js index aebee888..48647d16 100644 --- a/src/Events/interactionCreate.js +++ b/src/Events/interactionCreate.js @@ -10,6 +10,12 @@ module.exports = class InteractionEvent { const { WebhookClient } = require('discord.js'); if (!interaction.isCommand()) return; await interaction.deferReply(); + if (!interaction.guild) { + return interaction.editReply({ + content: ':x: **|** Slash commands cannot be used via direct message.', + ephemeral: true + }); + }; const blacklist = await global.zuly.db.get(`botban-${interaction.member.user.id}`); if (blacklist) { const msg = interaction; diff --git a/src/Events/messageCreate.js b/src/Events/messageCreate.js index 71d653fc..f4385501 100644 --- a/src/Events/messageCreate.js +++ b/src/Events/messageCreate.js @@ -8,11 +8,9 @@ module.exports = class MessageCreateEvent { async run (message) { const config = require('../Config/config.js'); - if (!message.guild.id) { - return message.reply({ - content: `:x:` - }); - }; + if (message.author.bot) return; + if (!message.guild) return; + let idioma = require('../Config/idiomas'); let lang = await global.zuly.db.get(`idioma-${message.guild.id}`) || 'pt_br'; lang = lang.replace(/-/g, '_'); @@ -44,16 +42,14 @@ module.exports = class MessageCreateEvent { const mensagens = await global.zuly.db.get(`messages-${message.guild.id}-${message.author.id}`); await global.zuly.db.set(`messages-${message.guild.id}-${message.author.id}`, mensagens ? mensagens + 1 : 1); - if (message.author.bot) return; - if (message.content === `<@${global.zuly.user.id}>` || message.content === `<@!${global.zuly.user.id}>`) { const embed = new global.zuly.manager.Ebl(); embed.setAuthor(global.zuly.user.username, '', global.zuly.user.displayAvatarURL({ dynamic: true, format: 'png', size: 4096 })); - embed.setDescription(`👋 ${idioma.hello.replace('%user', message.author)}\n> <:zu_info:911303533859590144> ${idioma.about}\n> <:zu_slash:886681118470987967> ${idioma.help}`); + embed.setDescription(`👋 ${idioma.mention.hello.replace('%user', message.author)}\n> <:zu_info:911303533859590144> ${idioma.mention.about}\n> <:zu_slash:886681118470987967> ${idioma.mention.help}`); embed.setColor('#ffcbdb'); embed.setFooter('⤷ zulybot.xyz', global.zuly.user.displayAvatarURL({ dynamic: true, format: 'png', size: 4096 })); message.channel.send({ - content: message.author, + content: message.author.mention, embeds: [embed.get()], components: [ { @@ -61,19 +57,19 @@ module.exports = class MessageCreateEvent { components: [ { type: 2, - label: `${idioma.labels.support}`, + label: `${idioma.mention.labels.support}`, style: 5, url: 'https://discord.gg/pyyyJpw5QW' }, { type: 2, - label: `${idioma.labels.invite}`, + label: `${idioma.mention.labels.invite}`, style: 5, url: 'https://discord.com/oauth2/authorize?client_id=' + global.zuly.user.id + '&scope=bot%20applications.commands&permissions=268823622' }, { type: 2, - label: `${idioma.labels.website}`, + label: `${idioma.mention.labels.website}`, style: 5, url: 'https://zulybot.xyz/' } @@ -100,7 +96,7 @@ module.exports = class MessageCreateEvent { embed.setThumbnail(global.zuly.user.displayAvatarURL({ dynamic: true, format: 'png', size: 4096 })); embed.setFooter('⤷ zulybot.xyz', global.zuly.user.displayAvatarURL({ dynamic: true, format: 'png', size: 4096 })); message.channel.send({ - content: message.author, + content: message.author.mention, embeds: [embed.get()] }); } diff --git a/src/Events/ready.js b/src/Events/ready.js index 6a1e68db..9d7aaff1 100644 --- a/src/Events/ready.js +++ b/src/Events/ready.js @@ -14,20 +14,19 @@ module.exports = class ReadyEvent { game: global.zuly.user.username, type: 5 }); - const { - version - } = require('../../package.json'); + const adg = await global.zuly.users.fetch('726449359167684734'); - const status = [`zulybot.xyz | ${global.zuly.user.username} [v${version}]`, `I'm on ${global.zuly.guilds.cache.size} servers | ${global.zuly.user.username} [v${version}]`, `Follow me on twitter @ZulyBot | ${global.zuly.user.username} [v${version}]`, `/help | ${global.zuly.user.username} [v${version}]`, `/upvote | ${global.zuly.user.username} [v${version}]`, `/invite | ${global.zuly.user.username} [v${version}]`, `Join in my support server discord.gg/pyyyJpw5QW | ${global.zuly.user.username} [v${version}]`, `I was created by: ${adg.username}#${adg.discriminator}`]; + const status = [`zulybot.xyz | ${global.zuly.user.username} [v${global.zuly.version}]`, `I'm on ${global.zuly.guilds.cache.size} servers | ${global.zuly.user.username} [v$global.zuly.version]`, `Follow me on twitter @ZulyBot | ${global.zuly.user.username} [v$global.zuly.version]`, `/help | ${global.zuly.user.username} [v$global.zuly.version]`, `/upvote | ${global.zuly.user.username} [v$global.zuly.version]`, `/invite | ${global.zuly.user.username} [v$global.zuly.version]`, `Join in my support server discord.gg/pyyyJpw5QW | ${global.zuly.user.username} [v$global.zuly.version]`, `I was created by: ${adg.username}#${adg.discriminator}`]; const presence = ['online', 'idle', 'dnd']; + setInterval(async () => { global.zuly.user.setStatus(presence[Math.floor(Math.random() * presence.length)]); global.zuly.user.setActivity(status[Math.floor(Math.random() * status.length)], { - game: global.zuly.user.username, - name: status[Math.floor(Math.random() * status.length)], + game: status[Math.floor(Math.random() * status.length)], type: 5 }); }, 1000 * 180); + require('../Integrations/app'); } }; diff --git a/src/ZulyUtilLoader.js b/src/ZulyUtilLoader.js deleted file mode 100644 index 3d0bf360..00000000 --- a/src/ZulyUtilLoader.js +++ /dev/null @@ -1,5 +0,0 @@ -require('./Client/Handler/eventos'); -require('./Database/DatabaseConnect'); -require('./Utils/ZulyFunctions'); -// Containers -require('./Containers/Premium/bot'); diff --git a/src/db/giveaways.json b/src/db/giveaways.json deleted file mode 100644 index b1cf1aca..00000000 --- a/src/db/giveaways.json +++ /dev/null @@ -1 +0,0 @@ -[{"messageId":"953322298826448946","channelId":"880407547562061824","guildId":"880174783294214184","startAt":1647360149626,"endAt":1647446549626,"ended":true,"winnerCount":1,"prize":"test","messages":{"giveaway":"🎉🎉 **GIVEAWAY** 🎉🎉","giveawayEnded":"🎉🎉 **GIVEAWAY ENDED** 🎉🎉","inviteToParticipate":"Reaja com 🎁 para participar!","winMessage":"🎁 Parabéns, {winners}! Você ganhou **{prize}**!\n{messageURL}","drawing":"Drawing: {timestamp}","dropMessage":"Be the first to react with 🎉 !","embedFooter":"{this.winnerCount} winner(s)","noWinner":"Sorteio cancelado, sem participações válidas","winners":"ganhador(es)","endedAt":"Terminou ás","hostedBy":"Sorteio de: {user}","timeRemaining":"Tempo Restante: **{duration}**","units":{"seconds":"segundos","minutes":"minutos","hours":"horas","days":"dias"}}},{"messageId":"953323174085402626","channelId":"880407547562061824","guildId":"880174783294214184","startAt":1647360358423,"endAt":1647360368423,"ended":true,"winnerCount":1,"prize":"test","messages":{"giveaway":"🎉🎉 **GIVEAWAY** 🎉🎉","giveawayEnded":"🎉🎉 **GIVEAWAY ENDED** 🎉🎉","inviteToParticipate":"Reaja com 🎁 para participar!","winMessage":"🎁 Parabéns, {winners}! Você ganhou **{prize}**!\n{messageURL}","drawing":"Tempo Restante: **{drawing}**","dropMessage":"Be the first to react with 🎉 !","embedFooter":"{this.winnerCount} winner(s)","noWinner":"Sorteio cancelado, sem participações válidas","winners":"ganhador(es)","endedAt":"Terminou ás","hostedBy":"Sorteio de: {user}","units":{"seconds":"segundos","minutes":"minutos","hours":"horas","days":"dias"}},"winnerIds":["717766639260532826"]},{"messageId":"953323703893102653","channelId":"880407547562061824","guildId":"880174783294214184","startAt":1647360484724,"endAt":1647360514724,"ended":true,"winnerCount":1,"prize":"Olá!","messages":{"giveaway":"🎉🎉 **GIVEAWAY** 🎉🎉","giveawayEnded":"🎉🎉 **GIVEAWAY ENDED** 🎉🎉","inviteToParticipate":"Reaja com 🎁 para participar!","winMessage":"🎁 Parabéns, {winners}! Você ganhou **{this.prize}**!\n{this.messageURL}","drawing":"Tempo Restante: **{timestamp}**","dropMessage":"Be the first to react with 🎉 !","embedFooter":"{this.winnerCount} winner(s)","noWinner":"Sorteio cancelado, sem participações válidas","winners":"ganhador(es)","endedAt":"Terminou ás","hostedBy":"Sorteio de: {user}","units":{"seconds":"segundos","minutes":"minutos","hours":"horas","days":"dias"}},"winnerIds":["717766639260532826"]},{"messageId":"953414606762684437","channelId":"889930854929932288","guildId":"886680394710274169","startAt":1647382157548,"endAt":1647382187548,"ended":true,"winnerCount":1,"prize":"teste foda","messages":{"giveaway":"🎉🎉 **GIVEAWAY** 🎉🎉","giveawayEnded":"🎉🎉 **GIVEAWAY ENDED** 🎉🎉","inviteToParticipate":"Reaja com 🎁 para participar!","winMessage":"🎁 Parabéns, {winners}! Você ganhou **{this.prize}**!\n{this.messageURL}","drawing":"Tempo Restante: **{timestamp}**","dropMessage":"Be the first to react with 🎉 !","embedFooter":"{this.winnerCount} winner(s)","noWinner":"Sorteio cancelado, sem participações válidas","winners":"ganhador(es)","endedAt":"Terminou ás","hostedBy":"Sorteio de: {user}","units":{"seconds":"segundos","minutes":"minutos","hours":"horas","days":"dias"}},"winnerIds":["717766639260532826"]},{"messageId":"953722032246358046","channelId":"890296909871341569","guildId":"886680394710274169","startAt":1647455451621,"endAt":1647455461621,"ended":true,"winnerCount":1,"prize":"teste","messages":{"giveaway":"🎉🎉 **GIVEAWAY** 🎉🎉","giveawayEnded":"🎉🎉 **GIVEAWAY ENDED** 🎉🎉","inviteToParticipate":"Reaja com 🎁 para participar!","winMessage":"🎁 Parabéns, {winners}! Você ganhou **{this.prize}**!\n{this.messageURL}","drawing":"Tempo Restante: **{timestamp}**","dropMessage":"Be the first to react with 🎉 !","embedFooter":"{this.winnerCount} winner(s)","noWinner":"Sorteio cancelado, sem participações válidas","winners":"ganhador(es)","endedAt":"Terminou ás","hostedBy":"Sorteio de: {user}","units":{"seconds":"segundos","minutes":"minutos","hours":"horas","days":"dias"}},"winnerIds":["717766639260532826"]},{"messageId":"953732745253773322","channelId":"890296909871341569","guildId":"886680394710274169","startAt":1647458005792,"endAt":1647458015792,"ended":true,"winnerCount":1,"prize":"teste","messages":{"giveaway":"🎉🎉 **GIVEAWAY** 🎉🎉","giveawayEnded":"🎉🎉 **GIVEAWAY ENDED** 🎉🎉","inviteToParticipate":"Reaja com 🎁 para participar!","winMessage":"🎁 Parabéns, {winners}! Você ganhou **{this.prize}**!\n{this.messageURL}","drawing":"Tempo Restante: **{timestamp}**","dropMessage":"Be the first to react with 🎉 !","embedFooter":"{this.winnerCount} winner(s)","noWinner":"Sorteio cancelado, sem participações válidas","winners":"ganhador(es)","endedAt":"Terminou ás","hostedBy":"Sorteio de: {user}","units":{"seconds":"segundos","minutes":"minutos","hours":"horas","days":"dias"}},"winnerIds":["717766639260532826"]}] \ No newline at end of file diff --git a/src/zuly.js b/src/zuly.js index 278c70f4..21f1ae93 100644 --- a/src/zuly.js +++ b/src/zuly.js @@ -30,17 +30,6 @@ const client = new Client({ ] }); -client.giveawaysManager = new GiveawaysManager(client, { - storage: './src/db/giveaways.json', - updateCountdownEvery: 5000, - default: { - botsCanWin: false, - embedColor: '#FFCBDB', - embedColorEnd: '#FFCBDB', - reaction: '🎁' - } -}); - // Games client.snakecord = new SnakeGame({ title: 'SnakeCord | Zuly', @@ -48,10 +37,22 @@ client.snakecord = new SnakeGame({ timestamp: false, gameOverTitle: 'Fim do Jogo', }); + // Plugins client.restAPI = new REST({ version: '9' }).setToken(token); client.routes = require('discord-api-types/v9').Routes; client.backup = require('discord-backup'); +client.version = require('../package.json').version; +client.giveawaysManager = new GiveawaysManager(client, { + storage: './JSON/giveaways.json', + updateCountdownEvery: 5000, + default: { + botsCanWin: false, + embedColor: '#FFCBDB', + embedColorEnd: '#FFCBDB', + reaction: '🎁' + } +}); // Collections client.commands = new Collection(); client.events = new Collection(); @@ -71,4 +72,7 @@ client.topgg = new AutoPoster(top.gg.token, client).on('posted', () => { global.zuly = client; global.zuly.manager = ZulyBot; -require('./ZulyUtilLoader'); \ No newline at end of file +require('./Client/Handler/eventos'); +require('./Database/DatabaseConnect'); +require('./Utils/ZulyFunctions'); +require('./Containers/Premium/bot'); \ No newline at end of file