diff --git a/.idea/jsLibraryMappings.xml b/.idea/jsLibraryMappings.xml new file mode 100644 index 00000000..d23208fb --- /dev/null +++ b/.idea/jsLibraryMappings.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/assets/images/badges/bughunter.png b/assets/images/badges/bughunter.png new file mode 100644 index 00000000..58c3b341 Binary files /dev/null and b/assets/images/badges/bughunter.png differ diff --git a/package.json b/package.json index f2342207..43b91c7c 100644 --- a/package.json +++ b/package.json @@ -46,6 +46,7 @@ "deepai": "^1.0.17", "erela.js": "^2.3.3", "eris": "0.16.1", + "eris-collector": "^1.0.1", "express": "^4.17.1", "humanize-duration": "^3.27.0", "math-expression-evaluator": "^1.3.8", diff --git a/src/Commands/Config/AutoroleCommand.js b/src/Commands/Config/AutoroleCommand.js index b4caf1f3..f944df41 100644 --- a/src/Commands/Config/AutoroleCommand.js +++ b/src/Commands/Config/AutoroleCommand.js @@ -4,7 +4,7 @@ module.exports = class AutoroleCommand { constructor () { return { permissoes: { - membro: ['manageGuild'], + membro: ['manageGuild', 'manageRoles'], bot: ['manageRoles', 'useExternalEmojis', 'addReactions', 'manageMessages'] }, pt: { diff --git a/src/Commands/Config/ReactionRole.js b/src/Commands/Config/ReactionRole.js index 0afec0fd..c46d354c 100644 --- a/src/Commands/Config/ReactionRole.js +++ b/src/Commands/Config/ReactionRole.js @@ -2,8 +2,8 @@ module.exports = class ReactionRoleCommand { constructor () { return { permissoes: { - membro: ['manageGuild'], - bot: [] + membro: ['manageGuild', 'manageRoles'], + bot: ['manageRoles', 'useExternalEmojis', 'addReactions'] }, pt: { nome: 'reactionrole', diff --git a/src/Commands/Economy/ProfileCommand.js b/src/Commands/Economy/ProfileCommand.js index b0d03da2..b6f0a8f4 100644 --- a/src/Commands/Economy/ProfileCommand.js +++ b/src/Commands/Economy/ProfileCommand.js @@ -58,11 +58,23 @@ module.exports = class EvalCommand { foto.drawImage(background, 0, 0, canvas.width, canvas.height); const userPremium = await global.zuly.getPremium('doador', user.id); + const bugHunter = await global.zuly.getBugHunter(user.id); - if (userPremium) { + if (bugHunter && userPremium) { + const bug = await loadImage('./assets/images/badges/bughunter.png'); const early = await loadImage('./assets/images/badges/earlysupport.png'); - foto.drawImage(early, 650, 60, 50, 45); + foto.drawImage(early, 650, 60, 60, 45); + foto.drawImage(bug, 700, 60, 60, 45); } + else if (bugHunter) { + const early = await loadImage('./assets/images/badges/bughunter.png'); + foto.drawImage(early, 650, 60, 60, 45); + } + else if (userPremium) { + const early = await loadImage('./assets/images/badges/earlysupport.png'); + foto.drawImage(early, 650, 60, 60, 45); + } + if (user.username.length > 9) { foto.font = '17px Dunkin'; } diff --git a/src/Commands/Fun/GuessTheNumberCommand.js b/src/Commands/Fun/GuessTheNumberCommand.js new file mode 100644 index 00000000..c98361a0 --- /dev/null +++ b/src/Commands/Fun/GuessTheNumberCommand.js @@ -0,0 +1,129 @@ +module.exports = class Nitro { + constructor () { + return { + permissoes: { + membro: ['manageEvents'], + bot: [], + dono: false + }, + pt: { + nome: 'guess', + categoria: '⭐ » Diversão', + desc: 'Adivinhe o número é um jogo educacional divertido.' + }, + en: { + nome: 'guess', + categoria: '⭐ » Fun', + desc: 'Guess the Number is a fun educational game.' + }, + /* + SUB_COMMAND 1 = SubCommand + SUB_COMMAND_GROUP: 2 = SubCommandGroup + STRING: 3 = String + INTEGER: 4 = Any integer between -2^53 and 2^53 + BOOLEAN: 5 = True or False + USER: 6 = User Mention + CHANNEL: 7 = Includes all channel types + categories + ROLE: 8 = Role Mention + MENTIONABLE: 9 = Includes users and roles + NUMBER: 10 = Any double between -2^53 and 2^53 + */ + options: [ + { + type: 3, + name: 'min', + description: 'The minimum number.', + required: false, + }, + { + type: 3, + name: 'max', + description: 'The maximum number.', + required: false, + } + ], + aliases: [], + run: this.run + }; + } + + async run (ctx) { + if (!ctx.args[0] && !ctx.args[1] || isNaN(ctx.args[0]) && isNaN(ctx.args[1])) { + const number = Math.floor(Math.random() * 1500) + 500; + console.log(number); + ctx.message.channel.slashReply({ + content: `⏰ ${ctx.message.author.mention} **|** ${ctx.idioma.guess.start.replace('%min', 500).replace('%max', 1500)}` + }); + setTimeout(() => { + ctx.message.channel.createMessage({ + content: `✅ ${ctx.message.author.mention} **|** ${ctx.idioma.guess.started}` + }).then(async msg => { + const dm = await ctx.message.author.getDMChannel(); + dm.createMessage({ + content: `👀 ${ctx.message.author.mention} **|** ${ctx.idioma.guess.number.replace('%num', number)}` + }).catch(() => { + ctx.message.createFollowup({ + content: `👀 ${ctx.message.author.mention} **|** ${ctx.idioma.guess.number.replace('%num', number)}`, + flags: ctx.ephemeral + }); + }); + const { MessageCollector } = require('eris-collector'); + const collector = new MessageCollector(global.zuly, msg.channel, (m) => m.content === `${number}`, { + time: 300000 + }); + collector.on('collect', async msg => { + ctx.message.channel.createMessage({ + content: `✅ ${msg.author.mention} **|** ${ctx.idioma.guess.win.replace('%num', number)}`, + messageReference: { + channelID: msg.channel.id, + guildID: msg.channel.guild.id, + messageID: msg.id + } + }).then(() => { + collector.stop(); + }); + }); + }); + }, 5000); + } + else { + const number = Math.floor(Math.random() * Number(ctx.args[1])) + Number(ctx.args[0]); + console.log(number); + ctx.message.channel.slashReply({ + content: `⏰ ${ctx.message.author.mention} **|** ${ctx.idioma.guess.start.replace('%min', Number(ctx.args[0])).replace('%max', Number(ctx.args[1]))}` + }); + setTimeout(() => { + ctx.message.channel.createMessage({ + content: `✅ ${ctx.message.author.mention} **|** ${ctx.idioma.guess.started}` + }).then(async msg => { + const dm = await ctx.message.author.getDMChannel(); + dm.createMessage({ + content: `👀 ${ctx.message.author.mention} **|** ${ctx.idioma.guess.number.replace('%num', number)}` + }).catch(() => { + ctx.message.createFollowup({ + content: `👀 ${ctx.message.author.mention} **|** ${ctx.idioma.guess.number.replace('%num', number)}`, + flags: ctx.ephemeral + }); + }); + const { MessageCollector } = require('eris-collector'); + const collector = new MessageCollector(global.zuly, msg.channel, (m) => m.content === `${number}`, { + time: 300000 + }); + collector.on('collect', async msg => { + ctx.message.channel.createMessage({ + content: `✅ ${msg.author.mention} **|** ${ctx.idioma.guess.win.replace('%num', number)}`, + messageReference: { + channelID: msg.channel.id, + guildID: msg.channel.guild.id, + messageID: msg.id + } + }).then(() => { + collector.stop(); + }); + }); + }); + }, 5000); + } + } +}; +// 𝖽 \ No newline at end of file diff --git a/src/Commands/Info/BotinfoCommand.js b/src/Commands/Info/BotinfoCommand.js index ef88632c..f3e84157 100644 --- a/src/Commands/Info/BotinfoCommand.js +++ b/src/Commands/Info/BotinfoCommand.js @@ -63,6 +63,31 @@ module.exports = class BotinfoCommand { ctx.message.channel.slashReply({ content: ctx.message.author.mention, embeds: [embed.get()], + components: [ + { + type: 1, + components: [ + { + type: 2, + label: `${ctx.idioma.mention.labels.support}`, + style: 5, + url: 'https://discord.gg/pyyyJpw5QW' + }, + { + type: 2, + 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.mention.labels.website}`, + style: 5, + url: 'https://zulybot.xyz/' + } + ] + } + ] }); }); } diff --git a/src/Commands/Info/HelpCommand.js b/src/Commands/Info/HelpCommand.js index 97451e7c..a64e0b7d 100644 --- a/src/Commands/Info/HelpCommand.js +++ b/src/Commands/Info/HelpCommand.js @@ -83,6 +83,31 @@ module.exports = class Ajuda { return ctx.message.channel.slashReply({ content: ctx.message.author.mention, embeds: [help.get()], + components: [ + { + type: 1, + components: [ + { + type: 2, + label: `${ctx.idioma.mention.labels.support}`, + style: 5, + url: 'https://discord.gg/pyyyJpw5QW' + }, + { + type: 2, + 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.mention.labels.website}`, + style: 5, + url: 'https://zulybot.xyz/' + } + ] + } + ], flags: ctx.ephemeral }); } @@ -116,6 +141,31 @@ module.exports = class Ajuda { ctx.message.channel.slashReply({ content: ctx.message.author.mention, embeds: [embed.get()], + components: [ + { + type: 1, + components: [ + { + type: 2, + label: `${ctx.idioma.mention.labels.support}`, + style: 5, + url: 'https://discord.gg/pyyyJpw5QW' + }, + { + type: 2, + 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.mention.labels.website}`, + style: 5, + url: 'https://zulybot.xyz/' + } + ] + } + ], flags: ctx.ephemeral }); @@ -172,6 +222,31 @@ module.exports = class Ajuda { ctx.message.channel.slashReply({ content: ctx.message.author.mention, embeds: [embed.get()], + components: [ + { + type: 1, + components: [ + { + type: 2, + label: `${ctx.idioma.mention.labels.support}`, + style: 5, + url: 'https://discord.gg/pyyyJpw5QW' + }, + { + type: 2, + 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.mention.labels.website}`, + style: 5, + url: 'https://zulybot.xyz/' + } + ] + } + ], flags: ctx.ephemeral }); break; diff --git a/src/Commands/Info/PingCommand.js b/src/Commands/Info/PingCommand.js index 26473723..14dc47df 100644 --- a/src/Commands/Info/PingCommand.js +++ b/src/Commands/Info/PingCommand.js @@ -40,8 +40,26 @@ module.exports = class PingCommand { const pingDB = new Promise((r) => mongoose.connection.db.admin().ping(() => r(Date.now() - date)) ); + const { Constants } = require('eris'); return ctx.message.channel.slashReply({ - content: `🏓 **|** ${ctx.message.author.mention} Pong!\n- **API Ping:** \`${global.zuly.shards.random().latency}ms\`\n- **Database:** \`${await pingDB}ms\`` + content: `🏓 **|** ${ctx.message.author.mention} Pong!\n- **API Ping:** \`${global.zuly.shards.random().latency}ms\`\n- **Database:** \`${await pingDB}ms\``, + components: [ + { + type: Constants.ComponentTypes.ACTION_ROW, + components: [ + { + type: Constants.ComponentTypes.BUTTON, + style: Constants.ButtonStyles.PRIMARY, + custom_id: 'ping', + label: ctx.idioma.labels.recalc, + emoji: { + name: '🔁' + }, + disabled: false + } + ] + } + ] }); } }; diff --git a/src/Commands/Utils/UserinfoCommand.js b/src/Commands/Utils/UserinfoCommand.js index d9aa434c..500f4cf2 100644 --- a/src/Commands/Utils/UserinfoCommand.js +++ b/src/Commands/Utils/UserinfoCommand.js @@ -75,7 +75,6 @@ module.exports = class CalcCommand { return badges; } - const user = ctx.args[0] ? ctx.message.mentions[1] || await global.zuly.getRESTUser(ctx.args[0]).catch(() => ctx.message.author) : ctx.message.author; const badges = getUserBadges(user); const embed = new ctx.embed(); diff --git a/src/Commands/Waifu/WaifuCommand.js b/src/Commands/Waifu/WaifuCommand.js index d093b908..f7282244 100644 --- a/src/Commands/Waifu/WaifuCommand.js +++ b/src/Commands/Waifu/WaifuCommand.js @@ -67,7 +67,6 @@ module.exports = class EvalCommand { content: ctx.message.author.mention, embeds: [embed.get()] }).then(async message => { - console.log(message); if (!dono) { const MarryCollector = new ReactionCollector(message, { user: ctx.message.author, diff --git a/src/Events/interactionCreate.js b/src/Events/interactionCreate.js index 5318828d..c710f475 100644 --- a/src/Events/interactionCreate.js +++ b/src/Events/interactionCreate.js @@ -6,167 +6,180 @@ module.exports = class InteractionEvent { }; } async run (interaction) { - try { - // const Eris = require('eris'); - const command = global.zuly.commands.get(interaction.data.name); - - interaction.mentions = []; - interaction.mentions[0] = global.zuly.user; - interaction.mention_everyone = false; - if (interaction.data && interaction.data.resolved && interaction.data.resolved.roles) { - interaction.mention_roles = interaction.data.resolved.roles; + const Eris = require('eris'); + if(interaction instanceof Eris.ComponentInteraction) { + interaction.author = interaction.member.user; + if (interaction.data.custom_id === 'ping') { + interaction.deferUpdate(); + const mongoose = require('mongoose'); + const date = Date.now(); + const pingDB = new Promise((r) => + mongoose.connection.db.admin().ping(() => r(Date.now() - date)) + ); + interaction.message.edit({ + content: `🏓 **|** ${interaction.author.mention} Pong!\n- **API Ping:** \`${global.zuly.shards.random().latency}ms\`\n- **Database:** \`${await pingDB}ms\``, + }); } - if (interaction.data && interaction.data.resolved && interaction.data.resolved.users) { - for (const membro in interaction.data.resolved.users) { - interaction.data.resolved.users[membro].member = - interaction.data.resolved.members[membro]; - interaction.mentions.push(interaction.data.resolved.users[membro]); + } + if (interaction instanceof Eris.CommandInteraction) { + try { + const command = global.zuly.commands.get(interaction.data.name); + interaction.mentions = []; + interaction.mentions[0] = global.zuly.user; + interaction.mention_everyone = false; + if (interaction.data && interaction.data.resolved && interaction.data.resolved.roles) { + interaction.mention_roles = interaction.data.resolved.roles; } - } - const args = interaction.data.options - ? interaction.data.options.map((i) => { - switch (i.type) { - case 8: - return `<@&${i.value}>`; - case 6: - return `<@!${i.value}>`; - case 7: - return `<#${i.value}>`; - default: - return i.value; + if (interaction.data && interaction.data.resolved && interaction.data.resolved.users) { + for (const membro in interaction.data.resolved.users) { + console.log(interaction.data.resolved.users); + interaction.data.resolved.users[membro.user.id].member = interaction.data.resolved.members[membro.user.id]; + interaction.mentions.push(interaction.data.resolved.users[membro.user.id]); } - }) - : []; - interaction.content = (interaction.data.name + ' ' + args.join(' ')).trim(); - interaction.author = interaction.member.user; - - const msg = interaction; - - let idioma = require('../Config/idiomas.js'); - let lang = await global.db.get(`idioma-${msg.guildID}`) || 'pt_br'; - lang = lang.replace(/-/g, '_'); - idioma = idioma[lang]; + } + const args = interaction.data.options + ? interaction.data.options.map((i) => { + switch (i.type) { + case 8: + return `<@&${i.value}>`; + case 6: + return `<@!${i.value}>`; + case 7: + return `<#${i.value}>`; + default: + return i.value; + } + }) + : []; + interaction.content = (interaction.data.name + ' ' + args.join(' ')).trim(); + interaction.author = interaction.member.user; + const msg = interaction; + let idioma = require('../Config/idiomas.js'); + let lang = await global.db.get(`idioma-${msg.guildID}`) || 'pt_br'; + lang = lang.replace(/-/g, '_'); + idioma = idioma[lang]; - const prefix = await global.db.get(`prefix-${msg.channel.guild.id}`) ? global.db.get(`prefix-${msg.channel.guild.id}`) : '/'; + const prefix = await global.db.get(`prefix-${msg.channel.guild.id}`) ? global.db.get(`prefix-${msg.channel.guild.id}`) : '/'; - msg.channel.slashReply = interaction.createMessage.bind(interaction); + msg.channel.slashReply = interaction.createMessage.bind(interaction); - if (command.permissoes) { - if (command.permissoes.membro.length) { - if (!command.permissoes.membro.every(p => msg.channel.guild.members.get(msg.author.id).permissions.has(p))) { - return msg.channel.slashReply({ - content: `:x: ${msg.author.mention} **|** ${idioma.message.user} \`${command.permissoes.membro}\`.`, - flags: 64 - }); + if (command.permissoes) { + if (command.permissoes.membro.length) { + if (!command.permissoes.membro.every(p => msg.channel.guild.members.get(msg.author.id).permissions.has(p))) { + return msg.channel.slashReply({ + content: `:x: ${msg.author.mention} **|** ${idioma.message.user} \`${command.permissoes.membro}\`.`, + flags: 64 + }); + } } - } - if (command.permissoes.bot.length) { - if (!command.permissoes.bot.every(p => msg.channel.guild.members.get(global.zuly.user.id).permissions.has(p))) { - return msg.channel.slashReply({ - content: `:x: ${msg.author.mention} **|** ${idioma.message.bot} \`${command.permissoes.bot}\`.`, - flags: 64 - }); + if (command.permissoes.bot.length) { + if (!command.permissoes.bot.every(p => msg.channel.guild.members.get(global.zuly.user.id).permissions.has(p))) { + return msg.channel.slashReply({ + content: `:x: ${msg.author.mention} **|** ${idioma.message.bot} \`${command.permissoes.bot}\`.`, + flags: 64 + }); + } } - } - if (command.permissoes.nsfw) { - if (!msg.channel.nsfw) { - return msg.channel.slashReply({ - content: `:x: ${msg.author.mention} **|** ${idioma.message.nsfw}`, - flags: 64 - }); - } - } - if (command.permissoes.dono) { - const developers = await global.db.get('devs'); - if (!developers) { - await global.db.set('devs', ['726449359167684734', '392087996821667841', '699416429338034268']); + if (command.permissoes.nsfw) { + if (!msg.channel.nsfw) { + return msg.channel.slashReply({ + content: `:x: ${msg.author.mention} **|** ${idioma.message.nsfw}`, + flags: 64 + }); + } } + if (command.permissoes.dono) { + const developers = await global.db.get('devs'); + if (!developers) { + await global.db.set('devs', ['726449359167684734', '392087996821667841', '699416429338034268']); + } - if (!developers.includes(msg.member.id)) { - return msg.channel.slashReply({ - content: `:x: ${msg.author.mention} **|** ${idioma.message.dev}.`, - flags: 64 - }); + if (!developers.includes(msg.member.id)) { + return msg.channel.slashReply({ + content: `:x: ${msg.author.mention} **|** ${idioma.message.dev}.`, + flags: 64 + }); + } } } - } - this.ctx = { - id: msg.id, - user: msg.author, - userTag: msg.author.tag, - userId: msg.author.id, - member: msg.member, - memberTag: msg.member.tag, - memberId: msg.member.id, - idioma: idioma, - prefix: prefix, - args: args, - message: msg, - ephemeral: 64, - embed: require('../Client/EmbedBuilder').Embed, - // Functions - send: function(texto) { - msg.channel.slashReply(...texto); - }, - reply: function(texto) { - msg.channel.slashReply(...texto); - }, - addReaction: function(emoji) { - msg.addReaction(emoji); - }, - fetch: async function(url) { - await global.zuly.manager.fetch(url); + this.ctx = { + id: msg.id, + user: msg.author, + userTag: msg.author.tag, + userId: msg.author.id, + member: msg.member, + memberTag: msg.member.tag, + memberId: msg.member.id, + idioma: idioma, + prefix: prefix, + args: args, + message: msg, + ephemeral: 64, + embed: require('../Client/EmbedBuilder').Embed, + // Functions + send: function(texto) { + msg.channel.slashReply(...texto); + }, + reply: function(texto) { + msg.channel.slashReply(...texto); + }, + addReaction: function(emoji) { + msg.addReaction(emoji); + }, + fetch: async function(url) { + await global.zuly.manager.fetch(url); + } + }; + try { + await command.run(this.ctx).then(async () => { + const moment = require('moment'); + const owner = await global.zuly.getRESTUser(msg.channel.guild.ownerID); + const embed = new global.zuly.manager.Ebl(); + embed.setTitle('<:zu_slash:886681118470987967> Slash Commands'); + embed.setColor('#ffcbdb'); + embed.setDescription(`>>> 🌎 **Servidor:** \`${msg.channel.guild.name}\`\n🧭 **ID:** \`${msg.channel.guild.id}\`\n👑 **Dono:** \`${owner.username}#${owner.discriminator} [${owner.id}]\`\n🔍 **Membros:** \`${msg.channel.guild.memberCount} members\`\n **Boosts:** \`${msg.channel.guild.premiumSubscriptionCount} boosts\`\n:calendar: **Criado em:** \`${moment(msg.channel.guild.createdAt).format('📆 DD/MM/YY')} | ${moment(msg.channel.guild.createdAt).format('⏰ HH:mm:ss')}\`\n🗺️ **Idioma:** \`${msg.channel.guild.preferredLocale}\`\n<:zu_slash:886681118470987967> **Comando:** \`${interaction.data.name}\`\n💻 **Argumentos:** \`${args.slice(0, 1024) || 'Não Tem'}\``); + embed.addField('<:zu_membros:885214377182109696> **Usuário:**', `>>> 📘 **Informações:** \`${msg.author.username}#${msg.author.discriminator} [${msg.author.id}]\`\n📆 **Criação da conta:** `); + embed.setThumbnail(global.zuly.user.avatarURL); + embed.setFooter('⤷ zulybot.xyz', global.zuly.user.avatarURL); + const canal = await global.zuly.getRESTChannel('886680915407962215'); + canal.createMessage({ + embeds: [embed.get()] + }); + }); } - }; - try { - await command.run(this.ctx).then(async () => { - const moment = require('moment'); - const owner = await global.zuly.getRESTUser(msg.channel.guild.ownerID); + catch (e) { + const errorMessage = e.stack.length > 1800 ? `${e.stack.slice(0, 1800)}...` : e.stack; const embed = new global.zuly.manager.Ebl(); - embed.setTitle('<:zu_slash:886681118470987967> Slash Commands'); - embed.setColor('#ffcbdb'); - embed.setDescription(`>>> 🌎 **Servidor:** \`${msg.channel.guild.name}\`\n🧭 **ID:** \`${msg.channel.guild.id}\`\n👑 **Dono:** \`${owner.username}#${owner.discriminator} [${owner.id}]\`\n🔍 **Membros:** \`${msg.channel.guild.memberCount} members\`\n **Boosts:** \`${msg.channel.guild.premiumSubscriptionCount} boosts\`\n:calendar: **Criado em:** \`${moment(msg.channel.guild.createdAt).format('📆 DD/MM/YY')} | ${moment(msg.channel.guild.createdAt).format('⏰ HH:mm:ss')}\`\n🗺️ **Idioma:** \`${msg.channel.guild.preferredLocale}\`\n<:zu_slash:886681118470987967> **Comando:** \`${interaction.data.name}\`\n💻 **Argumentos:** \`${args.slice(0, 1024) || 'Não Tem'}\``); - embed.addField('<:zu_membros:885214377182109696> **Usuário:**', `>>> 📘 **Informações:** \`${msg.author.username}#${msg.author.discriminator} [${msg.author.id}]\`\n📆 **Criação da conta:** `); + embed.setTitle(`<:zu_error:900785481283944500> ${idioma.message.e}`); + embed.setColor('#ff0000'); + embed.setDescription(`\`\`\`js\n${errorMessage}\`\`\``); + embed.addField(`<:zu_bughunter_1:885918998426951721> ${idioma.message.e2}`, idioma.message.e3); embed.setThumbnail(global.zuly.user.avatarURL); embed.setFooter('⤷ zulybot.xyz', global.zuly.user.avatarURL); - const canal = await global.zuly.getRESTChannel('886680915407962215'); - canal.createMessage({ + + msg.channel.slashReply({ + content: msg.author.mention, embeds: [embed.get()] }); - }); + const moment = require('moment'); + const owner = await global.zuly.getRESTUser(msg.channel.guild.ownerID); + const canal = await global.zuly.getRESTChannel('889930854929932288'); + const embed2 = new global.zuly.manager.Ebl(); + embed2.setTitle(`<:zu_error:900785481283944500> ${idioma.message.e}`); + embed2.setDescription(`\`\`\`js\n${errorMessage}\`\`\``); + embed2.addField('<:zu_bughunter_1:885918998426951721> Resolvam!', `>>> 🌎 **Servidor:** \`${msg.channel.guild.name}\`\n🧭 **ID:** \`${msg.channel.guild.id}\`\n👑 **Dono:** \`${owner.username}#${owner.discriminator} [${owner.id}]\`\n🔍 **Membros:** \`${msg.channel.guild.memberCount} members\`\n **Boosts:** \`${msg.channel.guild.premiumSubscriptionCount} boosts\`\n:calendar: **Criado em:** \`${moment(msg.channel.guild.createdAt).format('📆 DD/MM/YY')} | ${moment(msg.channel.guild.createdAt).format('⏰ HH:mm:ss')}\`\n🗺️ **Idioma:** \`${msg.channel.guild.preferredLocale}\`\n<:zu_slash:886681118470987967> **Comando:** \`${interaction.data.name}\``); + embed2.setColor('#ff0000'); + embed2.setThumbnail(global.zuly.user.avatarURL); + embed.setFooter('⤷ zulybot.xyz', global.zuly.user.avatarURL); + canal.createMessage({ + content: '<@&886680759237226556>', + embeds: [embed2.get()] + }); + } } catch (e) { - const errorMessage = e.stack.length > 1800 ? `${e.stack.slice(0, 1800)}...` : e.stack; - const embed = new global.zuly.manager.Ebl(); - embed.setTitle(`<:zu_error:900785481283944500> ${idioma.message.e}`); - embed.setColor('#ff0000'); - embed.setDescription(`\`\`\`js\n${errorMessage}\`\`\``); - embed.addField(`<:zu_bughunter_1:885918998426951721> ${idioma.message.e2}`, idioma.message.e3); - embed.setThumbnail(global.zuly.user.avatarURL); - embed.setFooter('⤷ zulybot.xyz', global.zuly.user.avatarURL); - - msg.channel.slashReply({ - content: msg.author.mention, - embeds: [embed.get()] - }); - const moment = require('moment'); - const owner = await global.zuly.getRESTUser(msg.channel.guild.ownerID); - const canal = await global.zuly.getRESTChannel('889930854929932288'); - const embed2 = new global.zuly.manager.Ebl(); - embed2.setTitle(`<:zu_error:900785481283944500> ${idioma.message.e}`); - embed2.setDescription(`\`\`\`js\n${errorMessage}\`\`\``); - embed2.addField('<:zu_bughunter_1:885918998426951721> Resolvam!', `>>> 🌎 **Servidor:** \`${msg.channel.guild.name}\`\n🧭 **ID:** \`${msg.channel.guild.id}\`\n👑 **Dono:** \`${owner.username}#${owner.discriminator} [${owner.id}]\`\n🔍 **Membros:** \`${msg.channel.guild.memberCount} members\`\n **Boosts:** \`${msg.channel.guild.premiumSubscriptionCount} boosts\`\n:calendar: **Criado em:** \`${moment(msg.channel.guild.createdAt).format('📆 DD/MM/YY')} | ${moment(msg.channel.guild.createdAt).format('⏰ HH:mm:ss')}\`\n🗺️ **Idioma:** \`${msg.channel.guild.preferredLocale}\`\n<:zu_slash:886681118470987967> **Comando:** \`${interaction.data.name}\``); - embed2.setColor('#ff0000'); - embed2.setThumbnail(global.zuly.user.avatarURL); - embed.setFooter('⤷ zulybot.xyz', global.zuly.user.avatarURL); - canal.createMessage({ - content: '<@&886680759237226556>', - embeds: [embed2.get()] - }); + console.log(e); } } - catch (e) { - console.log(e); - } } }; \ No newline at end of file diff --git a/src/Events/rawWS.js b/src/Events/rawWS.js new file mode 100644 index 00000000..6948e50b --- /dev/null +++ b/src/Events/rawWS.js @@ -0,0 +1,11 @@ +module.exports = class rawWS { + constructor () { + return { + nome: 'rawWS', + run: this.run + }; + } + async run (packet) { + global.zuly.music.updateVoiceState(packet); + } +}; \ No newline at end of file diff --git a/src/Helpers/MessageCollector.js b/src/Helpers/MessageCollector.js index 723478fc..9a3ac839 100644 --- a/src/Helpers/MessageCollector.js +++ b/src/Helpers/MessageCollector.js @@ -75,7 +75,7 @@ module.exports = class MessageCollector extends CollectorBase { if (this.options.ignoreBots) { if (message.author.bot) return; } - if (message.author.id !== this.options.user.id || message.channel.id !== this.options.channel.id) { + if (message.author.id !== this.options.user.idz || message.channel.id !== this.options.channel.id) { return null; } else if (this.options.rules) { diff --git a/src/Locales/en-US.js b/src/Locales/en-US.js index bfabbe5f..43dfa38f 100644 --- a/src/Locales/en-US.js +++ b/src/Locales/en-US.js @@ -1,5 +1,21 @@ module.exports = { lang: 'en', + labels: { + recalc: 'Recalculate' + }, + guess: { + start: 'The Game will start in **5 seconds** with a number between `%min` and `%max`.', + started: 'It\'s started!', + number: 'The chosen Number was `%num`, users must guess it in order to win the event.', + win: 'You got it right! The chosen Number was `%num`!', + }, + lockdown: { + pass: 'To start lockdown, send `lock` in chat.\n> ⚠️ If you want to cancel, send something else in chat.', + cancel: 'Lockdown has been successfully cancelled.', + success: 'Lockdown was successfully executed.', + locking: 'Lockdown is in progress.', + noCanal: 'No channels have been locked.' + }, print: { website: 'Print from website:' }, @@ -33,11 +49,6 @@ module.exports = { channel: 'I don\'t have permission to send messages on the mentioned channel.', sucess: 'Channel set successfully!' }, - labels: { - add: 'Add me!', - support: 'Support Server!', - vote: 'Vote for me!' - }, message: { P: 'Hello, human!', view: 'I don\'t have permission to read the message history!', diff --git a/src/Locales/pt-BR.js b/src/Locales/pt-BR.js index e2f26682..9610c664 100644 --- a/src/Locales/pt-BR.js +++ b/src/Locales/pt-BR.js @@ -1,5 +1,21 @@ module.exports = { lang: 'pt', + labels: { + recalc: 'Recalcular' + }, + guess: { + start: 'O Jogo irá começar em **5 segundos** com um número entre `%min` e `%max`.', + started: 'Valendo!', + number: 'O Número escolhido foi `%num`, os usuários devem adivinhar ele para poder ganhar o evento.', + win: 'Você Acertou! O Número escolhido foi `%num`!', + }, + lockdown: { + pass: 'Para iniciar o lockdown envie `lock` no chat.\n> ⚠️ Caso queira cancelar envie qualquer outra coisa no chat.', + cancel: 'O Lockdown foi cancelado com sucesso.', + sucess: 'O Lockdown foi executado com sucesso.', + locking: 'O Lockdown está em andamento.', + noCanal: 'Nenhum canal foi fechado.' + }, print: { site: 'Print do website:' }, @@ -33,11 +49,6 @@ module.exports = { channel: 'Não tenho permissão para enviar mensagens no canal citado.', sucess: 'Canal setado com sucesso!' }, - labels: { - add: 'Me Adicione!', - support: 'Servidor de Suporte!', - vote: 'Vote em mim!' - }, message: { P: 'Olá, humano!', view: 'Eu não tenho permissão de ler o histórico de mensagens!', diff --git a/src/Utils/ZulyFunctions.js b/src/Utils/ZulyFunctions.js index 8a2efea6..7a62822e 100644 --- a/src/Utils/ZulyFunctions.js +++ b/src/Utils/ZulyFunctions.js @@ -28,6 +28,16 @@ async function getPremium (typename, user) { } } } +async function getBugHunter (user) { + const guild = await global.zuly.getRESTGuild('880174783294214184'); + const membro = await guild.getRESTMember(user); + if (!membro) { + return false; + } + else if (membro.roles.includes('912014349277737051')) { + return true; + } +} async function banner (id) { if (!id) new Error('Não foi fornecido o ID do usuário'); const request = await fetch(`https://canary.discord.com/api/v9/users/${id}`, { @@ -97,6 +107,7 @@ function time2 (s) { return (meses > 0 ? `\`${pad(meses)}\`` + ' meses, ' : '') + (days > 0 ? `\`${pad(days)}\`` + ' dias, ' : '') + (hrs > 0 ? `\`${pad(hrs)}\`` + ' horas, ' : '') + (mins > 0 ? `\`${pad(mins)}\`` + ' minutos, ' : '') + (`\`${pad(secs)}\`` + ' segundos'); }; +global.zuly.getBugHunter = getBugHunter; global.zuly.getPremium = getPremium; global.zuly.time2 = time2; global.zuly.bytes = bytes; diff --git a/yarn.lock b/yarn.lock index 89bdfff0..25bde4e2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -598,6 +598,13 @@ erela.js@^2.3.3: petitio "^1.1.0" ws "^7.3.1" +eris-collector@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/eris-collector/-/eris-collector-1.0.1.tgz#f23d518723bacd55b6e5a1dafb0902e11e3aafd1" + integrity sha512-qAuIP8//rMaTFs/3J7Ggk2tzWuNbFqJsAP8DuT9MLpNYc6f0u+Cifpa06//oxGQOWl4sWY1+0ncJDfRvlz2PMg== + dependencies: + events "^3.1.0" + eris@0.16.1: version "0.16.1" resolved "https://registry.yarnpkg.com/eris/-/eris-0.16.1.tgz#44b0a9220944fc73dd74538cd614826bfbfcde61" @@ -838,6 +845,11 @@ etag@~1.8.1: resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887" integrity sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc= +events@^3.1.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/events/-/events-3.3.0.tgz#31a95ad0a924e2d2c419a813aeb2c4e878ea7400" + integrity sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q== + express@^4.17.1: version "4.17.1" resolved "https://registry.yarnpkg.com/express/-/express-4.17.1.tgz#4491fc38605cf51f8629d39c2b5d026f98a4c134"