├── .discloudignore ├── .env.example ├── .gitattributes ├── .gitignore ├── .vscode └── settings.json ├── JSON ├── cantadas.json ├── characters.json ├── emojis.json ├── flags.json ├── frases.json ├── gifs.json ├── hex.json ├── levelwallpapers.json ├── logomarca.json └── wallpaperanime.json ├── README.md ├── cache └── cache.sqlite.txt ├── index.js ├── package-lock.json ├── package.json ├── shard.js ├── src ├── classes │ ├── database │ │ ├── CacheManager.js │ │ ├── Database.js │ │ ├── Models.js │ │ └── models │ │ │ ├── Anime.js │ │ │ ├── Blacklist.js │ │ │ ├── Cantadas.js │ │ │ ├── Client.js │ │ │ ├── Commands.js │ │ │ ├── Economy.js │ │ │ ├── Fanart.js │ │ │ ├── Guild.js │ │ │ ├── Indications.js │ │ │ ├── Jokempo.js │ │ │ ├── Quiz.js │ │ │ ├── Rather.js │ │ │ ├── Reminders.js │ │ │ └── User.js │ ├── discloud │ │ └── discloud.js │ ├── games │ │ ├── Logomarca.js │ │ ├── Quiz.js │ │ ├── QuizManager.js │ │ └── quiz │ │ │ ├── buttons.quizGame.js │ │ │ ├── enableComponentCollector.quizGame.js │ │ │ ├── enableKeyboardCollector.quizGame.js │ │ │ ├── generateButtons.quizGame.js │ │ │ └── keyboard.quizGame.js │ ├── index.js │ ├── modules │ │ ├── Experience.js │ │ └── errors │ │ │ ├── errors.js │ │ │ ├── functions │ │ │ ├── createWebhook.errors.js │ │ │ └── reply.errors.js │ │ │ └── process │ │ │ ├── uncaughtException.js │ │ │ └── unhandledRejection.js │ └── saphire │ │ ├── client.saphire.js │ │ ├── manager.shard.js │ │ ├── process.saphire.js │ │ ├── start.saphire.js │ │ └── webhooks.saphire.js ├── functions │ ├── global │ │ ├── prototypes.js │ │ ├── prototypes │ │ │ ├── Array.prototypes.js │ │ │ ├── Channel.prototypes.js │ │ │ ├── Date.prototypes.js │ │ │ ├── Discord.prototypes.js │ │ │ ├── Guild.prototypes.js │ │ │ ├── GuildMember.prototypes.js │ │ │ ├── Message.prototype.js │ │ │ ├── Number.prototypes.js │ │ │ ├── Roles.prototypes.js │ │ │ ├── String.prototypes.js │ │ │ ├── User.prototypes.js │ │ │ └── interaction.prototypes.js │ │ └── setIntervals.js │ ├── plugins │ │ ├── execute.translate.js │ │ ├── notify.js │ │ ├── plugins.js │ │ └── timeMs.js │ └── update │ │ ├── afk │ │ └── manager.afk.js │ │ ├── chest │ │ └── manager.chest.js │ │ ├── giveaway │ │ ├── manager.giveaway.js │ │ └── start.giveaway.js │ │ ├── index.js │ │ ├── polls │ │ └── poll.manager.js │ │ ├── ranking │ │ └── index.ranking.js │ │ ├── reminder │ │ └── src │ │ │ ├── change.reminder.js │ │ │ ├── edit.reminder.js │ │ │ ├── move.reminder.js │ │ │ ├── remove.reminder.js │ │ │ └── show.reminder.js │ │ ├── spam │ │ └── manager.spam.js │ │ └── tempcall │ │ └── manager.tempcall.js ├── images │ └── webhooks │ │ └── anime_reporter.png ├── structures │ ├── classes │ │ ├── Autocomplete.js │ │ ├── Base.js │ │ ├── ButtonInteraction.js │ │ ├── ModalInteraction.js │ │ ├── Modals.js │ │ ├── SelectMenuInteraction.js │ │ ├── SlashCommand.js │ │ ├── buttons │ │ │ ├── admin │ │ │ │ ├── functions │ │ │ │ │ ├── leave.admin.js │ │ │ │ │ └── removeGuild.admin.js │ │ │ │ └── redirect.admin.js │ │ │ ├── amongus │ │ │ │ ├── cancel.amongus.js │ │ │ │ ├── copy.amongus.js │ │ │ │ ├── delete.amongus.js │ │ │ │ ├── execute.amongus.js │ │ │ │ ├── join.amongus.js │ │ │ │ ├── leave.amongus.js │ │ │ │ ├── mute.amongus.js │ │ │ │ ├── restart.amongus.js │ │ │ │ ├── start.amongus.js │ │ │ │ └── unmute.amongus.js │ │ │ ├── anime │ │ │ │ ├── delete.anime.js │ │ │ │ ├── index.anime.js │ │ │ │ ├── info.anime.js │ │ │ │ ├── refresh.anime.js │ │ │ │ ├── sendOrCancel.anime.js │ │ │ │ ├── validade.anime.js │ │ │ │ ├── validadeAnime.quiz.js │ │ │ │ ├── validate.anime.js │ │ │ │ ├── validate.quiz.js │ │ │ │ └── vote.anime.js │ │ │ ├── bet │ │ │ │ ├── dice │ │ │ │ │ ├── chooise.bet.js │ │ │ │ │ └── start.dice.js │ │ │ │ ├── index.bet.js │ │ │ │ └── multiplier │ │ │ │ │ ├── cancel.multiplier.js │ │ │ │ │ ├── explode.multiplier.js │ │ │ │ │ ├── finish.multiplier.js │ │ │ │ │ ├── game.multiplier.js │ │ │ │ │ ├── init.multiplier.js │ │ │ │ │ ├── multi.multiplier.js │ │ │ │ │ └── redirect.multiplier.js │ │ │ ├── blackjack │ │ │ │ ├── functions │ │ │ │ │ ├── accept.blackjack.js │ │ │ │ │ ├── dealer.blackjack.js │ │ │ │ │ ├── deny.blackjack.js │ │ │ │ │ ├── stand.blackjack.js │ │ │ │ │ └── upcard.blackjack.js │ │ │ │ ├── game.blackjack.js │ │ │ │ └── game.blackjack.multiplayer.js │ │ │ ├── cantadas │ │ │ │ ├── accept.cantada.js │ │ │ │ ├── delete.cantada.js │ │ │ │ ├── deny.cantada.js │ │ │ │ ├── execute.cantada.js │ │ │ │ ├── like.cantada.js │ │ │ │ └── pull.cantada.js │ │ │ ├── channel │ │ │ │ ├── channel.index.js │ │ │ │ └── delete.channel.js │ │ │ ├── chest │ │ │ │ └── button.chest.js │ │ │ ├── connect │ │ │ │ ├── check.connect.js │ │ │ │ ├── play.connect.js │ │ │ │ └── redirect.connect.js │ │ │ ├── corrida │ │ │ │ └── reset.corrida.js │ │ │ ├── donate │ │ │ │ └── copyPix.donate.js │ │ │ ├── giveaway │ │ │ │ └── giveaway.button.js │ │ │ ├── hangman │ │ │ │ └── button.hangman.js │ │ │ ├── jokempo │ │ │ │ ├── global │ │ │ │ │ ├── bet.jokempo.js │ │ │ │ │ ├── disabled.jokempo.js │ │ │ │ │ ├── draw.jokempo.js │ │ │ │ │ ├── execute.jokempo.js │ │ │ │ │ ├── lose.jokempo.js │ │ │ │ │ ├── play.jokempo.js │ │ │ │ │ ├── save.jokempo.js │ │ │ │ │ ├── select.jokempo.js │ │ │ │ │ ├── send.jokempo.js │ │ │ │ │ ├── webhook.jokempo.js │ │ │ │ │ └── win.jokempo.js │ │ │ │ ├── local │ │ │ │ │ ├── check.jokempo.js │ │ │ │ │ ├── clientPlay.jokempo.js │ │ │ │ │ ├── finish.jokempo.js │ │ │ │ │ ├── refuse.jokempo.js │ │ │ │ │ ├── start.jokempo.js │ │ │ │ │ └── userPlay.jokempo.js │ │ │ │ └── redirect.jokempo.js │ │ │ ├── level │ │ │ │ └── background.level.js │ │ │ ├── marry │ │ │ │ ├── divorce.buttons.js │ │ │ │ └── marry.buttons.js │ │ │ ├── memoryGame │ │ │ │ ├── coop.memory.js │ │ │ │ ├── disable.memory.js │ │ │ │ ├── solo.memory.js │ │ │ │ └── versus.memory.js │ │ │ ├── payment │ │ │ │ ├── new.pay.js │ │ │ │ └── validate.pay.js │ │ │ ├── perfil │ │ │ │ ├── like.perfil.js │ │ │ │ └── star.perfil.js │ │ │ ├── poll │ │ │ │ ├── counter.poll.js │ │ │ │ ├── result.poll.js │ │ │ │ └── vote.poll.js │ │ │ ├── quiz │ │ │ │ ├── acceptCategory.quiz.js │ │ │ │ ├── acceptQuestion.quiz.js │ │ │ │ ├── changeCategoryName.quiz.js │ │ │ │ ├── checker.quiz.js │ │ │ │ ├── config.quiz.js │ │ │ │ ├── credits.quiz.js │ │ │ │ ├── custom.quiz.js │ │ │ │ ├── delCatAndQuestions.quiz.js │ │ │ │ ├── deleteCategory.quiz.js │ │ │ │ ├── deleteConfig.quiz.js │ │ │ │ ├── deleteQuestion.quiz.js │ │ │ │ ├── deleteQuestionRequest.quiz.js │ │ │ │ ├── denyCategory.quiz.js │ │ │ │ ├── editCategory.quiz.js │ │ │ │ ├── editCuriosity.quiz.js │ │ │ │ ├── editPainel.quiz.js │ │ │ │ ├── editQuestion.quiz.js │ │ │ │ ├── feedbackReport.quiz.js │ │ │ │ ├── newEditCategory.quiz.js │ │ │ │ ├── newQuestion.quiz.js │ │ │ │ ├── newQuizCatEdit.quiz.js │ │ │ │ ├── newQuizCategory.quiz.js │ │ │ │ ├── newQuizCuriosity.quiz.js │ │ │ │ ├── newQuizEdition.quiz.js │ │ │ │ ├── newQuizEditionAdmin.quiz.js │ │ │ │ ├── newQuizQuestion.quiz.js │ │ │ │ ├── newQuizRefuse.quiz.js │ │ │ │ ├── newQuizReport.quiz.js │ │ │ │ ├── options.quiz.js │ │ │ │ ├── play.quiz.js │ │ │ │ ├── questionInfo.quiz.js │ │ │ │ ├── reviewCategory.quiz.js │ │ │ │ ├── reviewQuestion.quiz.js │ │ │ │ ├── reviewReports.quiz.js │ │ │ │ ├── saveQuestion.quiz.js │ │ │ │ ├── viewCategories.quiz.js │ │ │ │ └── viewCategoryConfig.quiz.js │ │ │ ├── raspadinha │ │ │ │ ├── build.raspadinha.js │ │ │ │ ├── buy.raspadinha.js │ │ │ │ ├── check.raspadinha.js │ │ │ │ ├── click.raspadinha.js │ │ │ │ ├── index.raspadinha.js │ │ │ │ └── win.raspadinha.js │ │ │ ├── rather │ │ │ │ ├── admin │ │ │ │ │ ├── confirm.rather.js │ │ │ │ │ ├── edit.rather.js │ │ │ │ │ └── request.rather.js │ │ │ │ ├── game.rather.js │ │ │ │ └── next.rather.js │ │ │ ├── reminder │ │ │ │ └── redirect.js │ │ │ ├── rifa │ │ │ │ └── rifa.js │ │ │ ├── saphireInfo │ │ │ │ └── trade.info.js │ │ │ ├── server │ │ │ │ ├── build.server.js │ │ │ │ ├── disable.server.js │ │ │ │ ├── embed.server.js │ │ │ │ ├── redirect.server.js │ │ │ │ └── save.server.js │ │ │ ├── tempcall │ │ │ │ └── redirect.tempcall.js │ │ │ ├── tictactoe │ │ │ │ ├── check.tictactoe.js │ │ │ │ ├── finish.tictactoe.js │ │ │ │ └── game.tictactoe.js │ │ │ ├── twitch │ │ │ │ ├── accept.twitch.js │ │ │ │ ├── active.twitch.js │ │ │ │ ├── clips.twitch.js │ │ │ │ ├── disable.twitch.js │ │ │ │ ├── oldLive.twitch.js │ │ │ │ └── redirect.twitch.js │ │ │ └── vip │ │ │ │ └── vip.buttons.js │ │ ├── modals │ │ │ ├── cantadas │ │ │ │ └── cantadas.modal.js │ │ │ ├── hangman │ │ │ │ ├── analise.hangman.js │ │ │ │ ├── letter.hangman.js │ │ │ │ ├── new.hangman.js │ │ │ │ └── word.hangman.js │ │ │ └── wordleGame │ │ │ │ ├── wordleGame.info.modal.js │ │ │ │ └── wordleGame.modal.js │ │ └── selectmenu │ │ │ ├── amongus │ │ │ └── death.amongus.js │ │ │ ├── announce │ │ │ └── config.anunciar.js │ │ │ ├── logsCommand │ │ │ ├── disable.logs.js │ │ │ └── index.logs.js │ │ │ ├── minday │ │ │ └── interaction.minday.js │ │ │ ├── rifa │ │ │ └── refund.rifa.js │ │ │ ├── search │ │ │ ├── response.search.js │ │ │ └── translate.search.js │ │ │ └── spam │ │ │ ├── capslock.spam.js │ │ │ ├── channels.spam.js │ │ │ ├── disable.spam.js │ │ │ ├── disablePercent.spam.js │ │ │ ├── disableRepeat.spam.js │ │ │ ├── enable.spam.js │ │ │ ├── enablePercent.spam.js │ │ │ ├── enableRepeat.spam.js │ │ │ ├── info.spam.js │ │ │ ├── messageDisable.spam.js │ │ │ ├── messageEnable.spam.js │ │ │ ├── messages.spam.js │ │ │ ├── messagesAmount.spam.js │ │ │ ├── messagesSeconds.spam.js │ │ │ ├── percent.spam.js │ │ │ ├── redirect.spam.js │ │ │ ├── removeChannels.spam.js │ │ │ ├── removeRoles.spam.js │ │ │ ├── repeat.spam.js │ │ │ ├── roles.spam.js │ │ │ ├── setImuneChannels.spam.js │ │ │ ├── setImuneRoles.spam.js │ │ │ ├── setPercent.spam.js │ │ │ ├── unsetImuneChannels.spam.js │ │ │ └── unsetImuneRoles.spam.js │ ├── commands │ │ ├── functions │ │ │ ├── anime │ │ │ │ ├── indicate.anime.js │ │ │ │ ├── indications.anime.js │ │ │ │ ├── my.anime.js │ │ │ │ ├── search.anime.js │ │ │ │ └── wallpaper.anime.js │ │ │ ├── anunciar │ │ │ │ ├── channel.anunciar.js │ │ │ │ └── role.anunciar.js │ │ │ ├── autorole │ │ │ │ ├── add.autorole.js │ │ │ │ └── painel.autorole.js │ │ │ ├── bot │ │ │ │ ├── botinfo.saphire.js │ │ │ │ ├── commandHistory.saphire.js │ │ │ │ ├── commands.saphire.js │ │ │ │ ├── fanarts.saphire.js │ │ │ │ ├── multicommands.saphire.js │ │ │ │ └── profile.saphire.js │ │ │ ├── cantadas │ │ │ │ └── view.cantadas.js │ │ │ ├── channel │ │ │ │ ├── category.channel.js │ │ │ │ ├── delete.channel.js │ │ │ │ ├── invite.channel.js │ │ │ │ ├── lock.channel.js │ │ │ │ ├── nsfw-disable.channel.js │ │ │ │ ├── nsfw-enable.channel.js │ │ │ │ └── unlock.channel.js │ │ │ ├── giveaway │ │ │ │ ├── create.giveaway.js │ │ │ │ ├── delete.giveaway.js │ │ │ │ ├── finish.giveaway.js │ │ │ │ ├── info.giveaway.js │ │ │ │ ├── list.giveaway.js │ │ │ │ ├── reroll.giveaway.js │ │ │ │ └── reset.giveaway.js │ │ │ ├── help │ │ │ │ └── allCommands.js │ │ │ ├── logomarca │ │ │ │ ├── game.logomarca.js │ │ │ │ ├── list.logomarca.js │ │ │ │ └── view.logomarca.js │ │ │ ├── memorygame │ │ │ │ ├── coop.memory.js │ │ │ │ ├── emojis.js │ │ │ │ ├── functions │ │ │ │ │ ├── disable.memory.js │ │ │ │ │ ├── generator.coop.memory.js │ │ │ │ │ ├── generator.memory.js │ │ │ │ │ └── generator.versus.memory.js │ │ │ │ ├── sequency.memory.js │ │ │ │ ├── solo.memory.js │ │ │ │ ├── util.js │ │ │ │ └── versus.memory.js │ │ │ ├── nsfw │ │ │ │ └── images.js │ │ │ ├── serverinfo │ │ │ │ ├── emojis.serverinfo.js │ │ │ │ ├── features.serverinfo.js │ │ │ │ ├── images.serverinfo.js │ │ │ │ ├── numbers.serverinfo.js │ │ │ │ ├── pages.serverinfo.js │ │ │ │ ├── roles.serverinfo.js │ │ │ │ └── suplement.serverinfo.js │ │ │ ├── staff │ │ │ │ ├── index.anime.js │ │ │ │ ├── logomarca │ │ │ │ │ ├── delete.logomarca.js │ │ │ │ │ ├── edit.logomarca.js │ │ │ │ │ └── new.logomarca.js │ │ │ │ └── wallpaper │ │ │ │ │ ├── add.wallpaper.js │ │ │ │ │ ├── create.wallpaper.js │ │ │ │ │ ├── delete.wallpaper.js │ │ │ │ │ └── deleteWallpaper.wallpaper.js │ │ │ ├── tictactoe │ │ │ │ ├── generateButton.tictactoe.js │ │ │ │ └── newGame.tictactoe.js │ │ │ └── wordle │ │ │ │ ├── addPlayers.wordle.js │ │ │ │ └── create.wordle.js │ │ ├── prefix │ │ │ ├── bot │ │ │ │ ├── help.js │ │ │ │ ├── invite.js │ │ │ │ ├── ping.js │ │ │ │ └── vote.js │ │ │ ├── economy │ │ │ │ ├── balance.js │ │ │ │ ├── daily.js │ │ │ │ ├── lance.js │ │ │ │ └── transactions.js │ │ │ ├── games │ │ │ │ ├── connect4.js │ │ │ │ └── tictactoe.js │ │ │ ├── locked │ │ │ │ └── locked.js │ │ │ ├── moderation │ │ │ │ ├── addroles.js │ │ │ │ └── setprefix.js │ │ │ ├── profile │ │ │ │ ├── like.js │ │ │ │ └── profile.js │ │ │ └── util │ │ │ │ ├── avatar.js │ │ │ │ └── userinfo.js │ │ └── slash │ │ │ ├── admin │ │ │ ├── admin.js │ │ │ ├── blacklist.js │ │ │ ├── discloud.js │ │ │ └── functions │ │ │ │ ├── admin │ │ │ │ ├── backup.admin.js │ │ │ │ ├── cantada.admin.js │ │ │ │ ├── commandManager.admin.js │ │ │ │ ├── commit.admin.js │ │ │ │ ├── delete.admin.js │ │ │ │ ├── fanart.admin.js │ │ │ │ ├── fetch_guild_members.admin.js │ │ │ │ ├── functions.admin.js │ │ │ │ ├── invite.admin.js │ │ │ │ ├── reboot.admin.js │ │ │ │ ├── register.admin.js │ │ │ │ ├── roles_server.admin.js │ │ │ │ └── test.admin.js │ │ │ │ ├── blacklist │ │ │ │ ├── add.blacklist.js │ │ │ │ ├── check.blacklist.js │ │ │ │ └── remove.blacklist.js │ │ │ │ └── discloud │ │ │ │ ├── apps.discloud.js │ │ │ │ ├── backup.discloud.js │ │ │ │ ├── clear.discloud.js │ │ │ │ ├── functions.discloud.js │ │ │ │ ├── logs.discloud.js │ │ │ │ ├── restart.discloud.js │ │ │ │ ├── start.discloud.js │ │ │ │ ├── status.discloud.js │ │ │ │ ├── stop.discloud.js │ │ │ │ ├── update.discloud.js │ │ │ │ └── user.discloud.js │ │ │ ├── bot │ │ │ ├── botinfo.js │ │ │ ├── bug.js │ │ │ ├── commands.js │ │ │ ├── donate.js │ │ │ ├── help.js │ │ │ ├── invite.js │ │ │ ├── mydata.js │ │ │ ├── ping.js │ │ │ ├── saphire.js │ │ │ ├── staff.js │ │ │ └── vote.js │ │ │ ├── economy │ │ │ ├── balance.js │ │ │ ├── balance │ │ │ │ └── manage.balance.js │ │ │ ├── bet.js │ │ │ ├── bet │ │ │ │ ├── class.bet.js │ │ │ │ ├── dice.bet.js │ │ │ │ ├── functions │ │ │ │ │ ├── addPlayer.bet.js │ │ │ │ │ ├── button.multiplier.js │ │ │ │ │ ├── end.bet.js │ │ │ │ │ └── realize.bet.js │ │ │ │ ├── lauch.multiplier.js │ │ │ │ ├── new.bet.js │ │ │ │ └── refund.bet.js │ │ │ ├── bitcoin.js │ │ │ ├── cards.js │ │ │ ├── corrida.js │ │ │ ├── daily.js │ │ │ ├── daily │ │ │ │ ├── new.daily.js │ │ │ │ └── reminder.daily.js │ │ │ ├── emoji.js │ │ │ ├── emoji │ │ │ │ └── steal.emoji.js │ │ │ ├── emojibet │ │ │ │ ├── admin.emoji.js │ │ │ │ ├── bet.invest.js │ │ │ │ ├── handler.emoji.js │ │ │ │ ├── handlerview.emoji.js │ │ │ │ ├── invest.emoji.js │ │ │ │ ├── remove.bet.js │ │ │ │ ├── rescue.bet.js │ │ │ │ └── view.emoji.js │ │ │ ├── lance.js │ │ │ ├── pay.js │ │ │ ├── pig.js │ │ │ ├── raspadinha.js │ │ │ ├── rifa.js │ │ │ ├── rifa │ │ │ │ ├── buy.rifa.js │ │ │ │ ├── giveaway.rifa.js │ │ │ │ ├── refund.rifa.js │ │ │ │ ├── table.rifa.js │ │ │ │ └── verify.rifa.js │ │ │ └── transactions.js │ │ │ ├── fun │ │ │ ├── jokempo.js │ │ │ ├── jokempo │ │ │ │ └── client.jokempo.js │ │ │ └── ship.js │ │ │ ├── games │ │ │ ├── amongus.js │ │ │ ├── bandeiras │ │ │ │ └── manager.bandeiras.js │ │ │ ├── blackjack.js │ │ │ ├── blackjack │ │ │ │ ├── blackjack.class.js │ │ │ │ ├── emojis.json │ │ │ │ ├── multiplayer │ │ │ │ │ └── multiplayer.blackjack.js │ │ │ │ ├── refund │ │ │ │ │ └── index.js │ │ │ │ └── solo │ │ │ │ │ ├── index.js │ │ │ │ │ └── luck.blackjack.js │ │ │ ├── connect4.js │ │ │ ├── fasttype.js │ │ │ ├── fasttype │ │ │ │ └── phrases.fasttype.json │ │ │ ├── hangman.js │ │ │ ├── hangman │ │ │ │ └── random.hangman.js │ │ │ ├── lastclick.js │ │ │ ├── memory.js │ │ │ ├── quiz.js │ │ │ ├── quiz │ │ │ │ ├── anime.quiz.js │ │ │ │ ├── anime │ │ │ │ │ ├── analise.anime.js │ │ │ │ │ ├── class.anime.js │ │ │ │ │ ├── options.anime.js │ │ │ │ │ ├── start.anime.js │ │ │ │ │ ├── suggest.anime.js │ │ │ │ │ └── viewer.anime.js │ │ │ │ ├── bandeiras.quiz.js │ │ │ │ ├── logomarca.quiz.js │ │ │ │ └── perguntas │ │ │ │ │ └── showup.perguntas.js │ │ │ ├── rather.js │ │ │ ├── rather │ │ │ │ ├── functions │ │ │ │ │ ├── addPoint.rather.js │ │ │ │ │ ├── delete.rather.js │ │ │ │ │ ├── edit.rather.js │ │ │ │ │ ├── personalList.rather.js │ │ │ │ │ └── view.rather.js │ │ │ │ ├── game.rather.js │ │ │ │ └── options.rather.js │ │ │ ├── tictactoe.js │ │ │ └── wordle.js │ │ │ ├── images │ │ │ ├── changemymind.js │ │ │ ├── gifs.js │ │ │ ├── gifs │ │ │ │ ├── emotional.gifs.data.js │ │ │ │ ├── emotional.gifs.js │ │ │ │ ├── interaction.gifs.data.js │ │ │ │ ├── interaction.gifs.js │ │ │ │ └── measurer.gifs.js │ │ │ ├── images.js │ │ │ ├── phub.js │ │ │ └── youtube.js │ │ │ ├── moderation │ │ │ ├── addroles.js │ │ │ ├── anunciar.js │ │ │ ├── ban.js │ │ │ ├── channel.js │ │ │ ├── clear.js │ │ │ ├── functions │ │ │ │ ├── autorole │ │ │ │ │ └── index.autorole.js │ │ │ │ ├── server │ │ │ │ │ ├── lauch.server.js │ │ │ │ │ ├── minday.server.js │ │ │ │ │ └── spam.server.js │ │ │ │ ├── status.stars.js │ │ │ │ └── twitch │ │ │ │ │ ├── ativar.twitch.js │ │ │ │ │ ├── categories.search.twitch.js │ │ │ │ │ ├── channels.search.twitch.js │ │ │ │ │ ├── desativar.twitch.js │ │ │ │ │ ├── informations.twitch.js │ │ │ │ │ ├── search.twitch.js │ │ │ │ │ └── streamersOnline.twitch.js │ │ │ ├── giveaway.js │ │ │ ├── logs.js │ │ │ ├── roles.js │ │ │ ├── server.js │ │ │ ├── stars.js │ │ │ ├── twitch.js │ │ │ └── unban.js │ │ │ ├── nsfw │ │ │ └── nsfw.js │ │ │ ├── perfil │ │ │ ├── divorce.js │ │ │ ├── level.js │ │ │ ├── level │ │ │ │ ├── Poppins-SemiBold.ttf │ │ │ │ ├── build.level.js │ │ │ │ ├── buy.level.js │ │ │ │ ├── list.level.js │ │ │ │ └── wallpapers.level.js │ │ │ ├── like.js │ │ │ ├── marry.js │ │ │ ├── perfil │ │ │ │ ├── gender.profile.js │ │ │ │ ├── sign.profile.js │ │ │ │ └── star.profile.js │ │ │ ├── profile.js │ │ │ ├── vip.js │ │ │ └── vip │ │ │ │ ├── buy.vip.js │ │ │ │ └── viewer.vip.js │ │ │ ├── userContextMenu │ │ │ ├── avatar.js │ │ │ ├── clear.js │ │ │ ├── removeReacts.js │ │ │ ├── retweet.js │ │ │ ├── translate.js │ │ │ └── userinfo.js │ │ │ └── util │ │ │ ├── afk.js │ │ │ ├── anime.js │ │ │ ├── avatar.js │ │ │ ├── cantada.js │ │ │ ├── chat.js │ │ │ ├── clima.js │ │ │ ├── cooldown.js │ │ │ ├── cripto.js │ │ │ ├── dicionario.js │ │ │ ├── lembrete.js │ │ │ ├── permissions.js │ │ │ ├── poll.js │ │ │ ├── ranking.js │ │ │ ├── serverinfo.js │ │ │ ├── spotify.js │ │ │ ├── tempcall.js │ │ │ ├── tempcall │ │ │ ├── config.tempcall.js │ │ │ ├── layout.tempcall.js │ │ │ ├── member.ranking.tempcall.js │ │ │ └── ranking.tempcall.js │ │ │ ├── translate.js │ │ │ ├── userinfo.js │ │ │ ├── wallpaper.js │ │ │ └── wallpaper │ │ │ ├── general.wallpaper.js │ │ │ └── searchAnime.wallpaper.js │ ├── events │ │ ├── ShardEvents.js │ │ ├── betReaction.js │ │ ├── betRefund.js │ │ ├── blackjackRefund.js │ │ ├── channelDelete.js │ │ ├── channelUpdate.js │ │ ├── error.js │ │ ├── functions │ │ │ ├── add.guildMemberAdd.js │ │ │ ├── channelCreate.js │ │ │ ├── integrationCreate.js │ │ │ ├── integrationDelete.js │ │ │ ├── inviteCreate.js │ │ │ ├── registerSlashCommands.js │ │ │ └── remove.guildMemberRemove.js │ │ ├── giveaway.js │ │ ├── guildAuditLogEntryCreate.js │ │ ├── guildBanAdd.js │ │ ├── guildBanRemove.js │ │ ├── guildCreate.js │ │ ├── guildDelete.js │ │ ├── guildMemberAdd.js │ │ ├── guildMemberRemove.js │ │ ├── guildMemberUpdate.js │ │ ├── interactionCreate.js │ │ ├── jokempoRefund.js │ │ ├── messageCreate.js │ │ ├── messageDelete.js │ │ ├── messageDeleteBulk.js │ │ ├── messageUpdate.js │ │ ├── paymentCreate.js │ │ ├── paymentUpdate.js │ │ ├── reactionCreate.js │ │ ├── ready.js │ │ ├── shardReconnecting.js │ │ ├── system │ │ │ ├── emojis.reactions.js │ │ │ ├── execute.autorole.js │ │ │ ├── execute.stars.js │ │ │ └── messageDelete.logs.js │ │ ├── typingStart.js │ │ ├── voiceStateUpdate.js │ │ └── webhookUpdate.js │ └── handler │ │ ├── commands.handler.js │ │ └── events.handler.js ├── util │ ├── Bind.js │ ├── Bytes.js │ ├── Constants.js │ └── util.js └── websocket │ ├── datamodels │ ├── animes.get.js │ ├── cantadas.get.js │ ├── client.get.js │ ├── economies.get.js │ ├── fanarts.get.js │ ├── guilds.get.js │ ├── indications.get.js │ ├── rathers.get.js │ ├── reminders.get.js │ └── users.get.js │ ├── functions │ └── topgg.reward.js │ └── websocket.js └── temp └── temp.txt /.discloudignore: -------------------------------------------------------------------------------- 1 | backup 2 | *.example 3 | node_modules 4 | README.md 5 | .gitattributes 6 | .gitignore -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "editor.smoothScrolling": true, 3 | "editor.stickyScroll.enabled": true 4 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | One day... I'll write something here... One day... 2 | -------------------------------------------------------------------------------- /cache/cache.sqlite.txt: -------------------------------------------------------------------------------- 1 | Just an folder to keep tons of cache data to improve the SPEEEED! -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | import("./src/classes/saphire/client.saphire.js").then(file => file.default.start()); 2 | import("./src/functions/global/prototypes.js") 3 | import("./src/classes/saphire/process.saphire.js") -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "saphire", 3 | "version": "3.14.21", 4 | "description": "a little giant bot", 5 | "main": "shard.js", 6 | "type": "module", 7 | "scripts": { 8 | "start": "node .", 9 | "test": "tsc && cross-env NODE_OPTIONS=--experimental-vm-modules NODE_NO_WARNINGS=1 jest" 10 | }, 11 | "author": "rody", 12 | "license": "ISC", 13 | "dependencies": { 14 | "@iamtraction/google-translate": "^2.0.1", 15 | "anime-wallpapers": "^1.0.1", 16 | "axios": "^1.4.0", 17 | "better-sqlite3": "^8.5.1", 18 | "canvacord": "^5.4.10", 19 | "canvas": "^2.11.2", 20 | "discloud.app": "^0.7.1", 21 | "discord.js": "^14.13.0", 22 | "dotenv": "^16.3.1", 23 | "hmfull": "^2.4.3", 24 | "moment": "^2.29.4", 25 | "moment-timezone": "^0.5.43", 26 | "mongoose": "^7.4.3", 27 | "parse-ms": "^3.0.0", 28 | "quick.db": "^9.1.7", 29 | "socket.io-client": "^4.7.2", 30 | "statcord.js": "^3.4.3", 31 | "vxdicionario": "^1.3.0", 32 | "weather-js": "^2.0.0" 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/classes/database/Models.js: -------------------------------------------------------------------------------- 1 | import Fanart from './models/Fanart.js' 2 | import ModelClient from './models/Client.js' 3 | import ModelGuild from './models/Guild.js' 4 | import ModelEconomy from './models/Economy.js' 5 | import ModelReminders from './models/Reminders.js' 6 | import ModelUser from './models/User.js' 7 | import Rather from './models/Rather.js' 8 | import Indications from './models/Indications.js' 9 | import Cantadas from './models/Cantadas.js' 10 | import Anime from './models/Anime.js' 11 | import Quiz from './models/Quiz.js' 12 | import Jokempo from './models/Jokempo.js' 13 | import Commands from './models/Commands.js' 14 | import Blacklist from './models/Blacklist.js' 15 | 16 | /** 17 | * Unificação de todos os Models para extensão da Classe Database 18 | */ 19 | 20 | class Models { 21 | constructor() { 22 | this.Fanart = Fanart 23 | this.Client = ModelClient 24 | this.Guild = ModelGuild 25 | this.Economy = ModelEconomy 26 | this.Reminder = ModelReminders 27 | this.User = ModelUser 28 | this.Rather = Rather 29 | this.Indications = Indications 30 | this.Cantadas = Cantadas 31 | this.Anime = Anime 32 | this.Quiz = Quiz 33 | this.Jokempo = Jokempo 34 | this.Commands = Commands 35 | this.Blacklist = Blacklist 36 | } 37 | } 38 | 39 | export { 40 | Fanart, 41 | ModelClient as Client, 42 | ModelGuild as Guild, 43 | ModelEconomy as Economy, 44 | ModelReminders as Reminders, 45 | ModelUser as User, 46 | Models, 47 | Rather, 48 | Indications, 49 | Cantadas, 50 | Anime, 51 | Quiz, 52 | Jokempo, 53 | Commands, 54 | Blacklist 55 | } -------------------------------------------------------------------------------- /src/classes/database/models/Anime.js: -------------------------------------------------------------------------------- 1 | import Mongoose from 'mongoose' 2 | const { Schema, model } = Mongoose 3 | 4 | export default model("Anime", new Schema({ 5 | id: String, 6 | name: String, 7 | anime: String, 8 | acceptedFor: String, 9 | sendedFor: String, 10 | type: String, 11 | imageUrl: String 12 | })) -------------------------------------------------------------------------------- /src/classes/database/models/Blacklist.js: -------------------------------------------------------------------------------- 1 | import Mongoose from 'mongoose' 2 | const { Schema, model } = Mongoose 3 | 4 | export default model("Blacklist", new Schema({ 5 | id: { type: String, unique: true }, 6 | type: { type: String }, // user | guild | economy 7 | removeIn: { type: Date, default: null }, 8 | addedAt: { type: Date }, 9 | staff: { type: String }, 10 | reason: { type: String } 11 | })) -------------------------------------------------------------------------------- /src/classes/database/models/Cantadas.js: -------------------------------------------------------------------------------- 1 | import Mongoose from 'mongoose' 2 | const { Schema, model } = Mongoose 3 | 4 | export default model("Cantada", new Schema({ 5 | id: String, 6 | phrase: String, 7 | userId: String, 8 | acceptedFor: String, 9 | likes: { 10 | up: Array, 11 | down: Array 12 | } 13 | })) -------------------------------------------------------------------------------- /src/classes/database/models/Commands.js: -------------------------------------------------------------------------------- 1 | import Mongoose from 'mongoose' 2 | const { Schema, model } = Mongoose 3 | 4 | export default model("Commands", new Schema({ 5 | id: String, 6 | count: Number, 7 | usage: Array 8 | })) -------------------------------------------------------------------------------- /src/classes/database/models/Economy.js: -------------------------------------------------------------------------------- 1 | import Mongoose from 'mongoose' 2 | const { Schema, model } = Mongoose 3 | 4 | export default model("Economy", new Schema({ 5 | id: String, 6 | Lotery: { 7 | Close: Boolean, 8 | Prize: Number, 9 | Users: Array, 10 | LastWinner: String 11 | }, 12 | Rifa: { 13 | // [ { number: Number, userId: String } ] 14 | Numbers: Array, 15 | TempPrize: Number, 16 | LastWinner: String, 17 | LastNumber: Number, 18 | LastPrize: Number 19 | }, 20 | Emojis: [{ 21 | Emoji: { 22 | type: String, 23 | unique: true 24 | }, 25 | Users: [{ 26 | type: Object, 27 | id: { 28 | type: String, 29 | unique: true 30 | }, 31 | value: Number 32 | }] 33 | }] 34 | })) -------------------------------------------------------------------------------- /src/classes/database/models/Fanart.js: -------------------------------------------------------------------------------- 1 | import Mongoose from 'mongoose' 2 | const { Schema, model } = Mongoose 3 | 4 | export default model("Fanart", new Schema({ 5 | id: { type: Number, unique: true }, 6 | userId: String, 7 | name: String, 8 | url: String, 9 | socialUrl: { type: String, default: "" }, 10 | like: [String], 11 | unlike: [String] 12 | })) -------------------------------------------------------------------------------- /src/classes/database/models/Indications.js: -------------------------------------------------------------------------------- 1 | import Mongoose from 'mongoose' 2 | const { Schema, model } = Mongoose 3 | 4 | export default model("Indications", new Schema({ 5 | name: { type: String, unique: true }, 6 | category: Array, 7 | gender: Array, 8 | targetPublic: Array, 9 | authorId: String, 10 | up: Array, 11 | down: Array 12 | })) -------------------------------------------------------------------------------- /src/classes/database/models/Jokempo.js: -------------------------------------------------------------------------------- 1 | import Mongoose from 'mongoose' 2 | 3 | const { Schema, model } = Mongoose 4 | 5 | export default model("Jokempo", new Schema({ 6 | id: { type: String, unique: true }, 7 | value: { type: Number }, 8 | webhookUrl: { type: String }, 9 | creatorId: { type: String }, 10 | creatorOption: { type: String }, 11 | channelOrigin: { type: String } 12 | })) -------------------------------------------------------------------------------- /src/classes/database/models/Quiz.js: -------------------------------------------------------------------------------- 1 | import Mongoose from 'mongoose' 2 | const { Schema, model } = Mongoose 3 | 4 | export default model("Quiz", new Schema({ 5 | questionId: { type: String, unique: true }, 6 | enableCategories: { type: Array, default: null }, 7 | question: String, 8 | curiosity: Array, 9 | category: String, 10 | answers: Array, 11 | suggestedBy: String, 12 | hits: { type: Number, default: 0 }, 13 | misses: { type: Number, default: 0 }, 14 | customGameOptions: Array 15 | })) -------------------------------------------------------------------------------- /src/classes/database/models/Rather.js: -------------------------------------------------------------------------------- 1 | import Mongoose from 'mongoose' 2 | const { Schema, model } = Mongoose 3 | 4 | export default model("Rather", new Schema({ 5 | id: { type: String, unique: true }, 6 | authorId: String, 7 | optionOne: { 8 | question: String, 9 | users: Array 10 | }, 11 | optionTwo: { 12 | question: String, 13 | users: Array 14 | }, 15 | edited: Boolean 16 | })) -------------------------------------------------------------------------------- /src/classes/database/models/Reminders.js: -------------------------------------------------------------------------------- 1 | import Mongoose from 'mongoose' 2 | const { Schema, model } = Mongoose 3 | 4 | export default model("Reminders", new Schema({ 5 | id: { type: String, unique: true }, 6 | userId: { type: String, default: "" }, 7 | guildId: { type: String, default: "" }, 8 | RemindMessage: { type: String, default: "" }, 9 | Time: { type: Number, default: 0 }, 10 | snoozed: { type: Boolean, default: false }, 11 | timeout: { type: Schema.Types.Mixed, default: false }, 12 | isAutomatic: { type: Boolean, default: false }, 13 | DateNow: { type: Number, default: 0 }, 14 | ChannelId: { type: String, default: "" }, 15 | Alerted: { type: Boolean, default: false }, 16 | privateOrChannel: { type: Boolean, default: false }, 17 | interval: { type: Number, default: 0 }, 18 | messageId: { type: String, default: "" }, 19 | deleteAt: { type: Number, default: 0 } 20 | })) -------------------------------------------------------------------------------- /src/classes/discloud/discloud.js: -------------------------------------------------------------------------------- 1 | import { discloud } from 'discloud.app' 2 | import('dotenv/config') 3 | 4 | discloud.login() 5 | .catch(err => { 6 | console.log(err) 7 | return 'Discloud Host Not Connected' 8 | }) -------------------------------------------------------------------------------- /src/classes/games/quiz/buttons.quizGame.js: -------------------------------------------------------------------------------- 1 | import { Emojis as e } from "../../../util/util.js" 2 | import { SaphireClient as client } from "../../index.js" 3 | import QuizGameClass from "../Quiz.js" 4 | import enableComponentCollector from "./enableComponentCollector.quizGame.js" 5 | import generateButtonsQuizGame from "./generateButtons.quizGame.js" 6 | 7 | /** 8 | * @param { QuizGameClass } Quiz 9 | */ 10 | export default async (question, Quiz) => { 11 | 12 | if (Quiz.stop) return Quiz.unregister() 13 | Quiz.data.rounds++ 14 | const correctAnswer = question.answers.find(aw => aw.correct) 15 | 16 | if (!correctAnswer) { 17 | Quiz.stop = true 18 | await Quiz.deleteMessage() 19 | return Quiz.channelSend({ content: `${e.Deny} | Por algum motivo muito desconhecido, a resposta correta para a pergunta não foi encontrada.\n${e.Info} | Pergunta: **\`${question.question}\`**` }) 20 | } 21 | Quiz.calculateTime(correctAnswer.answer) 22 | 23 | const buttons = generateButtonsQuizGame(question) 24 | 25 | await Quiz.deleteMessage() 26 | await Quiz.channelSend({ 27 | embeds: [ 28 | { 29 | color: client.blue, 30 | title: `${e.QuizLogo} Categoria: ${question.category || 'Not Found'}`, 31 | description: `⏱️ ${Date.Timestamp(Quiz.options.responseTime + Quiz.data.timeBonus, 'R')}\n \n${e.QuestionMark} **${question.question}**`, 32 | footer: { 33 | text: Quiz.data.timeBonus > 0 ? `Bônus de tempo adicionado: ${Date.stringDate(Quiz.data.timeBonus, true)}` : null 34 | } 35 | } 36 | ], 37 | components: buttons, 38 | redefineMessage: true 39 | }) 40 | 41 | if (!Quiz.message || Quiz.stop) return Quiz.unregister() 42 | return await enableComponentCollector(Quiz.message, correctAnswer.answer, Quiz, question) 43 | } -------------------------------------------------------------------------------- /src/classes/games/quiz/generateButtons.quizGame.js: -------------------------------------------------------------------------------- 1 | import { ButtonStyle } from "discord.js" 2 | 3 | export default question => { 4 | const component = [{ type: 1, components: [] }] 5 | const answers = question.answers.randomize() 6 | 7 | for (const answer of answers) 8 | component[0].components.push({ 9 | type: 2, 10 | label: answer.answer?.captalize() || "Nop", 11 | custom_id: answer.answer, 12 | style: ButtonStyle.Primary 13 | }) 14 | 15 | return component 16 | } -------------------------------------------------------------------------------- /src/classes/games/quiz/keyboard.quizGame.js: -------------------------------------------------------------------------------- 1 | import { Emojis as e } from "../../../util/util.js" 2 | import { SaphireClient as client } from "../../index.js" 3 | import QuizGameClass from "../Quiz.js" 4 | import enableKeyboardCollectorQuizGame from "./enableKeyboardCollector.quizGame.js" 5 | 6 | /** 7 | * @param { QuizGameClass } Quiz 8 | */ 9 | export default async (question, Quiz) => { 10 | 11 | if (Quiz.stop) return Quiz.unregister() 12 | Quiz.data.rounds++ 13 | const correctAnswer = question.answers.find(aw => aw.correct) 14 | 15 | if (!correctAnswer) { 16 | Quiz.stop = true 17 | await Quiz.deleteMessage() 18 | return Quiz.channelSend({ content: `${e.Deny} | Por algum motivo muito desconhecido, a resposta correta para a pergunta não foi encontrada.\n${e.Info} | Pergunta: **\`${question.question}\`**` }) 19 | } 20 | Quiz.calculateTime(correctAnswer.answer) 21 | 22 | const embed = { 23 | color: client.blue, 24 | title: `${e.QuizLogo} Categoria: ${question.category || 'Not Found'}`, 25 | description: `⏱️ ${Date.Timestamp(Quiz.options.responseTime + Quiz.data.timeBonus, 'R')}\n \n${e.QuestionMark} **${question.question}**`, 26 | footer: { 27 | text: Quiz.data.timeBonus > 0 ? `Bônus de tempo adicionado: ${Date.stringDate(Quiz.data.timeBonus, true)}` : null 28 | } 29 | } 30 | 31 | await Quiz.updateMessage({ embeds: [embed], fetchReply: true }) 32 | if (!Quiz.message || Quiz.stop) return Quiz.unregister() 33 | return await enableKeyboardCollectorQuizGame(Quiz.message, correctAnswer.answer, Quiz, question) 34 | } -------------------------------------------------------------------------------- /src/classes/index.js: -------------------------------------------------------------------------------- 1 | import { Models } from './database/Models.js' 2 | import Database from './database/Database.js' 3 | import SaphireClient from './saphire/client.saphire.js' 4 | import Autocomplete from '../structures/classes/Autocomplete.js' 5 | import Base from '../structures/classes/Base.js' 6 | import Modals from '../structures/classes/Modals.js' 7 | import SlashCommandInteraction from '../structures/classes/SlashCommand.js' 8 | import ButtonInteraction from '../structures/classes/ButtonInteraction.js' 9 | import ModalInteraction from '../structures/classes/ModalInteraction.js' 10 | import SelectMenuInteraction from '../structures/classes/SelectMenuInteraction.js' 11 | import GiveawayManager from '../functions/update/giveaway/manager.giveaway.js' 12 | import Experience from './modules/Experience.js' 13 | import Logomarca from './games/Logomarca.js' 14 | import AfkManager from '../functions/update/afk/manager.afk.js' 15 | import TempCallManager from '../functions/update/tempcall/manager.tempcall.js' 16 | import ChestManager from '../functions/update/chest/manager.chest.js' 17 | import SpamManager from '../functions/update/spam/manager.spam.js' 18 | import { discloud } from 'discloud.app' 19 | 20 | export { 21 | Models, 22 | Autocomplete, 23 | Base, 24 | SlashCommandInteraction, 25 | ButtonInteraction, 26 | ModalInteraction, 27 | SelectMenuInteraction, 28 | Logomarca, 29 | Database, 30 | SaphireClient, 31 | discloud as Discloud, 32 | Modals, 33 | GiveawayManager, 34 | Experience, 35 | AfkManager, 36 | TempCallManager, 37 | ChestManager, 38 | SpamManager 39 | } -------------------------------------------------------------------------------- /src/classes/modules/errors/functions/createWebhook.errors.js: -------------------------------------------------------------------------------- 1 | export default 2 | async (channel, clientId, ErrorWebhookProfileIcon) => { 3 | return channel.createWebhook({ 4 | name: clientId, 5 | avatar: ErrorWebhookProfileIcon, 6 | reason: 'Nenhuma webhook encontrada' 7 | }) 8 | .catch(() => null) 9 | } -------------------------------------------------------------------------------- /src/classes/modules/errors/functions/reply.errors.js: -------------------------------------------------------------------------------- 1 | export default async (interaction, messageResponse) => { 2 | 3 | return await interaction.reply({ 4 | content: `${messageResponse}`.limit('MessageContent'), 5 | embeds: [], 6 | components: [] 7 | }) 8 | .catch(async () => await interaction.editReply({ 9 | content: `${messageResponse}`.limit('MessageContent'), 10 | embeds: [], 11 | components: [] 12 | })) 13 | .catch(async () => await interaction.followUp({ 14 | content: `${messageResponse}`.limit('MessageContent'), 15 | embeds: [], 16 | components: [], 17 | ephemeral: true 18 | }).catch(() => { })) 19 | } -------------------------------------------------------------------------------- /src/classes/modules/errors/process/uncaughtException.js: -------------------------------------------------------------------------------- 1 | export default async function (error, origin) { 2 | if (error?.code == 10062) return 3 | return console.log(error, origin) 4 | } -------------------------------------------------------------------------------- /src/classes/modules/errors/process/unhandledRejection.js: -------------------------------------------------------------------------------- 1 | import { Emojis as e } from '../../../../util/util.js' 2 | import { Config as config } from '../../../../util/Constants.js' 3 | import { SaphireClient as client } from '../../../index.js' 4 | 5 | export default async (reason) => { 6 | 7 | /** 8 | * 500 Internal Server Error 9 | * 10004 Unknown Guild 10 | * 10008 Unknown Message 11 | * 50035 Invalid Form Body (Error Handling Filter) 12 | * 50013 Missing Permissions 13 | * 11000 Duplicated Creating Document Mongoose - Ignore Error 14 | * 50001 DiscordAPIError: Missing Access 15 | * 10062 Unknow Interaction 16 | */ 17 | 18 | if ([500, 10004, 10008, 10062, 50001, "GuildMembersTimeout"].includes(reason?.code)) return 19 | console.log('unhandledRejection', reason) 20 | 21 | await client.users.fetch(config.ownerId) 22 | .then(user => { 23 | return user?.send({ 24 | embeds: [{ 25 | color: client.red, 26 | title: `${e.Loud} Report de Erro | Unhandled Rejection`, 27 | description: `\`\`\`js\n${reason.stack?.slice(0, 2000)}\`\`\``, 28 | footer: { text: `Error Code: ${reason.code || 0}` } 29 | }] 30 | }).catch(() => { }) 31 | }).catch(() => { }) 32 | 33 | return client.sendWebhook( 34 | process.env.WEBHOOK_ERROR_REPORTER, 35 | { 36 | username: "[Saphire] Unhandled Rejection Reporter", 37 | avatarURL: config.ErrorWebhookProfileIcon, 38 | embeds: [{ 39 | color: client.red, 40 | title: `${e.Loud} Report de Erro | Unhandled Rejection`, 41 | description: `\`\`\`js\n${reason.stack?.slice(0, 2000)}\`\`\``, 42 | footer: { text: `Error Code: ${reason.code || 0}` } 43 | }] 44 | } 45 | ) 46 | 47 | } -------------------------------------------------------------------------------- /src/classes/saphire/process.saphire.js: -------------------------------------------------------------------------------- 1 | import uncaughtException from "../modules/errors/process/uncaughtException.js" 2 | import unhandledRejection from "../modules/errors/process/unhandledRejection.js" 3 | 4 | process.on('unhandledRejection', unhandledRejection) 5 | 6 | process.on('uncaughtException', (error, origin) => { 7 | const ignore = ['ERR_IPC_CHANNEL_CLOSED'] 8 | if (ignore.includes(error.code)) return 9 | 10 | return uncaughtException(error, origin) 11 | }) 12 | 13 | process.on('exit', code => { 14 | console.log({ 15 | 1: "Host Disabled Application", 16 | 10: "No host name provided #6815", 17 | 11: "Bot is already online in another host", 18 | 12: "Mongoose Database Connection Failed", 19 | 13: "Cluster has been disconnected." 20 | }[code] || `[${code}] - Motivo de Queda Desconhecido`) 21 | }) -------------------------------------------------------------------------------- /src/classes/saphire/webhooks.saphire.js: -------------------------------------------------------------------------------- 1 | import { REST, Routes, WebhookClient } from "discord.js"; 2 | import { Config } from "../../util/Constants.js"; 3 | import fs from 'fs'; 4 | const avatar = fs.readFileSync('./src/images/webhooks/anime_reporter.png', { encoding: 'base64' }); 5 | const res = new REST().setToken(process.env.BOT_TOKEN_REQUEST); 6 | 7 | export default async channelId => { 8 | 9 | if (!channelId) return 10 | 11 | const webhook = await res.get(Routes.channelWebhooks(channelId)) 12 | .catch(error => console.log(error?.response?.data)) 13 | 14 | if (webhook && Array.isArray(webhook) && webhook.length) { 15 | const getter = webhook.find(w => w?.user?.id == Config.saphireApiId) 16 | if (getter) return new WebhookClient({ url: `https://discord.com/api/webhooks/${getter.id}/${getter.token}` }) 17 | } 18 | 19 | const newWebhook = await res.post(Routes.channelWebhooks(channelId), { 20 | body: { name: '[Quiz Manager] Questions Saver', avatar: `data:image/png;base64,${avatar}`, }, 21 | headers: { 'Content-Type': 'image/png' } 22 | }).catch(error => console.log(error.response.data)) 23 | 24 | if (!newWebhook) return 25 | return new WebhookClient({ url: `https://discord.com/api/webhooks/${newWebhook.id}/${newWebhook.token}` }) 26 | } -------------------------------------------------------------------------------- /src/functions/global/prototypes.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * ESSE SISTEMA DE PROTOTYPES FOI UMA GAMBIARRA FEITA POR PURA CURIOSIDADE PELOS SEGUINTES MEMBROS: 4 | * IDEALIZADOR DOS PROTOTYPES: JackSkelt#3063 - 904891162362519562 5 | * ESCRITA & CONSTRUÇÃO: Rody#1000 - 451619591320371213 / Gorniaky#2023 - 395669252121821227 6 | * IDEALIZADOR DO "clientPermissions": Seeker#2083 - 750714601284304986 7 | */ 8 | import { readdirSync } from 'fs' 9 | const files = readdirSync('./src/functions/global/prototypes').filter(fileName => fileName.endsWith('.js')) 10 | for (const file of files) import(`./prototypes/${file}`) -------------------------------------------------------------------------------- /src/functions/global/prototypes/Array.prototypes.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Função adicionada ao Array que pega um item aleatório do mesmo. 3 | */ 4 | Array.prototype.random = function (times = 0, repeat = false) { 5 | 6 | const newArray = []; 7 | 8 | if ((times || 1) > 1) { 9 | if (repeat) 10 | for (let i = 0; i < (times || 1); i++) 11 | newArray.push(this[~~(Math.random() * this.length)]); 12 | else { 13 | const originalArray = [...this]; 14 | for (let i = 0; i < (times || 1); i++) { 15 | if (!originalArray.length) break; 16 | const value = ~~(Math.random() * originalArray.length); 17 | newArray.push(originalArray[value]); 18 | originalArray.splice(value, 1); 19 | } 20 | } 21 | 22 | return newArray; 23 | } 24 | 25 | return this[~~(Math.random() * this.length)]; 26 | } 27 | 28 | /** 29 | * @returns Array randomizado 30 | */ 31 | Array.prototype.randomize = function () { 32 | return this.sort(() => Math.random() - Math.random()) 33 | } -------------------------------------------------------------------------------- /src/functions/global/prototypes/Channel.prototypes.js: -------------------------------------------------------------------------------- 1 | import { ChannelManager } from 'discord.js' 2 | 3 | ChannelManager.prototype.clientHasPermission = function (Permission) { 4 | return this.me.permissions.has(Permission, true) 5 | } -------------------------------------------------------------------------------- /src/functions/global/prototypes/Discord.prototypes.js: -------------------------------------------------------------------------------- 1 | import { BaseInteraction, InteractionType } from 'discord.js' 2 | 3 | BaseInteraction.prototype.isAutocomplete = function () { 4 | return this.type === InteractionType.ApplicationCommandAutocomplete 5 | } 6 | 7 | BaseInteraction.prototype.isModalSubmit = function () { 8 | return this.type === InteractionType.ModalSubmit 9 | } -------------------------------------------------------------------------------- /src/functions/global/prototypes/Guild.prototypes.js: -------------------------------------------------------------------------------- 1 | import { Guild } from 'discord.js' 2 | import { Database } from '../../../classes/index.js' 3 | import { PermissionsBitToString } from '../../../util/Constants.js' 4 | import { Emojis as e } from '../../../util/util.js' 5 | 6 | Guild.prototype.clientHasPermission = function (Permission) { 7 | return this.members.me.permissions.has(PermissionsBitToString[Permission], true) 8 | } 9 | 10 | Guild.prototype.getCoin = async function () { 11 | const guildData = await Database.getGuild(this.id) 12 | return guildData?.Moeda || `${e.Coin} Safiras` 13 | } 14 | 15 | Object.defineProperty(Guild.prototype, 'allMembers', { 16 | get: function () { 17 | return this.members.fetch() 18 | } 19 | }) -------------------------------------------------------------------------------- /src/functions/global/prototypes/GuildMember.prototypes.js: -------------------------------------------------------------------------------- 1 | import { GuildMember, PermissionFlagsBits } from 'discord.js' 2 | import { PermissionsBitToString } from '../../../util/Constants.js' 3 | 4 | GuildMember.prototype.memberPermissions = function (Permission) { 5 | return this.permissions.has(PermissionsBitToString[Permission], true) 6 | } 7 | 8 | GuildMember.prototype.isManageableBy = function (member) { 9 | if (this.id === this.guild.ownerId) return false 10 | if (this.id === member.id) return 11 | if (member.id === this.guild.ownerId) return true 12 | return member.roles.highest.comparePositionTo(this.roles.highest) > 0 13 | } 14 | 15 | GuildMember.prototype.isBannablebleBy = function (member) { 16 | return this.isManageableBy(member) && member.permissions.has(PermissionFlagsBits.BanMembers) 17 | } 18 | 19 | GuildMember.prototype.isKickableBy = function (member) { 20 | return this.isManageableBy(member) && member.permissions.has(PermissionFlagsBits.KickMembers) 21 | } 22 | 23 | GuildMember.prototype.isModeratableBy = function (member) { 24 | return this.isManageableBy(member) 25 | && member.permissions.has(PermissionFlagsBits.ModerateMembers) 26 | && !this.permissions.has(PermissionFlagsBits.Administrator) 27 | } 28 | 29 | Object.defineProperty(GuildMember.prototype, 'isAdm', { 30 | get: function () { 31 | return this.permissions.has(PermissionFlagsBits.Administrator, true) 32 | } 33 | }) -------------------------------------------------------------------------------- /src/functions/global/prototypes/Number.prototypes.js: -------------------------------------------------------------------------------- 1 | Number.prototype.currency = function (doNotsubstring = true) { 2 | const numberFormated = `${Intl.NumberFormat('pt-BR', { 3 | currency: 'BRL', 4 | style: 'currency' 5 | }).format(this)}` 6 | 7 | if (doNotsubstring) 8 | return `${numberFormated.slice(3)}`.slice(0, -3) 9 | 10 | return numberFormated.substring(0, numberFormated.length - 3) 11 | } 12 | 13 | Number.prototype.int = function () { 14 | return parseInt(this) 15 | } -------------------------------------------------------------------------------- /src/functions/global/prototypes/Roles.prototypes.js: -------------------------------------------------------------------------------- 1 | import { GuildMemberRoleManager } from 'discord.js' 2 | 3 | Object.defineProperty(GuildMemberRoleManager.prototype, 'lowest', { 4 | get: function () { 5 | return this.cache.reduce((prev, role) => (role.id !== role.guild.id && role.comparePositionTo(prev) < 0 ? role : prev), this.cache.first()); 6 | } 7 | }) -------------------------------------------------------------------------------- /src/functions/global/prototypes/User.prototypes.js: -------------------------------------------------------------------------------- 1 | import { Database, SaphireClient as client } from '../../../classes/index.js' 2 | import { Config as config } from '../../../util/Constants.js' 3 | import { User } from 'discord.js' 4 | 5 | User.prototype.isVip = async function () { 6 | 7 | const userData = await Database.getUser(this.id) 8 | if (!userData) return false 9 | 10 | if (userData?.Vip?.Permanent) return true 11 | const DateNow = userData?.Vip?.DateNow || null 12 | const TimeRemaing = userData?.Vip?.TimeRemaing || 0 13 | 14 | return TimeRemaing - (Date.now() - DateNow) > 0 15 | } 16 | 17 | User.prototype.isMod = async function () { 18 | const clientData = await Database.Client.findOne({ id: client.user.id }, 'Moderadores Administradores') || [] 19 | const staff = [...clientData?.Administradores, ...clientData?.Moderadores, config.ownerId] 20 | return staff.includes(this.id) 21 | } 22 | 23 | User.prototype.balance = async function () { 24 | 25 | const userData = await Database.getUser(this.id) 26 | 27 | if (!userData || !userData.Balance) return 0 28 | 29 | return parseInt(userData.Balance) || 0 30 | } 31 | 32 | User.prototype.color = async function () { 33 | 34 | const userData = await Database.getUser(this.id) 35 | if (!userData || !userData?.Color.Perm || !userData?.Color.Set) return client.blue 36 | 37 | return client.blue 38 | } -------------------------------------------------------------------------------- /src/functions/global/prototypes/interaction.prototypes.js: -------------------------------------------------------------------------------- 1 | import { BaseInteraction } from 'discord.js' 2 | 3 | Object.defineProperty(BaseInteraction.prototype, 'mention', { 4 | get: function () { 5 | const subCommand = this.options?.data[0]?.name 6 | if (subCommand) 7 | return `` 8 | return `` 9 | } 10 | }) -------------------------------------------------------------------------------- /src/functions/global/setIntervals.js: -------------------------------------------------------------------------------- 1 | import { Database } from '../../classes/index.js' 2 | import PollManager from '../update/polls/poll.manager.js' 3 | 4 | const pollInterval = () => setInterval(async () => { 5 | 6 | const polls = PollManager.Polls || [] 7 | if (!polls || !polls.length) return 8 | 9 | for await (let poll of polls) 10 | if (!poll.permanent && !Date.Timeout(poll?.TimeMs, poll?.DateNow)) 11 | return await PollManager.cancel(poll) 12 | 13 | }, 1000 * 10) 14 | 15 | export { pollInterval } -------------------------------------------------------------------------------- /src/functions/plugins/notify.js: -------------------------------------------------------------------------------- 1 | import { SaphireClient as client } from '../../classes/index.js' 2 | 3 | export default (logChannelId, type, msg) => { 4 | 5 | if (!logChannelId) return 6 | 7 | client.pushMessage({ 8 | method: "post", 9 | channelId: logChannelId, 10 | body: { 11 | method: "post", 12 | channelId: logChannelId, 13 | content: `🛰️ | **Global System Notification** | ${type}\n \n${msg}` 14 | } 15 | }) 16 | 17 | return 18 | } -------------------------------------------------------------------------------- /src/functions/update/index.js: -------------------------------------------------------------------------------- 1 | import { Database, Experience, SaphireClient as client } from '../../classes/index.js'; 2 | 3 | export default () => { 4 | 5 | setInterval(async () => { 6 | client.setCantadas() 7 | Experience.set() 8 | client.fanarts = await Database.Fanart.find() || [] 9 | }, 1000 * 60) 10 | 11 | setInterval(() => client.refreshStaff(), 1000 * 60 * 15) 12 | 13 | return 14 | } -------------------------------------------------------------------------------- /src/functions/update/reminder/src/edit.reminder.js: -------------------------------------------------------------------------------- 1 | import { StringSelectMenuInteraction } from "discord.js" 2 | import { Emojis as e } from "../../../../util/util.js" 3 | import { socket } from "../../../../websocket/websocket.js" 4 | import { Modals } from "../../../../classes/index.js" 5 | 6 | /** 7 | * @param { StringSelectMenuInteraction } interaction 8 | * @param { string | undefined } reminderId 9 | */ 10 | export default async (interaction, reminderId) => { 11 | 12 | if (!reminderId) 13 | return interaction.update({ 14 | content: `${e.DenyX} | O ID do lembrete não foi encontrado.`, 15 | components: [], embeds: [] 16 | }).catch(() => { }) 17 | 18 | const reminder = await socket?.timeout(1000)?.emitWithAck("getReminder", reminderId).catch(() => null) 19 | 20 | if (!reminder) 21 | return interaction.update({ 22 | content: `${e.Deny} | Lembrete não encontrado`, 23 | embeds: [], components: [] 24 | }).catch(() => { }) 25 | 26 | const date = Date.stringDate((reminder?.DateNow + reminder?.Time) - Date.now()) 27 | const message = reminder?.RemindMessage 28 | 29 | if (!date || !message || reminder?.Alerted) 30 | return interaction.update({ 31 | content: `${e.Deny} | Lembrete não encontrado ou já disparado`, 32 | embeds: [], components: [] 33 | }).catch(() => { }) 34 | 35 | return interaction.showModal(Modals.ReminderEdit(date, message, reminderId)) 36 | 37 | } -------------------------------------------------------------------------------- /src/functions/update/reminder/src/move.reminder.js: -------------------------------------------------------------------------------- 1 | import { StringSelectMenuInteraction } from "discord.js"; 2 | import { Emojis as e } from "../../../../util/util.js"; 3 | import { socket } from "../../../../websocket/websocket.js"; 4 | 5 | /** 6 | * @param { StringSelectMenuInteraction } interaction 7 | * @param { string | undefined } reminderId 8 | */ 9 | export default async (interaction, reminderId) => { 10 | 11 | if (!reminderId) 12 | return interaction.update({ 13 | content: `${e.DenyX} | O ID do lembrete não foi encontrado.`, 14 | components: [], embeds: [] 15 | }).catch(() => { }) 16 | 17 | const result = await socket?.timeout(1000)?.emitWithAck("moveReminder", { reminderId, guildId: interaction.guildId, channelId: interaction.channelId }).catch(() => "") 18 | 19 | if (result?.includes("error")) 20 | return interaction.update({ 21 | content: `${e.Animated.SaphirePanic} | Erro ao mover o lembrete.\n${e.bug} | \`${result}\``, 22 | embeds: [], components: [] 23 | }).catch(() => { }) 24 | 25 | const content = { 26 | "Not Found": `${e.DenyX} | Lembrete não encontrado.`, 27 | "Same Channel": `${e.Info} | Os canais são os mesmos.`, 28 | "Error to save reminder": `${e.bug} | Erro ao salvar os dados no banco de dados.`, 29 | "Success": `${e.CheckV} | Lembrete movido com sucesso.` 30 | }[result] || `${e.Animated.SaphireReading} | Nenhum resposta obtida.` 31 | 32 | return interaction.update({ content, embeds: [], components: [] }).catch(() => { }) 33 | } -------------------------------------------------------------------------------- /src/functions/update/reminder/src/remove.reminder.js: -------------------------------------------------------------------------------- 1 | import { StringSelectMenuInteraction } from "discord.js" 2 | import { Emojis as e } from "../../../../util/util.js" 3 | import { socket } from "../../../../websocket/websocket.js" 4 | 5 | /** 6 | * @param { StringSelectMenuInteraction } interaction 7 | * @param { string | undefined } reminderId 8 | */ 9 | export default async (interaction, reminderId) => { 10 | 11 | if (!reminderId) 12 | return interaction.update({ 13 | content: `${e.DenyX} | O ID do lembrete não foi encontrado.`, 14 | components: [], embeds: [] 15 | }).catch(() => { }) 16 | 17 | if (!socket?.connected) 18 | return interaction.update({ 19 | content: `${e.Animated.SaphirePanic} | A socket não está conectada com a API... Pode tentar novamente?`, 20 | components: [], embeds: [] 21 | }).catch(() => { }) 22 | 23 | socket?.send({ type: "removeReminder", id: reminderId }) 24 | 25 | return interaction.update({ content: `${e.CheckV} | Lembrete deletado com sucesso.`, embeds: [], components: [] }).catch(() => { }) 26 | } -------------------------------------------------------------------------------- /src/images/webhooks/anime_reporter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaphireBot/Bot/4ea5ea94db1c7a82e6fa049807242bd2532319cf/src/images/webhooks/anime_reporter.png -------------------------------------------------------------------------------- /src/structures/classes/Base.js: -------------------------------------------------------------------------------- 1 | import { Database, Modals, SaphireClient as client } from '../../classes/index.js' 2 | import * as Constants from '../../util/Constants.js' 3 | import * as fs from 'fs' 4 | 5 | export default class Base { 6 | constructor() { 7 | this.emojis = JSON.parse(fs.readFileSync('./JSON/emojis.json')) // Ideia por: Jack - 904891162362519562 8 | this.modals = Modals.modals 9 | this.client = client 10 | this.Database = Database 11 | this.config = Constants.Config 12 | this.Constants = Constants 13 | } 14 | } -------------------------------------------------------------------------------- /src/structures/classes/buttons/admin/functions/leave.admin.js: -------------------------------------------------------------------------------- 1 | import { SaphireClient as client } from "../../../../../classes/index.js"; 2 | import { ButtonInteraction, Routes } from "discord.js"; 3 | import { Emojis as e } from "../../../../../util/util.js"; 4 | 5 | /** 6 | * @param { ButtonInteraction } interaction 7 | */ 8 | export default async interaction => { 9 | 10 | const { customId, user } = interaction 11 | 12 | if (!client.admins.includes(user.id)) 13 | return interaction.reply({ 14 | content: `${e.Animated.SaphireSleeping} | Você não pode clicar aqui, cai fora.`, 15 | ephemeral: true 16 | }) 17 | 18 | const data = JSON.parse(customId) 19 | const guildId = data?.id 20 | 21 | await interaction.update({ content: `${e.Loading} | Saindo do servidor solicitado...`, components: [] }) 22 | 23 | 24 | const removedStatus = await fetch( 25 | `https://discord.com/api/v10/users/@me/guilds/${guildId}`, 26 | { 27 | method: "DELETE", 28 | headers: { authorization: `Bot ${process.env.DISCORD_TOKEN}` } 29 | } 30 | ) 31 | .then(res => res.status) 32 | .catch(err => err) 33 | 34 | if (removedStatus !== 204) 35 | return interaction.editReply({ content: `${e.DenyX} | Não foi possível sair do servidor.\n${e.bug} | \`${err}\`` }).catch(() => { }) 36 | 37 | return interaction.editReply({ content: `${e.CheckV} | Remoção concluída.` }).catch(() => { }) 38 | } -------------------------------------------------------------------------------- /src/structures/classes/buttons/admin/functions/removeGuild.admin.js: -------------------------------------------------------------------------------- 1 | import { ButtonInteraction, ButtonStyle } from "discord.js"; 2 | import { Emojis as e } from "../../../../../util/util.js"; 3 | 4 | /** 5 | * @param { ButtonInteraction } interaction 6 | */ 7 | export default async interaction => { 8 | 9 | const { customId, user } = interaction 10 | const data = JSON.parse(customId) 11 | const guildId = data?.id 12 | 13 | if (!guildId) 14 | return interaction.reply({ 15 | content: `${e.DenyX} | Nenhum ID de servidor foi definido.`, 16 | ephemeral: true 17 | }) 18 | 19 | const guildData = await fetch( 20 | `https://discord.com/api/v10/guilds/${guildId}`, 21 | { 22 | method: "GET", 23 | headers: { authorization: `Bot ${process.env.DISCORD_TOKEN}` } 24 | } 25 | ) 26 | .then(async res => await res.json()) 27 | .catch(() => null) 28 | 29 | if (!guildData || guildData?.code == 10004) 30 | return interaction.reply({ 31 | content: `${e.DenyX} | Os dados deste servidor não foram encontrado.`, 32 | ephemeral: true 33 | }) 34 | 35 | return interaction.reply({ 36 | content: `${e.QuestionMark} | Confirmar a minha saída do servidor?`, 37 | ephemeral: true, 38 | components: [ 39 | { 40 | type: 1, 41 | components: [ 42 | { 43 | type: 2, 44 | label: 'Remover', 45 | emoji: e.CheckV, 46 | custom_id: JSON.stringify({ c: 'admin', src: 'leave', id: guildId }), 47 | style: ButtonStyle.Danger 48 | } 49 | ] 50 | } 51 | ] 52 | }) 53 | 54 | } -------------------------------------------------------------------------------- /src/structures/classes/buttons/admin/redirect.admin.js: -------------------------------------------------------------------------------- 1 | import { SaphireClient as client } from "../../../../classes/index.js"; 2 | import { ButtonInteraction } from "discord.js"; 3 | import { Emojis as e } from "../../../../util/util.js"; 4 | import removeGuild from "./functions/removeGuild.admin.js"; 5 | import leave from "./functions/leave.admin.js"; 6 | 7 | /** 8 | * @param { ButtonInteraction } interaction 9 | */ 10 | export default interaction => { 11 | 12 | const { customId, user } = interaction 13 | 14 | if (!client.admins.includes(user.id)) 15 | return interaction.reply({ 16 | content: `${e.DenyX} | Apenas os administradores do meu sistema pode usar este recurso.`, 17 | ephemeral: true 18 | }) 19 | 20 | const data = JSON.parse(customId || {}) 21 | 22 | if (!data?.src) 23 | return interaction.reply({ 24 | content: `${e.DenyX} | Nenhum recurso de sub-função encontrado. #6486341210`, 25 | ephemeral: true 26 | }) 27 | 28 | const execute = { removeGuild, leave }[data.src] 29 | if (execute) return execute(interaction) 30 | 31 | return interaction.reply({ 32 | content: `${e.DenyX} | Nenhum função foi encontrada para este botão.`, 33 | ephemeral: true 34 | }) 35 | } -------------------------------------------------------------------------------- /src/structures/classes/buttons/amongus/cancel.amongus.js: -------------------------------------------------------------------------------- 1 | import deleteParty from "./delete.amongus.js" 2 | 3 | export default async ({ partyData, interaction, e, partyId, user, gameData }) => { 4 | 5 | if (!partyData) { 6 | deleteParty(partyId) 7 | return await interaction.update({ content: `${e.Deny} | Jogo não encontrado.`, embeds: [], components: [] }).catch(() => { }) 8 | } 9 | 10 | if (partyData.host !== user.id) 11 | return await interaction.reply({ 12 | content: `${e.Deny} | Apenas o Host <@${partyData.host}> pode cancelar este jogo.`, 13 | ephemeral: true 14 | }) 15 | 16 | deleteParty(partyId) 17 | await interaction.update({ 18 | content: `${e.Check} | O jogo \`${partyId}\` foi deletado com sucesso.`, 19 | embeds: [], 20 | components: [] 21 | }).catch(() => { }) 22 | 23 | if (gameData.inMute.length) 24 | return await interaction.channel.send({ 25 | content: `${e.Animated.SaphirePanic} | A NÃÃÃO, ${gameData.inMute.map(id => `<@${id}>`).join(', ')} saiu da call e continua mutado. Alguém desmuta ele aí por favor.` 26 | }) 27 | } -------------------------------------------------------------------------------- /src/structures/classes/buttons/amongus/copy.amongus.js: -------------------------------------------------------------------------------- 1 | export default async ({ interaction, partyData, channel, user }) => { 2 | return await interaction.reply({ 3 | content: channel.members.has(user.id) 4 | ? `${partyData.invite || "Código não encontrado"}` 5 | : `${e.Deny} | Você tem que estar no canal ${channel} para poder jogar.`, 6 | ephemeral: true 7 | }) 8 | } -------------------------------------------------------------------------------- /src/structures/classes/buttons/amongus/delete.amongus.js: -------------------------------------------------------------------------------- 1 | import { Database } from "../../../../classes/index.js" 2 | 3 | export default async (partyId = '0') => await Database.Cache.AmongUs.delete(partyId) -------------------------------------------------------------------------------- /src/structures/classes/buttons/amongus/mute.amongus.js: -------------------------------------------------------------------------------- 1 | import { DiscordPermissons, PermissionsTranslate } from "../../../../util/Constants.js" 2 | import deleteParty from "./delete.amongus.js" 3 | 4 | export default async ({ interaction, partyId, channel, gameData, e, guild, Database, user }) => { 5 | 6 | if (user.id !== gameData.host) 7 | return await interaction.reply({ 8 | content: `${e.Deny} | Apenas o Host <@${gameData.host}> pode mutar e desmutar os membros da call.`, 9 | ephemeral: true 10 | }) 11 | 12 | if (!guild.members.me.permissions.has(DiscordPermissons.MuteMembers, true)) { 13 | deleteParty(partyId) 14 | return await interaction.update({ 15 | content: `${e.Deny} | Eu estou sem a permissão de **\`${PermissionsTranslate.MuteMembers}\`**, eu deleitei o jogo só de raiva.` 16 | }).catch(() => { }) 17 | } 18 | 19 | const members = channel.members.filter(member => 20 | [...gameData.players, ...gameData.deaths].includes(member.id) 21 | && !member.voice.serverMute 22 | ) 23 | 24 | if (!members.size) 25 | return await interaction.deferUpdate() 26 | 27 | const { message } = interaction 28 | const embed = message?.embeds[0]?.data 29 | 30 | let muteds = 0 31 | 32 | members.forEach(async member => { 33 | muteds++ 34 | member.voice.setMute(true, 'Among Us Party').catch(() => muteds--) 35 | await registerMute(member.id) 36 | }) 37 | 38 | embed.fields[2].value = `${e.Check} Partida Iniciada\n<@${gameData.host}> silencou ${muteds} jogadores` 39 | return await interaction.update({ embeds: [embed] }).catch(() => { }) 40 | 41 | async function registerMute(userId) { 42 | await Database.Cache.AmongUs.push(`${partyId}.inMute`, userId) 43 | } 44 | 45 | } -------------------------------------------------------------------------------- /src/structures/classes/buttons/amongus/unmute.amongus.js: -------------------------------------------------------------------------------- 1 | import { DiscordPermissons, PermissionsTranslate } from "../../../../util/Constants.js" 2 | import deleteParty from "./delete.amongus.js" 3 | 4 | export default async ({ interaction, partyId, channel, gameData, e, guild, Database, user }) => { 5 | 6 | if (user.id !== gameData.host) 7 | return await interaction.reply({ 8 | content: `${e.Deny} | Apenas o Host <@${gameData.host}> pode mutar e desmutar os membros da call.`, 9 | ephemeral: true 10 | }) 11 | 12 | if (!guild.members.me.permissions.has(DiscordPermissons.MuteMembers, true)) { 13 | deleteParty(partyId) 14 | return await interaction.update({ 15 | content: `${e.Deny} | Eu estou sem a permissão de **\`${PermissionsTranslate.MuteMembers}\`**, eu deleitei o jogo só de raiva.` 16 | }).catch(() => { }) 17 | } 18 | 19 | const members = channel.members.filter(member => gameData.players.includes(member.id)) 20 | 21 | if (!members.size) 22 | return await interaction.deferUpdate() 23 | 24 | const { message } = interaction 25 | const embed = message?.embeds[0]?.data 26 | 27 | let unmuteds = 0 28 | 29 | members.forEach(async member => { 30 | unmuteds++ 31 | member.voice.setMute(false, 'Among Us Party').catch(() => unmuteds--) 32 | await unregisterMute(member.id) 33 | }) 34 | 35 | embed.fields[2].value = `${e.Check} Partida Iniciada\n<@${gameData.host}> desmutou ${unmuteds} jogadores` 36 | return await interaction.update({ embeds: [embed] }).catch(() => { }) 37 | 38 | async function unregisterMute(userId) { 39 | await Database.Cache.AmongUs.pull(`${partyId}.inMute`, userId) 40 | } 41 | 42 | } -------------------------------------------------------------------------------- /src/structures/classes/buttons/anime/index.anime.js: -------------------------------------------------------------------------------- 1 | import { Modals } from "../../../../classes/index.js" 2 | import refreshAnime from "./refresh.anime.js" 3 | import infoAnime from "./info.anime.js" 4 | import deleteAnime from "./delete.anime.js" 5 | import voteAnime from "./vote.anime.js" 6 | import sendOrCancelAnime from "./sendOrCancel.anime.js" 7 | 8 | export default async (interaction, { src: customId }) => { 9 | 10 | if (customId === 'indicate') 11 | return await interaction.showModal(Modals.indicateAnime()) 12 | 13 | if (customId === 'refresh') 14 | return refreshAnime(interaction) 15 | 16 | if (customId === 'info') 17 | return infoAnime(interaction) 18 | 19 | if (customId === 'delete') 20 | return deleteAnime(interaction) 21 | 22 | if (['up', 'down'].includes(customId)) 23 | return voteAnime(interaction, customId) 24 | 25 | if (['cancel', 'send'].includes(customId)) 26 | return sendOrCancelAnime(interaction, customId) 27 | 28 | } -------------------------------------------------------------------------------- /src/structures/classes/buttons/anime/info.anime.js: -------------------------------------------------------------------------------- 1 | import { Emojis as e } from "../../../../util/util.js" 2 | import searchAnime from "../../../commands/functions/anime/search.anime.js" 3 | 4 | export default async interaction => { 5 | 6 | const { message } = interaction 7 | const { embeds } = message 8 | const embed = embeds[0]?.data 9 | 10 | if (!embed) 11 | return await interaction.update({ 12 | content: `${e.Deny} | Embed não encontrada.`, 13 | components: [] 14 | }) 15 | 16 | const animeName = embed.fields[0]?.value 17 | 18 | if (!animeName) 19 | return await interaction.update({ 20 | content: `${e.Deny} | Nome do anime não encontrado.`, 21 | components: [] 22 | }) 23 | 24 | return searchAnime(interaction, animeName) 25 | 26 | 27 | } -------------------------------------------------------------------------------- /src/structures/classes/buttons/bet/index.bet.js: -------------------------------------------------------------------------------- 1 | import chooiseBet from "./dice/chooise.bet.js" 2 | import multiplier from './multiplier/redirect.multiplier.js' 3 | 4 | export default async (data, commandData) => { 5 | 6 | const execute = { 7 | dice: chooiseBet, 8 | multi: multiplier 9 | }[commandData?.src] 10 | 11 | if (!execute) 12 | return await data.interaction.reply({ 13 | content: `${data.e.Deny} | Sub-função não encontrada. \`#154874\`` 14 | }) 15 | 16 | return execute(data, commandData) 17 | 18 | } -------------------------------------------------------------------------------- /src/structures/classes/buttons/bet/multiplier/explode.multiplier.js: -------------------------------------------------------------------------------- 1 | import { Database, SaphireClient as client } from "../../../../../classes/index.js"; 2 | import { ButtonInteraction, ButtonStyle } from "discord.js"; 3 | import { Emojis as e } from "../../../../../util/util.js"; 4 | 5 | /** 6 | * @param { ButtonInteraction } interaction 7 | */ 8 | export default async interaction => { 9 | 10 | const { user, message } = interaction 11 | 12 | const components = generateButtonsExploded() 13 | await Database.Cache.Multiplier.delete(`${user.id}.${message.id}.prize`) 14 | 15 | const embed = message.embeds[0]?.data 16 | embed.color = client.red 17 | embed.fields.push({ 18 | name: `${e.Animated.SaphireCry} Perdeeeeu`, 19 | value: 'É uma pena, mas você acabou de perder todo o seu dinheiro apostado.' 20 | }) 21 | 22 | return interaction.editReply({ embeds: [embed], components }).catch(() => { }) 23 | 24 | function generateButtonsExploded() { 25 | const components = [ 26 | message.components[0].toJSON(), 27 | message.components[1].toJSON(), 28 | message.components[2].toJSON(), 29 | message.components[3].toJSON(), 30 | message.components[4].toJSON() 31 | ] 32 | 33 | for (const row of components) 34 | for (const button of row.components) { 35 | const customId = JSON.parse(button.custom_id) 36 | button.disabled = true 37 | if (customId?.id == 'finish') continue 38 | button.style = button.custom_id == interaction.customId 39 | ? ButtonStyle.Danger 40 | : button.style 41 | button.emoji = customId.e == 1 42 | ? button.custom_id == interaction.customId ? '💥' : '💣' 43 | : '💎' 44 | } 45 | 46 | return components 47 | } 48 | } -------------------------------------------------------------------------------- /src/structures/classes/buttons/bet/multiplier/multi.multiplier.js: -------------------------------------------------------------------------------- 1 | import { StringSelectMenuInteraction } from "discord.js"; 2 | import { Emojis as e } from "../../../../../util/util.js"; 3 | import { Database } from "../../../../../classes/index.js"; 4 | 5 | /** 6 | * @param { StringSelectMenuInteraction } interaction 7 | */ 8 | export default async interaction => { 9 | 10 | const { values, message, user } = interaction 11 | 12 | if (user.id !== message.interaction.user.id) 13 | return interaction.reply({ 14 | content: `${e.Animated.SaphireQuestion} | Eu acho que você não pode clicar aqui, ok?`, 15 | ephemeral: true 16 | }) 17 | 18 | const content = message.content 19 | const components = [message.components[0].toJSON(), message.components[1].toJSON()] 20 | const embed = message.embeds[0]?.data 21 | 22 | await interaction.update({ content: `${e.Loading} | Buscando, alterando e salvando o multiplicador`, components: [] }).catch(() => { }) 23 | const data = await Database.Cache.Multiplier.get(`${user.id}.${message.id}`) 24 | 25 | if (!data) 26 | return interaction.editReply({ 27 | content: `${e.Animated.SaphireCry} | Os dados desse jogo não foi encontrado.`, 28 | embeds: [] 29 | }).catch(() => { }) 30 | 31 | /** 32 | * @type { 1 ... 24 } 33 | */ 34 | const value = Number(values[0]) 35 | await Database.Cache.Multiplier.set(`${user.id}.${message.id}.mines`, value) 36 | await Database.Cache.Multiplier.set(`${user.id}.${message.id}.multiplierValue`, data.value * (value * 0.041666666)) 37 | embed.fields[1] = { name: '💣 Número de Minas', value: `${value} minas -> x${(value * 0.041666666).toFixed(3)}` } 38 | components[1].components[1].disabled = false 39 | 40 | return interaction.editReply({ content, components, embeds: [embed] }).catch(() => { }) 41 | 42 | } -------------------------------------------------------------------------------- /src/structures/classes/buttons/bet/multiplier/redirect.multiplier.js: -------------------------------------------------------------------------------- 1 | import { Emojis as e } from "../../../../../util/util.js" 2 | import ButtonInteraction from "../../../ButtonInteraction.js" 3 | import SelectMenuInteraction from "../../../SelectMenuInteraction.js" 4 | import cancel from './cancel.multiplier.js' 5 | import init from "./init.multiplier.js" 6 | import multi from './multi.multiplier.js' 7 | import game from './game.multiplier.js' 8 | 9 | /** 10 | * @param { ButtonInteraction | SelectMenuInteraction } data 11 | * @param { { 12 | * c: 'bet', 13 | * src: 'multi', 14 | * id: String | null, 15 | * type: String 16 | * } } commandData 17 | */ 18 | export default async (data, commandData) => { 19 | 20 | const { interaction, user, message } = data 21 | 22 | if (user.id !== message.interaction?.user.id) 23 | return interaction.reply({ 24 | content: `${e.DenyX} | No no no, você não pode clicar aqui. Cai fora!`, 25 | ephemeral: true 26 | }) 27 | 28 | const execute = { 29 | cancel, 30 | multi, 31 | init, 32 | game 33 | }[commandData?.type] 34 | 35 | if (execute) return execute(interaction, commandData) 36 | 37 | return interaction.update({ 38 | content: `${e.Animated.SaphireCry} | Nada foi encontrado pra esse botão... #168348354000`, 39 | embeds: [], components: [], ephemeral: true 40 | }).catch(() => { }) 41 | } -------------------------------------------------------------------------------- /src/structures/classes/buttons/blackjack/functions/stand.blackjack.js: -------------------------------------------------------------------------------- 1 | import { Database } from '../../../../../classes/index.js' 2 | import { Emojis as e } from '../../../../../util/util.js' 3 | 4 | export default async (interaction, message, gameData) => { 5 | 6 | const { user } = interaction 7 | const { embeds } = message 8 | const embed = embeds[0]?.data 9 | let atualValue = [...gameData.pickUpHand, ...gameData.hand].reduce((acc, card) => acc += card.value, 0) 10 | 11 | gameData.hand.push(...gameData.pickUpHand) 12 | gameData.pickUpHand = [] 13 | 14 | embed.fields[1].value = `\`${atualValue}/21\` - ${user.username}\n\`${gameData.dealerHand[0].value}/21\` - ${e.Loading} Dealer...` 15 | const content = message.content + '\n' + gameData.dealerHand.map(card => card?.emoji).join('') 16 | 17 | await Database.Cache.Blackjack.set(message.id, gameData) 18 | 19 | await interaction.update({ 20 | content: content, 21 | embeds: [embed], 22 | components: [] 23 | }) 24 | 25 | return setTimeout(() => import('./dealer.blackjack.js').then(dealer => dealer.default(interaction, message, gameData)), 3000) 26 | } -------------------------------------------------------------------------------- /src/structures/classes/buttons/blackjack/functions/upcard.blackjack.js: -------------------------------------------------------------------------------- 1 | import { Emojis as e } from '../../../../../util/util.js' 2 | import { 3 | SaphireClient as client, 4 | Database 5 | } from '../../../../../classes/index.js' 6 | 7 | export default async (interaction, message, gameData) => { 8 | 9 | const { user, guild } = interaction 10 | const { embeds } = message 11 | const embed = embeds[0]?.data 12 | const cardRandom = getCard() 13 | let atualValue = 0 14 | 15 | gameData.pickUpHand.push(cardRandom) 16 | const content = gameData.hand.map(card => card.emoji).join('') + gameData.pickUpHand.map(card => card?.emoji).join('') 17 | 18 | for (let card of [...gameData.pickUpHand, ...gameData.hand]) 19 | atualValue += card.value 20 | 21 | embed.fields[1].value = `\`${gameData.hand[0].value}/21\` -> \`${atualValue}/21\` - ${user.username}` 22 | 23 | let components = message.components[0].toJSON() 24 | components.components[1].disabled = false 25 | 26 | if (atualValue > 21) { 27 | embed.color = client.red 28 | components = null 29 | embed.fields[2].value = embed.fields[2].value + ` -> 0 ${await guild.getCoin()}` 30 | embed.fields[3] = { 31 | name: `${e.Deny} Passou de 21`, 32 | value: `Você estorou o limite de 21 pontos e perdeu o jogo.` 33 | } 34 | await Database.Cache.Blackjack.delete(message.id) 35 | } 36 | else await Database.Cache.Blackjack.set(message.id, gameData) 37 | 38 | return await interaction.update({ 39 | content: content, 40 | embeds: [embed], 41 | components: components === null ? [] : [components] 42 | }) 43 | 44 | function getCard() { 45 | const randomNumber = Math.floor(Math.random() * gameData.cards.length) 46 | const spliced = gameData.cards.splice(randomNumber, 1) 47 | return spliced[0] 48 | } 49 | 50 | } -------------------------------------------------------------------------------- /src/structures/classes/buttons/blackjack/game.blackjack.js: -------------------------------------------------------------------------------- 1 | import { Database } from '../../../../classes/index.js' 2 | import { Emojis as e } from '../../../../util/util.js' 3 | 4 | export default async (interaction, customId) => { 5 | 6 | const { message, user } = interaction 7 | const commandAuthorId = message.interaction.user.id 8 | 9 | if (user.id !== commandAuthorId) return 10 | 11 | const gameData = await Database.Cache.Blackjack.get(message.id) 12 | 13 | if (!gameData) 14 | return await interaction.update({ 15 | content: `${e.Deny} | Jogo não encontrado ou resgatado.`, 16 | embeds: [], 17 | components: [] 18 | }) 19 | 20 | const embed = message.embeds[0]?.data 21 | 22 | if (!embed) { 23 | Database.add(gameData.userId, gameData.bet, `${e.gain} Recebeu ${gameData.bet} Safiras via *Blackjack Refund*`) 24 | await Database.Cache.Blackjack.delete(message.id) 25 | return await interaction.update({ 26 | content: `${e.Deny} | Embed do jogo não encontrada.`, 27 | embeds: [], 28 | components: [] 29 | }) 30 | } 31 | 32 | switch (customId) { 33 | case 'upcard': import('./functions/upcard.blackjack.js').then(upcard => upcard.default(interaction, message, gameData)); break; 34 | case 'stand': import('./functions/stand.blackjack.js').then(stand => stand.default(interaction, message, gameData)); break; 35 | } 36 | 37 | return 38 | } -------------------------------------------------------------------------------- /src/structures/classes/buttons/blackjack/game.blackjack.multiplayer.js: -------------------------------------------------------------------------------- 1 | import { Database } from '../../../../classes/index.js' 2 | import { Emojis as e } from '../../../../util/util.js' 3 | 4 | export default async (interaction, customId) => { 5 | 6 | const { message, user } = interaction 7 | const commandAuthorId = message.interaction.user.id 8 | 9 | if (user.id === commandAuthorId) return 10 | 11 | const gameData = await Database.Cache.Blackjack.get(message.id) 12 | 13 | if (!gameData) 14 | return await interaction.update({ 15 | content: `${e.Deny} | Jogo não encontrado ou resgatado.`, 16 | embeds: [], 17 | components: [] 18 | }) 19 | 20 | const embed = message.embeds[0]?.data 21 | 22 | if (!embed) { 23 | client.emit('blackjackRefund', gameData) 24 | return await interaction.update({ 25 | content: `${e.Deny} | Embed do jogo não encontrada.`, 26 | embeds: [], 27 | components: [] 28 | }) 29 | } 30 | 31 | switch (customId) { 32 | case 'deny': import('./functions/deny.blackjack.js').then(deny => deny.default(interaction, message, gameData)); break; 33 | case 'accept': import('./functions/accept.blackjack.js').then(deny => deny.default(interaction, message, gameData)); break; 34 | } 35 | 36 | return 37 | } -------------------------------------------------------------------------------- /src/structures/classes/buttons/cantadas/accept.cantada.js: -------------------------------------------------------------------------------- 1 | import { 2 | Database, 3 | SaphireClient as client 4 | } from "../../../../classes/index.js" 5 | import deny from './deny.cantada.js' 6 | import pull from './pull.cantada.js' 7 | 8 | export default async (cantadaId, prhase, commandData, user, interaction, embed) => { 9 | 10 | if (client.cantadas.find(c => c.id === cantadaId || c.phrase == prhase)) 11 | return deny(embed, true, interaction, cantadaId) 12 | 13 | new Database.Cantadas({ 14 | id: cantadaId, 15 | phrase: prhase, 16 | acceptedFor: user.id, 17 | userId: commandData.userId 18 | }).save() 19 | 20 | client.cantadas.push({ 21 | id: cantadaId, 22 | phrase: prhase, 23 | acceptedFor: user.id, 24 | userId: commandData.userId 25 | }) 26 | 27 | embed.color = client.green 28 | embed.fields.push({ 29 | name: 'Cantada aceita', 30 | value: 'Esta cantada foi aceita e validada no banco de dados' 31 | }) 32 | 33 | await interaction.update({ 34 | embeds: [embed], 35 | components: [] 36 | }).catch(() => { }) 37 | 38 | return pull(cantadaId, interaction) 39 | } -------------------------------------------------------------------------------- /src/structures/classes/buttons/cantadas/deny.cantada.js: -------------------------------------------------------------------------------- 1 | import { SaphireClient as client } from '../../../../classes/index.js' 2 | import pull from './pull.cantada.js' 3 | 4 | export default async (embed, exist, interaction, cantadaId) => { 5 | 6 | embed.color = client.red 7 | embed.fields.push({ 8 | name: 'Cantada recusada', 9 | value: exist 10 | ? 'Esta cantada já existe no banco de dados' 11 | : 'Esta cantada foi recusada e retirada do banco de dados' 12 | }) 13 | 14 | await interaction.update({ embeds: [embed], components: [] }).catch(() => { }) 15 | return pull(cantadaId, interaction) 16 | } -------------------------------------------------------------------------------- /src/structures/classes/buttons/cantadas/pull.cantada.js: -------------------------------------------------------------------------------- 1 | import { ButtonStyle } from "discord.js" 2 | import { 3 | SaphireClient as client, 4 | Database 5 | } from "../../../../classes/index.js" 6 | import { Emojis as e } from "../../../../util/util.js" 7 | 8 | export default async (cantadaId, interaction) => { 9 | 10 | const clientData = await Database.Client.findOneAndUpdate( 11 | { id: client.user.id }, 12 | { $pull: { CantadasIndicadas: { cantadaId } } }, 13 | { upsert: true, new: true, fields: 'CantadasIndicadas' } 14 | ) 15 | 16 | const remains = clientData.CantadasIndicadas || [] 17 | 18 | if (!remains.length) 19 | return await interaction.editReply({ 20 | content: `${e.Deny} | Não existe mais nenhuma cantada para análise.`, 21 | components: [] 22 | }).catch(() => { }) 23 | 24 | return await interaction.editReply({ 25 | components: [ 26 | { 27 | type: 1, 28 | components: [ 29 | { 30 | type: 2, 31 | label: 'Avaliar próxima cantada', 32 | custom_id: JSON.stringify({ c: 'cantada', src: 'next', cId: remains?.random()?.cantadaId || null }), 33 | style: ButtonStyle.Primary 34 | } 35 | ] 36 | } 37 | ] 38 | }) 39 | } -------------------------------------------------------------------------------- /src/structures/classes/buttons/channel/channel.index.js: -------------------------------------------------------------------------------- 1 | import { Emojis as e } from "../../../../util/util.js" 2 | import deleteChannel from "./delete.channel.js" 3 | 4 | export default async (interaction, { src, id }) => { 5 | 6 | const execute = { 7 | delete: deleteChannel 8 | }[src] 9 | 10 | if (!execute) 11 | return await interaction.update({ 12 | content: `${e.Deny} | Nenhuma SubButtonFunction.exec() encontrada.` 13 | }).catch(() => { }) 14 | 15 | return execute(interaction, { src, id }) 16 | } -------------------------------------------------------------------------------- /src/structures/classes/buttons/channel/delete.channel.js: -------------------------------------------------------------------------------- 1 | import { Emojis as e } from "../../../../util/util.js" 2 | 3 | export default async (interaction, { src, id }) => { 4 | 5 | const { guild, user, message } = interaction 6 | 7 | if (user.id !== message.interaction.user.id) return 8 | 9 | if (src === 'cancel') 10 | return await interaction.update({ 11 | content: `${e.Deny} | Comando cancelado.`, 12 | components: [] 13 | }).catch(() => { }) 14 | 15 | const channel = guild.channels.cache.get(id) 16 | 17 | if (!channel) 18 | return await interaction.update({ 19 | content: `${e.Deny} | Canal não encontrado.`, 20 | components: [] 21 | }).catch(() => { }) 22 | 23 | const fail = await channel.delete(`${user.username} solicitou a exclusão deste canal.`) 24 | .catch(err => err.code) 25 | 26 | if (fail.constructor === Number) { 27 | 28 | const content = { 29 | 50074: `${e.Deny} | Não é possível deletar canais configurados na comunidade.`, 30 | 10003: `${e.Deny} | Este canal é desconhecido. Por favor, tente em outro canal.`, 31 | 50024: `${e.Deny} | Essa ação não pode ser executada nesse tipo de canal.` 32 | }[fail] || `${e.Deny} | Não foi possível deletar o canal ${channel}.` 33 | 34 | return await interaction.update({ content, components: [] }).catch(() => { }) 35 | } 36 | 37 | if (!interaction.channel?.id || interaction.channel?.id === channel?.id) return 38 | return await interaction.update({ 39 | content: `${e.Check} | O canal **${channel?.name}** foi deletado com sucesso.`, 40 | components: [] 41 | }).catch(() => { }) 42 | } -------------------------------------------------------------------------------- /src/structures/classes/buttons/corrida/reset.corrida.js: -------------------------------------------------------------------------------- 1 | import { 2 | SaphireClient as client, 3 | Database 4 | } from "../../../../classes/index.js" 5 | import { Emojis as e } from "../../../../util/util.js" 6 | 7 | export default async interaction => { 8 | 9 | const { channel } = interaction 10 | await Database.Cache.Running.pull(`${client.shardId}.Channels`, channel.id) 11 | 12 | return await interaction.update({ 13 | content: `${e.Check} | Canal resetado com sucesso.`, 14 | components: [] 15 | }).catch(() => { }) 16 | } -------------------------------------------------------------------------------- /src/structures/classes/buttons/donate/copyPix.donate.js: -------------------------------------------------------------------------------- 1 | import { Emojis as e } from "../../../../util/util.js" 2 | 3 | export default async (interaction, commandData) => { 4 | 5 | const { id, src } = commandData 6 | 7 | if (src === 'nubank') 8 | return await interaction.reply({ 9 | content: '00020126620014BR.GOV.BCB.PIX0114+55119819899640222Saphire Project Donate5204000053039865802BR5920Rodrigo Couto Santos6009SAO PAULO61080540900062180514SaphireProject6304E10B', 10 | ephemeral: true 11 | }) 12 | 13 | } -------------------------------------------------------------------------------- /src/structures/classes/buttons/jokempo/global/webhook.jokempo.js: -------------------------------------------------------------------------------- 1 | import { Routes } from "discord.js" 2 | import { SaphireClient as client } from '../../../../../classes/index.js' 3 | import { Config } from "../../../../../util/Constants.js" 4 | 5 | export default async channelId => { 6 | 7 | const webhook = await client.rest.get(Routes.channelWebhooks(channelId)).catch(() => null) 8 | 9 | if (webhook && Array.isArray(webhook) && webhook.length) { 10 | const getter = webhook.find(w => w?.user?.id == client.user.id) 11 | if (getter) return `https://discord.com/api/webhooks/${getter.id}/${getter.token}` 12 | } 13 | 14 | const newWebhook = await client.rest.post(Routes.channelWebhooks(channelId), { 15 | body: { 16 | name: 'Saphire Jokempo Global System', 17 | avatar: `${Config.WebhookJokempoIcon}`, 18 | } 19 | }).catch(() => null) 20 | 21 | if (!newWebhook) return null 22 | return `https://discord.com/api/webhooks/${newWebhook.id}/${newWebhook.token}` 23 | } -------------------------------------------------------------------------------- /src/structures/classes/buttons/jokempo/local/check.jokempo.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @param { { 'userId1': '👊' | '🤚' | '✌️', 'userId2': '👊' | '🤚' | '✌️' } } clicksData 3 | */ 4 | export default (clicksData) => { 5 | 6 | const clicks = Object.entries(clicksData) // [["string", "emoji" | null], ["string", "emoji" | null]] 7 | if (clicks[0][1] == clicks[1][1]) return 'draw' 8 | 9 | const variables = [ 10 | ['👊', '✌️'], 11 | ['🤚', '👊'], 12 | ['✌️', '🤚'] 13 | ] 14 | 15 | for (const conditional of variables) 16 | if ( 17 | conditional[0] == clicks[0][1] 18 | && conditional[1] == clicks[1][1] 19 | ) return clicks[0] 20 | 21 | return clicks[1] 22 | } -------------------------------------------------------------------------------- /src/structures/classes/buttons/jokempo/local/clientPlay.jokempo.js: -------------------------------------------------------------------------------- 1 | import { ButtonInteraction } from "discord.js" 2 | import { Database, SaphireClient as client } from "../../../../../classes/index.js" 3 | import { Emojis as e } from "../../../../../util/util.js" 4 | 5 | /** 6 | * @param { ButtonInteraction } interaction 7 | * @param { "stone | scissors | paper" } click 8 | */ 9 | export default async (interaction, click) => { 10 | 11 | const botChoice = { stone: 'paper', scissors: 'stone', paper: 'scissors' }[click] 12 | const emoji = choice => { 13 | return { stone: '👊', scissors: '✌️', paper: '🤚' }[choice] 14 | } 15 | 16 | await Database.Cache.Jokempo.delete(interaction.message.id) 17 | 18 | return interaction.update({ 19 | content: null, 20 | embeds: [{ 21 | color: client.blue, 22 | title: '✌️ Jokempo', 23 | description: `${e.amongusdance} ${client.user} ganhou jogando ${emoji(botChoice)}\n${e.amongusdeath} ${interaction.user} perdeu jogando ${emoji(click)}`, 24 | fields: [ 25 | { 26 | name: `${e.Animated.SaphireSleeping} Inocente`, 27 | value: 'Você realmente pensou que poderia ganhar de mim?' 28 | } 29 | ] 30 | }], 31 | components: [] 32 | }).catch(() => { }) 33 | 34 | } -------------------------------------------------------------------------------- /src/structures/classes/buttons/memoryGame/disable.memory.js: -------------------------------------------------------------------------------- 1 | export default async (interaction, components) => { 2 | 3 | const { message } = interaction 4 | if (!message) return 5 | 6 | const allButtons = components.map(row => row.components).flat() 7 | 8 | for (let b of allButtons) { 9 | b.disabled = true 10 | b.emoji = JSON.parse(b.custom_id).src.e 11 | } 12 | 13 | interaction.deferUpdate().catch(() => { }) 14 | return message.edit({ 15 | content: `⏱ | Tempo expirado.`, 16 | components 17 | }).catch(() => { }) 18 | } -------------------------------------------------------------------------------- /src/structures/classes/buttons/payment/new.pay.js: -------------------------------------------------------------------------------- 1 | import { Database } from "../../../../classes/index.js" 2 | import { Emojis as e } from "../../../../util/util.js" 3 | import validatePayment from './validate.pay.js' 4 | 5 | export default async (interaction, customId) => { 6 | 7 | const { message, user } = interaction 8 | const author = message.interaction.user 9 | const paymentData = await Database.Cache.Pay.get(`${author.id}.${message.id}`) || [] 10 | 11 | if (!paymentData) 12 | return await interaction.update({ 13 | content: `${e.Deny} | Dados do pagamento não encontrados.`, 14 | components: [] 15 | }).catch(() => { }) 16 | 17 | const rawComponents = message.components 18 | const userMention = message.mentions.users.first() 19 | const components = rawComponents[0].toJSON() 20 | const { confirmated, value } = paymentData 21 | if (![author.id, userMention.id].includes(user.id) || !confirmated) return 22 | 23 | if (customId === 'deny') { 24 | Database.add(author.id, value) 25 | await Database.Cache.Pay.delete(`${author.id}.${message.id}`) 26 | return await interaction.update({ 27 | content: `${e.Deny} | ${user} cancelou o pagamento.`, 28 | components: [] 29 | }).catch(() => { }) 30 | } 31 | 32 | if (confirmated?.includes(user.id)) 33 | return await interaction.deferUpdate().catch(() => { }) 34 | 35 | const data = await Database.Cache.Pay.push(`${author.id}.${message.id}.confirmated`, user.id) 36 | components.components[0].label = `Confirmar ${confirmated?.length + 1}/2` 37 | if ((confirmated?.length + 1) >= 2) return validatePayment(interaction, data[message.id]) 38 | return await interaction.update({ components: [components] }).catch(() => { }) 39 | 40 | } -------------------------------------------------------------------------------- /src/structures/classes/buttons/payment/validate.pay.js: -------------------------------------------------------------------------------- 1 | import { Emojis as e } from "../../../../util/util.js" 2 | import { SaphireClient as client, Database } from "../../../../classes/index.js" 3 | 4 | export default async (interaction, { confirmated, value }) => { 5 | 6 | const { message, guild } = interaction 7 | const author = message.interaction.user 8 | 9 | const userId = confirmated.filter(id => id !== author.id)[0] 10 | const user = client.users.resolve(userId) 11 | 12 | Database.add(userId, value, `${e.gain} Recebeu um pagamento de ${value} Safiras de ${author.username} \`${author.id}\``) 13 | 14 | await Database.Cache.Pay.delete(`${author.id}.${message.id}`) 15 | return await interaction.update({ 16 | content: `${e.Check} | Pagamento realizado com sucesso.\n${e.saphireRight} | <@${author.id}> enviou **${value.currency()} ${await guild.getCoin()}** para <@${user.id}>.`, 17 | components: [] 18 | }).catch(() => { }) 19 | } -------------------------------------------------------------------------------- /src/structures/classes/buttons/poll/result.poll.js: -------------------------------------------------------------------------------- 1 | import { ButtonStyle } from "discord.js" 2 | import { DiscordPermissons, PermissionsTranslate } from "../../../../util/Constants.js" 3 | import { Emojis as e } from "../../../../util/util.js" 4 | 5 | export default async ({ interaction }) => { 6 | 7 | const { user, member, message } = interaction 8 | 9 | if (!member.permissions.has(DiscordPermissons.Administrator) && message.interaction.user.id !== user.id) 10 | return await interaction.reply({ 11 | content: `${e.Deny} | Você precisa da permissão **${PermissionsTranslate.Administrator}** ou ser o autor da votação para executar este comando.`, 12 | ephemeral: true 13 | }) 14 | 15 | return await interaction.reply({ 16 | content: `${e.QuestionMark} | Você só pode revelar o resultado da votação apenas uma vez. Quer mesmo fazer isso?`, 17 | components: [ 18 | { 19 | type: 1, 20 | components: [ 21 | { 22 | type: 2, 23 | label: "Revelar resultados", 24 | custom_id: JSON.stringify({ c: 'poll', type: 'review', messageId: message.id, userId: user.id }), 25 | style: ButtonStyle.Success 26 | }, 27 | { 28 | type: 2, 29 | label: "Não revelar agora", 30 | custom_id: JSON.stringify({ c: 'delete', userId: user.id }), 31 | style: ButtonStyle.Danger 32 | } 33 | ] 34 | } 35 | ] 36 | }) 37 | 38 | } -------------------------------------------------------------------------------- /src/structures/classes/buttons/quiz/changeCategoryName.quiz.js: -------------------------------------------------------------------------------- 1 | import { SaphireClient as client, Modals } from "../../../../classes/index.js" 2 | import { Emojis as e } from "../../../../util/util.js" 3 | 4 | export default async interaction => { 5 | 6 | if (!client.staff.includes(interaction.user.id)) 7 | return await interaction.reply({ 8 | content: `${e.DenyX} | Sinto-lhe em dizer isto, Majestade. Mas apenas os meus moderadores tem acesso a este recurso.`, 9 | ephemeral: true 10 | }) 11 | 12 | const embed = interaction.message.embeds[0]?.data 13 | if (!embed) 14 | return await interaction.update({ 15 | content: `${e.DenyX} | Embed principal não encontrada`, 16 | embeds: [], components: [] 17 | }).catch(() => { }) 18 | 19 | const category = embed.footer.text 20 | if (!category) 21 | return await interaction.update({ 22 | content: `${e.DenyX} | A categoria não foi encontrada.`, 23 | embeds: [], components: [] 24 | }).catch(() => { }) 25 | 26 | if (!embed.fields?.length) embed.fields = [] 27 | 28 | embed.fields[0] 29 | ? embed.fields[0] = { 30 | name: '📨 Solicitação Confirmada', 31 | value: `${e.Loading} Aguardando novo nome da categoria.` 32 | } 33 | : embed.fields.push({ 34 | name: '📨 Solicitação Confirmada', 35 | value: `${e.Loading} Aguardando novo nome da categoria.` 36 | }) 37 | 38 | await interaction.message.edit({ embeds: [embed] }).catch(() => { }) 39 | return await interaction.showModal(Modals.newCategoryName(category)) 40 | } -------------------------------------------------------------------------------- /src/structures/classes/buttons/quiz/editQuestion.quiz.js: -------------------------------------------------------------------------------- 1 | import Quiz from "../../../../classes/games/QuizManager.js"; 2 | import { Emojis as e } from "../../../../util/util.js"; 3 | import { Modals, SaphireClient as client } from "../../../../classes/index.js"; 4 | 5 | export default async interaction => { 6 | 7 | if (!client.staff.includes(interaction.user.id)) 8 | return await interaction.reply({ 9 | content: `${e.DenyX} | Apenas os meus moderadores podem editar o conteúdo das indicações.`, 10 | ephemeral: true 11 | }) 12 | 13 | if (!interaction.message || !interaction.message.embeds?.length) 14 | return await interaction.reply({ 15 | content: `${e.DenyX} | Não foi possível obter a mensagem de origem.`, 16 | ephemeral: true 17 | }) 18 | 19 | const { message } = interaction 20 | const embed = message.embeds[0]?.data 21 | 22 | if (!embed) 23 | return await interaction.reply({ 24 | content: `${e.DenyX} | Não foi possível obter a embed da mensagem de origem.` 25 | }) 26 | 27 | const questionId = embed.footer?.text?.replace('Question ID: ', '') 28 | if (!questionId) 29 | return await interaction.reply({ content: `${e.DenyX} | Não foi possível obter o ID da indicação.` }) 30 | 31 | const question = [...Quiz.questions, ...Quiz.QuestionsIndications].find(q => q.questionId == questionId) 32 | if (!question) 33 | return await interaction.reply({ content: `${e.DenyX} | Não foi possível obter a indicação.` }) 34 | 35 | const modal = Modals.editQuestionData(question, embed.title == `🔎 ${client.user.username}'s Question Viewer`) 36 | return await interaction.showModal(modal) 37 | } -------------------------------------------------------------------------------- /src/structures/classes/buttons/quiz/newQuizReport.quiz.js: -------------------------------------------------------------------------------- 1 | import Quiz from "../../../../classes/games/QuizManager.js"; 2 | import { Database, SaphireClient as client } from "../../../../classes/index.js"; 3 | import { CodeGenerator } from "../../../../functions/plugins/plugins.js"; 4 | import { Emojis as e } from "../../../../util/util.js"; 5 | 6 | // Modal Interaction 7 | export default async interaction => { 8 | 9 | const { user, guild, fields, channel, customId } = interaction 10 | const customIdData = JSON.parse(customId) 11 | const questionId = customIdData.id 12 | const content = fields.getTextInputValue('content') 13 | const webhookUrl = await Quiz.getWebhookUrl(channel) || null 14 | 15 | const dataSave = { 16 | reportId: CodeGenerator(10), 17 | userId: user.id, 18 | guildId: guild.id, 19 | questionId, 20 | webhookUrl, 21 | content 22 | } 23 | 24 | Quiz.reports.push(dataSave) 25 | await Database.Client.updateOne( 26 | { id: client.user.id }, 27 | { 28 | $push: { 29 | QuizQuestionsReports: { 30 | $each: [dataSave] 31 | } 32 | } 33 | } 34 | ) 35 | 36 | return await interaction.reply({ 37 | embeds: [{ 38 | color: client.green, 39 | title: `${e.CheckV} | O seu reporte foi salvo com sucesso.`, 40 | description: `\`\`\`txt\n${content}\n\`\`\``, 41 | footer: { 42 | text: `Report ID: ${dataSave.reportId}` 43 | } 44 | }], 45 | ephemeral: true 46 | }) 47 | } -------------------------------------------------------------------------------- /src/structures/classes/buttons/quiz/play.quiz.js: -------------------------------------------------------------------------------- 1 | import QuizManager from "../../../../classes/games/QuizManager.js" 2 | import Quiz from "../../../../classes/games/Quiz.js" 3 | import { Emojis as e } from "../../../../util/util.js" 4 | 5 | export default async interaction => { 6 | 7 | const { channel } = interaction 8 | 9 | if (QuizManager.channelsInGames.includes(channel.id)) 10 | return await interaction.reply({ 11 | content: `${e.Deny} | Ooops, já tem um Quiz rolando nesse canal, espere ele acabar para começar outro, ok?`, 12 | ephemeral: true 13 | }) 14 | 15 | QuizManager.channelsInGames.push(channel.id) 16 | return new Quiz(interaction).askPreference() 17 | } -------------------------------------------------------------------------------- /src/structures/classes/buttons/raspadinha/buy.raspadinha.js: -------------------------------------------------------------------------------- 1 | import { SaphireClient as client, Database } from "../../../../classes/index.js" 2 | import { Emojis as e } from "../../../../util/util.js" 3 | import buildRaspadinha from "./build.raspadinha.js" 4 | 5 | export default async interaction => { 6 | 7 | const { user, guild } = interaction 8 | const userData = await Database.getUser(user.id) 9 | const userBalance = userData?.Balance || 0 10 | const moeda = await guild.getCoin() 11 | 12 | if (userBalance < 100) 13 | return interaction.update({ 14 | content: `${e.Deny} | Você precisa ter pelo menos **100 ${moeda}** para abrir uma raspadinha.`, 15 | components: [] 16 | }).catch(() => { }) 17 | 18 | return Database.User.findOneAndUpdate( 19 | { id: user.id }, 20 | { $inc: { Balance: -100 } }, 21 | { upsert: true, new: true } 22 | ) 23 | .then(async result => { 24 | Database.saveUserCache(result?.id, result) 25 | 26 | await Database.Client.updateOne( 27 | { id: client.user.id }, 28 | { 29 | $inc: { 30 | ['Raspadinhas.Bought']: 1, 31 | ['Raspadinhas.totalPrize']: 100 32 | } 33 | } 34 | ) 35 | 36 | return buildRaspadinha(interaction) 37 | }) 38 | .catch(err => { 39 | return interaction.update({ 40 | content: `${e.Deny} | Não foi possível iniciar a sua raspadinha. \`(${err.code || 0})\``, 41 | components: [] 42 | }).catch(() => { }) 43 | }) 44 | } -------------------------------------------------------------------------------- /src/structures/classes/buttons/raspadinha/click.raspadinha.js: -------------------------------------------------------------------------------- 1 | import { ButtonStyle } from "discord.js" 2 | import checkAndAnalyzeButton from "./check.raspadinha.js" 3 | 4 | export default async (interaction, customId) => { 5 | 6 | const { message } = interaction 7 | if (!message) return 8 | 9 | const emojis = ['🦤', '🐭', '🦆', '🐒', '🐔', '🐦', '⭐'] 10 | const buttonIndex = { 11 | a1: 0, a2: 0, a3: 0, a4: 0, 12 | b1: 1, b2: 1, b3: 1, b4: 1, 13 | c1: 2, c2: 2, c3: 2, c4: 2, 14 | d1: 3, d2: 3, d3: 3, d4: 3 15 | }[customId] 16 | const buttons = message.components.map(components => components.toJSON()) 17 | const button = buttons[buttonIndex].components.find(data => data.custom_id.includes(customId)) 18 | 19 | button.emoji = { name: emojis.random() } 20 | button.disabled = true 21 | button.style = ButtonStyle.Primary 22 | 23 | const check = await checkAndAnalyzeButton(interaction, buttons) 24 | if (check === null) return 25 | 26 | return await interaction.update({ components: buttons }).catch(() => { }) 27 | } -------------------------------------------------------------------------------- /src/structures/classes/buttons/raspadinha/index.raspadinha.js: -------------------------------------------------------------------------------- 1 | import buyRaspadinha from "./buy.raspadinha.js" 2 | import click from './click.raspadinha.js' 3 | 4 | export default async (interaction, { src, id: userId, buttonId = undefined }) => { 5 | 6 | const { user } = interaction 7 | 8 | if (userId !== user.id) return 9 | 10 | if (src === 'buy') 11 | return buyRaspadinha(interaction) 12 | 13 | if (src === 'click') 14 | return click(interaction, buttonId) 15 | 16 | } -------------------------------------------------------------------------------- /src/structures/classes/buttons/raspadinha/win.raspadinha.js: -------------------------------------------------------------------------------- 1 | import { SaphireClient as client, Database } from "../../../../classes/index.js" 2 | import { Emojis as e } from "../../../../util/util.js" 3 | 4 | export default async (interaction, emoji, buttons) => { 5 | 6 | const prize = { 7 | '🦤': -1000, 8 | '🐭': 150, 9 | '🦆': 5000, 10 | '🐒': 1000, 11 | '🐔': 100, 12 | '🐦': 500, 13 | '⭐': emoji === '⭐' ? await getData() : null 14 | } 15 | 16 | const { user, guild } = interaction 17 | const winPrize = prize[emoji] || 0 18 | const moeda = await guild.getCoin() 19 | 20 | if (winPrize > 0) 21 | Database.add(user.id, winPrize + 100, `${e.gain} Ganhou ${winPrize} Safiras em uma *raspadinha*`) 22 | 23 | if (winPrize === -1000) 24 | Database.subtract(user.id, winPrize, `${e.loss} Perdeu ${winPrize} Safiras em uma *raspadinha*`) 25 | 26 | const finalText = winPrize <= 0 27 | ? `${e.Animated.SaphireCry} | Você encontrou uma sequência de dodos 🦤 e perdeu 1000 ${moeda}` 28 | : `${e.Animated.SaphireDance} | Você ganhou **${winPrize} ${moeda}** achando 3 ${emoji}` 29 | 30 | return await interaction.update({ 31 | content: finalText, 32 | components: buttons 33 | }).catch(() => { }) 34 | 35 | async function getData() { 36 | const clientData = await Database.Client.findOne({ id: client.user.id }, 'Raspadinhas') 37 | deletePrize() 38 | return clientData.Raspadinhas?.totalPrize || 100 39 | async function deletePrize() { 40 | if (emoji !== '⭐') return 41 | await Database.Client.updateOne( 42 | { id: client.user.id }, 43 | { $set: { 'Raspadinhas.totalPrize': 0 } } 44 | ) 45 | } 46 | } 47 | 48 | } -------------------------------------------------------------------------------- /src/structures/classes/buttons/rather/admin/edit.rather.js: -------------------------------------------------------------------------------- 1 | import { Database } from "../../../../../classes/index.js" 2 | 3 | export default async ({ interaction, customId, message, modals, client, emojis: e }) => { 4 | 5 | const { user } = interaction 6 | 7 | if (!client.staff.includes(user.id)) 8 | if (user.id !== message.interaction?.user.id) return 9 | 10 | if (customId === 'cancel') 11 | return message.delete().catch(() => { }) 12 | 13 | const { embeds } = message 14 | const embed = embeds[0]?.data 15 | 16 | if (customId === 'edit') { 17 | 18 | if (!embed) 19 | return await interaction.update({ 20 | content: `${e.Deny} | Embed não encontrada.`, 21 | components: [] 22 | }) 23 | 24 | const questionOne = embed.fields[3]?.value || embed.fields[0].value 25 | const questionTwo = embed.fields[4]?.value || embed.fields[1].value 26 | 27 | return await interaction.showModal(modals.adminEditVocePrefere(questionOne, questionTwo, embed.footer.text)) 28 | } 29 | 30 | if (customId === 'confirm') 31 | return import('./confirm.rather.js').then(confirm => confirm.default({ interaction, customId, message, modals, client, e, Database, embed })) 32 | 33 | if (customId === 'request') 34 | return import('./request.rather.js').then(config => config.default({ interaction, e, client, embed, message })) 35 | } -------------------------------------------------------------------------------- /src/structures/classes/buttons/server/redirect.server.js: -------------------------------------------------------------------------------- 1 | import { ButtonInteraction } from "discord.js" 2 | import { Emojis as e } from "../../../../util/util.js" 3 | import { Database } from "../../../../classes/index.js" 4 | import disable from "./disable.server.js" 5 | import build from "./build.server.js" 6 | 7 | /** 8 | * @param { ButtonInteraction } interaction 9 | * @param { { c: String, src: String } } commandData 10 | */ 11 | export default async (interaction, commandData) => { 12 | 13 | const { user, message, guildId } = interaction 14 | 15 | if (user.id != message.interaction.user.id) 16 | return interaction.reply({ 17 | content: `${e.Deny} | Hey hey! Você não pode clicar aqui não, ok?`, 18 | ephemeral: true 19 | }) 20 | 21 | // const guildData = await Database.Guild.findOne({ id: guildId }) 22 | const guildData = await Database.getGuild(guildId) 23 | 24 | const execute = { 25 | welcome: { 26 | welcome: build, 27 | body: guildData.WelcomeChannel, 28 | type: 'welcome' 29 | }, 30 | leave: { 31 | leave: build, 32 | body: guildData.LeaveChannel, 33 | type: 'leave' 34 | }, 35 | disable: { 36 | disable, 37 | body: commandData 38 | } 39 | }[commandData.src] 40 | 41 | if (execute) return execute[commandData.src](interaction, execute.body, execute.type) 42 | 43 | return interaction.update({ 44 | content: `${e.Animated.SaphireCry} | Sub-função não encontrada #16845345400`, 45 | embeds: [], components: [] 46 | }).catch(() => { }) 47 | } -------------------------------------------------------------------------------- /src/structures/classes/buttons/server/save.server.js: -------------------------------------------------------------------------------- 1 | import { ButtonInteraction } from "discord.js" 2 | import { Emojis as e } from "../../../../util/util.js" 3 | import { Database } from "../../../../classes/index.js" 4 | 5 | /** 6 | * @param { ButtonInteraction } interaction 7 | * @param { { content: String | null, embeds: Array, channelId: String } } data 8 | * @param { 'welcome' | 'leave' } data 9 | */ 10 | export default async (interaction, data, type) => { 11 | 12 | if (!data || !data.channelId || (!data.content && !data.embeds[0])) 13 | return interaction.update({ 14 | content: `${e.Animated.SaphirePanic} | Formato inválido para salvar.`, 15 | components: [], embeds: [] 16 | }).catch(() => { }) 17 | 18 | return await Database.Guild.findOneAndUpdate( 19 | { id: interaction.guildId }, 20 | { 21 | $set: { 22 | [ 23 | type == 'welcome' ? 'WelcomeChannel' : 'LeaveChannel' 24 | ]: { 25 | channelId: data.channelId, 26 | body: { 27 | content: data.content ?? null, 28 | embeds: data.embeds 29 | } 30 | } 31 | } 32 | }, 33 | { new: true } 34 | ) 35 | .then(data => { 36 | Database.saveGuildCache(data.id, data) 37 | interaction.update({ 38 | content: `${e.Check} | Muito bem, tudo foi salvo sem nenhum problemas.`, 39 | components: [], embeds: [] 40 | }).catch(() => { }) 41 | return 42 | }) 43 | .catch(err => interaction.update({ 44 | content: `${e.Animated.SaphirePanic} | Algo de errado não está certo.\n${e.bug} | \`${err}\``, 45 | components: [], embeds: [] 46 | }).catch(() => { })) 47 | } -------------------------------------------------------------------------------- /src/structures/classes/buttons/tictactoe/check.tictactoe.js: -------------------------------------------------------------------------------- 1 | export default (components, allButtons) => { 2 | 3 | const a1 = components[0].components[0].emoji?.name || components[0].components[0].emoji 4 | const a2 = components[0].components[1].emoji?.name || components[0].components[1].emoji 5 | const a3 = components[0].components[2].emoji?.name || components[0].components[2].emoji 6 | const b1 = components[1].components[0].emoji?.name || components[1].components[0].emoji 7 | const b2 = components[1].components[1].emoji?.name || components[1].components[1].emoji 8 | const b3 = components[1].components[2].emoji?.name || components[1].components[2].emoji 9 | const c1 = components[2].components[0].emoji?.name || components[2].components[0].emoji 10 | const c2 = components[2].components[1].emoji?.name || components[2].components[1].emoji 11 | const c3 = components[2].components[2].emoji?.name || components[2].components[2].emoji 12 | const emojis = ['❌', '⭕'] 13 | 14 | const possibilities = [ 15 | [a1, a2, a3], 16 | [b1, b2, b3], 17 | [c1, c2, c3], 18 | [a1, b1, c1], 19 | [a2, b2, c2], 20 | [a3, b3, c3], 21 | [a1, b2, c3], 22 | [a3, b2, c1] 23 | ] 24 | 25 | for (const array of possibilities) { 26 | 27 | const authorWin = array.every(emoji => emoji === emojis[0]) 28 | const userWin = array.every(emoji => emoji === emojis[1]) 29 | 30 | if (authorWin) return emojis[0] 31 | if (userWin) return emojis[1] 32 | 33 | continue 34 | } 35 | 36 | if (allButtons.every(button => button.disabled === true)) return true 37 | return false 38 | 39 | } -------------------------------------------------------------------------------- /src/structures/classes/buttons/tictactoe/finish.tictactoe.js: -------------------------------------------------------------------------------- 1 | export default async ({ winResponse, author, opponent, components, interaction }) => { 2 | 3 | disableAll() 4 | 5 | if (winResponse === true) 6 | return await interaction.update({ 7 | content: `👵 | <@${author}>, <@${opponent}>, deu velha.`, 8 | components 9 | }) 10 | 11 | const winner = { 12 | '❌': author, 13 | '⭕': opponent 14 | }[winResponse] 15 | 16 | return await interaction.update({ 17 | content: `👑 | <@${winner}> ganhou o jogo.`, 18 | components 19 | }) 20 | 21 | function disableAll() { 22 | const allButtons = components.map(row => row.components).flat() 23 | for (let button of allButtons) button.disabled = true 24 | } 25 | 26 | } -------------------------------------------------------------------------------- /src/structures/classes/buttons/tictactoe/game.tictactoe.js: -------------------------------------------------------------------------------- 1 | import { indexButton } from '../../../commands/functions/memorygame/util.js'; 2 | import { ButtonStyle } from 'discord.js'; 3 | import check from './check.tictactoe.js'; 4 | import win from './finish.tictactoe.js'; 5 | 6 | export default async (interaction, customIdData) => { 7 | 8 | const { user, message, guild } = interaction 9 | const { id, opponent: opponentId, authorId } = customIdData 10 | const commandAuthor = message.interaction?.user || guild.members.cache.get(authorId)?.user 11 | const opponentUser = guild.members.cache.get(opponentId)?.user 12 | const availablePlayers = [commandAuthor?.id, opponentId] 13 | 14 | if (!commandAuthor || !opponentUser || !availablePlayers.includes(user.id)) return 15 | 16 | const playNow = message.mentions.users.first() 17 | if (!playNow || playNow.id !== user.id) return 18 | 19 | const emojis = { [commandAuthor.id]: '❌', [opponentId]: '⭕' } 20 | const components = message.components.map(components => components.toJSON()) 21 | const allButtons = components.map(row => row.components).flat() 22 | const row = components[indexButton[id]] 23 | const button = row.components.find(button => JSON.parse(button.custom_id).src.id === id) 24 | 25 | button.emoji = emojis[user.id] 26 | button.style = user.id === commandAuthor.id ? ButtonStyle.Success : ButtonStyle.Primary 27 | button.disabled = true 28 | 29 | const winResponse = check(components, allButtons) 30 | 31 | if (winResponse) 32 | return win({ 33 | winResponse, 34 | author: availablePlayers[0], opponent: availablePlayers[1], 35 | components, 36 | interaction 37 | }) 38 | 39 | return await interaction.update({ 40 | content: `${user.id === commandAuthor.id ? opponentUser : commandAuthor}, é sua vez.`, 41 | components 42 | }) 43 | 44 | } -------------------------------------------------------------------------------- /src/structures/classes/buttons/twitch/redirect.twitch.js: -------------------------------------------------------------------------------- 1 | import { Emojis as e } from "../../../../util/util.js" 2 | import { Message, User } from "discord.js" 3 | import ButtonInteraction from "../../ButtonInteraction.js" 4 | import disable from './disable.twitch.js' 5 | import active from './active.twitch.js' 6 | import clips from './clips.twitch.js' 7 | import oldLive from './oldLive.twitch.js' 8 | 9 | /** 10 | * @param { ButtonInteraction } interaction 11 | * @param { Message } message 12 | * @param { User } user 13 | * @param { { c: 'twitch', cName: TwitchChannelName, cgId: GuildTextChannelNotificationId } } commandData 14 | */ 15 | export default async ({ interaction }, commandData) => { 16 | 17 | if (commandData.src == 'active') 18 | return active(interaction, commandData) 19 | 20 | if (commandData.src == 'clips') 21 | return clips(interaction, commandData) 22 | 23 | if (commandData.src == 'oldLive') 24 | return oldLive(interaction, commandData) 25 | 26 | if (!['a', 'd'].includes(commandData.t)) 27 | return interaction.reply({ content: `${e.Animated.SaphirePanic} | Sub-Função não encontrada. #468415343` }) 28 | 29 | return disable(interaction, commandData) 30 | } -------------------------------------------------------------------------------- /src/structures/classes/modals/cantadas/cantadas.modal.js: -------------------------------------------------------------------------------- 1 | import { 2 | Database, 3 | SaphireClient as client 4 | } from "../../../../classes/index.js" 5 | import { CodeGenerator } from '../../../../functions/plugins/plugins.js' 6 | import { Emojis as e } from "../../../../util/util.js" 7 | 8 | export default async ({ interaction, user, guild, fields }) => { 9 | 10 | const cantada = fields.getTextInputValue('cantada') || null 11 | const cantadaId = CodeGenerator(10) 12 | 13 | await Database.Client.updateOne( 14 | { id: client.user.id }, 15 | { 16 | $push: { 17 | CantadasIndicadas: { 18 | userId: user.id, 19 | cantada, 20 | cantadaId 21 | } 22 | } 23 | } 24 | ) 25 | 26 | return await interaction.reply({ 27 | content: `${e.Check} | Sua cantada foi enviada com sucesso e está aguardando a aprovação de um dos membros da Saphire's Team.`, 28 | ephemeral: true 29 | }) 30 | 31 | } -------------------------------------------------------------------------------- /src/structures/classes/modals/hangman/analise.hangman.js: -------------------------------------------------------------------------------- 1 | import { ModalSubmitInteraction } from "discord.js"; 2 | import { Emojis as e } from "../../../../util/util.js"; 3 | import { Database } from "../../../../classes/index.js"; 4 | import newHangman from "./new.hangman.js"; 5 | import letter from "./letter.hangman.js"; 6 | import word from "./word.hangman.js"; 7 | 8 | /** 9 | * @param { ModalSubmitInteraction } interaction 10 | */ 11 | export default async interaction => { 12 | 13 | const { message, customId } = interaction 14 | const data = JSON.parse(customId) 15 | if (data.src == 'new') return newHangman(interaction) 16 | 17 | await interaction.deferUpdate() 18 | /** 19 | * @type { { 20 | * type: 'multiplayer' | 'solo' | 'custom' 21 | * word: String, 22 | * creatorId: String, 23 | * guildId: String, 24 | * channelId: String, 25 | * attempts: Number, 26 | * alreadySended: Array 27 | * } } 28 | */ 29 | const gameData = await Database.Cache.Hangman.get(message.id) 30 | 31 | if (!gameData) { 32 | interaction.editReply({ components: [] }) 33 | return interaction.followUp({ 34 | content: `${e.Animated.SaphireCry} | Infelizmente o jogo que você respondeu não existe mais.`, 35 | ephemeral: true 36 | }) 37 | } 38 | 39 | if (data.t == 'letter') return letter(interaction, gameData) 40 | if (data.t == 'word') return word(interaction, gameData) 41 | 42 | await Database.Cache.Hangman.delete(message.id) 43 | return interaction.editReply({ 44 | content: `${e.Animated.SaphireCry} | Dados não encontado pelo Modal Interaction.`, 45 | embeds: [], components: [] 46 | }).catch(() => { }) 47 | } -------------------------------------------------------------------------------- /src/structures/classes/selectmenu/logsCommand/disable.logs.js: -------------------------------------------------------------------------------- 1 | import { Emojis as e } from "../../../../util/util.js" 2 | import { Database } from "../../../../classes/index.js" 3 | import notify from "../../../../functions/plugins/notify.js" 4 | 5 | export default async interaction => { 6 | 7 | const { guild, user } = interaction 8 | const logData = await Database.Guild.findOneAndUpdate( 9 | { id: guild.id }, 10 | { $unset: { "LogSystem": 1 } }, 11 | { new: true } 12 | ) 13 | .then(doc => { 14 | Database.saveGuildCache(doc.id, doc) 15 | return doc 16 | }) 17 | 18 | const channel = guild.channels.cache.get(logData?.LogSystem?.channel) 19 | if (channel) 20 | notify(channel.id, "Log System Disabled", `${user} \`${user.id}\` desativou o sistema de logs.`) 21 | 22 | return interaction.update({ 23 | content: `${e.Check} | O Sistema de Logs *\`Global System Notification (GSN)\`* foi desativado com sucesso.`, 24 | embeds: [], 25 | components: [] 26 | }).catch(() => { }) 27 | } -------------------------------------------------------------------------------- /src/structures/commands/functions/channel/delete.channel.js: -------------------------------------------------------------------------------- 1 | import { ButtonStyle } from "discord.js" 2 | import { Emojis as e } from "../../../../util/util.js" 3 | 4 | export default async (interaction, channel) => { 5 | 6 | const channelType = { 7 | 0: 'o canal de texto', 8 | 1: 'o canal privado', 9 | 2: 'o canal de voz', 10 | 3: 'o canal de mensagens em grupo', 11 | 4: 'a categoria', 12 | 5: 'o canal de anúncios', 13 | 10: 'a thread de anúncios', 14 | 11: 'a thread pública', 15 | 12: 'a thread privada', 16 | 13: 'o canal de palco', 17 | 14: 'o canal Student Hub', 18 | 15: 'o canal de fórum' 19 | }[channel.type] || 'o canal desconhecido' 20 | 21 | return await interaction.reply({ 22 | content: `${e.Loading} | Você realmente deseja deletar ${channelType} ${channel}?`, 23 | components: [ 24 | { 25 | type: 1, 26 | components: [ 27 | { 28 | type: 2, 29 | label: 'Excluir', 30 | custom_id: JSON.stringify({ c: 'channel', src: 'delete', id: channel.id }), 31 | style: ButtonStyle.Success 32 | }, 33 | { 34 | type: 2, 35 | label: 'Cancelar', 36 | custom_id: JSON.stringify({ c: 'delete' }), 37 | style: ButtonStyle.Danger 38 | } 39 | ] 40 | } 41 | ] 42 | }) 43 | 44 | } -------------------------------------------------------------------------------- /src/structures/commands/functions/channel/invite.channel.js: -------------------------------------------------------------------------------- 1 | import { Permissions } from "../../../../util/Constants.js" 2 | import { Emojis as e } from "../../../../util/util.js" 3 | 4 | export default async (interaction, channel) => { 5 | 6 | const { user, member, guild } = interaction 7 | 8 | if (!guild.clientHasPermission(Permissions.CreateInstantInvite)) 9 | return await interaction.reply({ 10 | content: `${e.Deny} | Eu não tenho permissão para criar convites neste servidor.`, 11 | ephemeral: true 12 | }) 13 | 14 | if (!member.memberPermissions(Permissions.CreateInstantInvite)) 15 | return await interaction.reply({ 16 | content: `${e.Deny} | Você não tem permissão para criar convites neste servidor.`, 17 | ephemeral: true 18 | }) 19 | 20 | const invite = await channel.createInvite({ 21 | temporary: false, 22 | maxAge: 0, 23 | reason: `${user.username} criou este convite` 24 | }) 25 | .catch(() => null) 26 | 27 | if (!invite) 28 | return await interaction.reply({ 29 | content: `${e.Deny} | Não foi possível criar um convite deste canal.`, 30 | ephemeral: true 31 | }) 32 | 33 | if (!invite?.code) 34 | return await interaction.reply({ 35 | content: `${e.Deny} | O código do convite não foi encontrado. Por favor, tente novamente.`, 36 | ephemeral: true 37 | }) 38 | 39 | return await interaction.reply({ 40 | content: `${e.Check} | Convite fresquinho: \`https://discord.gg/${invite.code}\`\n${e.Info} | Por padrão, este link é permanente.` 41 | }) 42 | } -------------------------------------------------------------------------------- /src/structures/commands/functions/channel/lock.channel.js: -------------------------------------------------------------------------------- 1 | import { ChannelType } from "discord.js" 2 | import { Permissions } from "../../../../util/Constants.js" 3 | import { Emojis as e } from "../../../../util/util.js" 4 | 5 | export default async (interaction, channel) => { 6 | 7 | if (!channel) 8 | return await interaction.reply({ 9 | content: `${e.Deny} | Canal não encontrado.`, 10 | ephemeral: true 11 | }) 12 | 13 | if (channel.type === ChannelType.GuildCategory) 14 | return await interaction.reply({ 15 | content: `${e.Deny} | Trancar e Destrancar categorias não surgem efeitos no canais dentro delas.`, 16 | ephemeral: true 17 | }) 18 | 19 | const { guild, user, channel: channelInteraction } = interaction 20 | 21 | const channelResponse = await channel.permissionOverwrites.edit( 22 | guild.roles.everyone.id, 23 | { 24 | [Permissions.SendMessages]: false, 25 | [Permissions.AddReactions]: false 26 | }, 27 | { 28 | reason: `${user.username} trancou este canal.` 29 | } 30 | ).catch(err => err.code) 31 | 32 | if (channelResponse.constructor === Number) { 33 | 34 | return await interaction.reply({ 35 | content: `${e.Deny} | Não foi possível editar as permissões para trancar o canal. \`(${channelResponse})\``, 36 | ephemeral: true 37 | }) 38 | 39 | } 40 | 41 | const channelResponseString = channelResponse.id === channelInteraction.id 42 | ? 'esse canal' 43 | : { 44 | [ChannelType.GuildVoice]: `o canal de voz ${channelResponse}`, 45 | [ChannelType.GuildText]: `o canal de texto ${channelResponse}`, 46 | [ChannelType.GuildAnnouncement]: `o canal de anúncios ${channelResponse}`, 47 | }[channelResponse.type] 48 | 49 | return await interaction.reply({ 50 | content: `🔒 | ${user} trancou ${channelResponseString}` 51 | }) 52 | } -------------------------------------------------------------------------------- /src/structures/commands/functions/channel/nsfw-disable.channel.js: -------------------------------------------------------------------------------- 1 | import { Emojis as e } from "../../../../util/util.js" 2 | 3 | export default async (interaction, channel) => { 4 | 5 | if (!channel.nsfw) 6 | return await interaction.reply({ 7 | content: `${e.Info} | O canal ${channel} não é um canal NSFW.`, 8 | ephemeral: true 9 | }) 10 | 11 | const { user } = interaction 12 | 13 | const fail = await channel.setNSFW(false, `${user.username} desativou o NSFW.`) 14 | .catch(err => err.code) 15 | 16 | if (fail.constructor === Number) { 17 | 18 | const content = { 19 | 10003: `${e.Deny} | Este canal é desconhecido. Por favor, tente em outro canal.`, 20 | 50024: `${e.Deny} | Essa ação não pode ser executada nesse tipo de canal.` 21 | }[fail] || `${e.Deny} | Não foi possível ativar o NSFW no canal ${channel}.` 22 | 23 | return await interaction.reply({ content }).catch(() => { }) 24 | } 25 | 26 | return await interaction.reply({ 27 | content: `${e.Check} | Okay okay! O canal ${channel} foi liberado para todos os públicos.` 28 | }).catch(() => { }) 29 | } -------------------------------------------------------------------------------- /src/structures/commands/functions/channel/nsfw-enable.channel.js: -------------------------------------------------------------------------------- 1 | import { Emojis as e } from "../../../../util/util.js" 2 | 3 | export default async (interaction, channel) => { 4 | 5 | if (channel.nsfw) 6 | return await interaction.reply({ 7 | content: `${e.Info} | O canal ${channel} já é um canal NSFW.`, 8 | ephemeral: true 9 | }) 10 | 11 | const { user } = interaction 12 | 13 | const fail = await channel.setNSFW(true, `${user.username} ativou o NSFW.`) 14 | .catch(err => err.code) 15 | 16 | if (fail.constructor === Number) { 17 | 18 | const content = { 19 | 10003: `${e.Deny} | Este canal é desconhecido. Por favor, tente em outro canal.`, 20 | 50024: `${e.Deny} | Essa ação não pode ser executada nesse tipo de canal.` 21 | }[fail] || `${e.Deny} | Não foi possível ativar o NSFW no canal ${channel}.` 22 | 23 | return await interaction.reply({ content }).catch(() => { }) 24 | } 25 | 26 | return await interaction.reply({ 27 | content: `${e.Check} | Prontinho, agora o canal ${channel} é um lugar de pessoas erradas.` 28 | }).catch(() => { }) 29 | } -------------------------------------------------------------------------------- /src/structures/commands/functions/giveaway/finish.giveaway.js: -------------------------------------------------------------------------------- 1 | import { GiveawayManager, SaphireClient as client } from "../../../../classes/index.js" 2 | import { Emojis as e } from "../../../../util/util.js" 3 | import { ButtonStyle } from "discord.js" 4 | 5 | export default async (interaction, giveawayId) => { 6 | 7 | const { options } = interaction 8 | const giveaway = GiveawayManager.getGiveaway(giveawayId || options.getString('select_giveaway')) 9 | 10 | if (!giveaway) 11 | return await interaction.reply({ 12 | content: `${e.DenyX} | Sorteio não encontrado no processo de ativação.`, 13 | ephemeral: true 14 | }) 15 | 16 | if (!giveaway.Actived) 17 | return await interaction.reply({ 18 | content: `${e.Deny} | Este sorteio não está ativo. Portando, não é possível finalizar uma coisa já finalizada, sacou?`, 19 | ephemeral: true 20 | }) 21 | 22 | client.emit('giveaway', giveaway) 23 | return await interaction.reply({ 24 | content: `${e.Check} | Sorteio finalizado com sucesso!`, 25 | ephemeral: true, 26 | components: [{ 27 | type: 1, 28 | components: [ 29 | { 30 | type: 2, 31 | label: 'Sorteio Original', 32 | emoji: '🔗', 33 | url: giveaway.MessageLink, 34 | style: ButtonStyle.Link 35 | } 36 | ] 37 | }] 38 | }) 39 | } -------------------------------------------------------------------------------- /src/structures/commands/functions/logomarca/game.logomarca.js: -------------------------------------------------------------------------------- 1 | import { 2 | SaphireClient as client, 3 | Database, 4 | Logomarca 5 | } from "../../../../classes/index.js" 6 | import { Emojis as e } from "../../../../util/util.js" 7 | 8 | export default async interaction => { 9 | 10 | const channelsInGame = await Database.Cache.Logomarca.get(`${client.shardId}.Channels`) || [] 11 | 12 | if (channelsInGame.includes(interaction.channel.id)) 13 | return await interaction.reply({ 14 | content: `${e.Deny} | Já tem um logomarca rolando nesse chat.`, 15 | ephemeral: true 16 | }) 17 | 18 | return new Logomarca(interaction, Database.Logomarca).registerNewGameAndStart() 19 | 20 | } -------------------------------------------------------------------------------- /src/structures/commands/functions/memorygame/coop.memory.js: -------------------------------------------------------------------------------- 1 | import emojisArray from './emojis.js' 2 | import buttonGenerator from './functions/generator.coop.memory.js' 3 | 4 | export default async (interaction, e) => { 5 | 6 | const { options, user } = interaction 7 | const member = options.getMember('member') 8 | 9 | if (member.id === user.id || member.user.bot) 10 | return await interaction.reply({ 11 | content: `${e.Deny} | Você não pode jogar com bots ou com você mesmo.`, 12 | ephemeral: true 13 | }) 14 | 15 | const emojiOption = options.getInteger('emojis') ?? -1 16 | const emojis = emojiOption === -1 ? emojisArray.random() : emojisArray[emojiOption] 17 | const playNow = [member, user].random() 18 | 19 | await interaction.reply({ 20 | content: `${e.Loading} | Construindo novo jogo cooperativo...` 21 | }).catch(() => { }) 22 | 23 | const buttons = buttonGenerator(emojis, e, member.id) 24 | 25 | return await interaction.editReply({ 26 | content: `${e.Loading} | Tente achar os pares de emojis iguais.\n${e.Info} | Clique nos botões com calma para não estragar o jogo.\n🤝 | Modo cooperativo: ${playNow}, é sua vez.`, 27 | components: buttons.default 28 | }).catch(() => { }) 29 | } -------------------------------------------------------------------------------- /src/structures/commands/functions/memorygame/emojis.js: -------------------------------------------------------------------------------- 1 | export default [ 2 | ['1️⃣', '2️⃣', '3️⃣', '4️⃣', '5️⃣', '6️⃣', '7️⃣', '8️⃣', '9️⃣', '🔟'], 3 | ['🇧🇷', '🏳️‍🌈', '🇺🇸', '🇻🇳', '🇹🇷', '🇦🇺', '🇨🇺', '🇪🇨', '🇯🇵', '🇰🇷'], 4 | ['🐶', '🐱', '🐨', '🐯', '🐒', '🐷', '🐦', '🐥', '🐺', '🦅'], 5 | ['🍎', '🍓', '🍒', '🍐', '🍊', '🌶️', '🥝', '🍇', '🥕', '🍌'], 6 | ['🎱', '⚽', '🏀', '🏈', '⚾', '🎾', '🪃', '🏐', '🏉', '🥏'], 7 | ['😀', '😊', '😇', '🤩', '😎', '🥳', '😍', '😂', '😳', '😡'], 8 | ['❤️', '🧡', '💚', '💙', '💞', '🖤', '❤️‍🔥', '🤍', '💝', '💖'], 9 | ['🕐', '🕑', '🕒', '🕓', '🕔', '🕕', '🕖', '🕗', '🕘', '🕙'], 10 | ['👪', '👨‍👩‍👦', '👨‍👩‍👧', '👨‍👩‍👧‍👦', '👨‍👩‍👦‍👦', '👨‍👩‍👧‍👧', '👩‍👩‍👦', '👩‍👩‍👧', '👩‍👩‍👧‍👦', '👩‍👩‍👦‍👦'], 11 | ['🇦🇨', '🇦🇮', '🇦🇺', '🇨🇰', '🇫🇰', '🇬🇸', '🇰🇾', '🇲🇸', '🇳🇿', '🇵🇳'], 12 | ['⬆️', '↗️', '➡️', '↘️', '⬇️', '↙️', '⬅️', '↖️', '↩️', '↪️'], 13 | ['🌒', '🌓', '🌔', '🌖', '🌗', '🌘', '🌛', '🌜', '🌝', '🌚'] 14 | ] -------------------------------------------------------------------------------- /src/structures/commands/functions/memorygame/functions/disable.memory.js: -------------------------------------------------------------------------------- 1 | import { ButtonStyle } from 'discord.js' 2 | 3 | export default (message, date) => { 4 | 5 | return setTimeout(() => disable(), date) 6 | 7 | async function disable() { 8 | 9 | const trueMessage = await message.fetch() 10 | if (!trueMessage) return 11 | 12 | const components = trueMessage.components.map(components => components.toJSON()) 13 | const allButtons = components.map(row => row.components).flat() 14 | 15 | const allGreen = allButtons.every(b => b.style === ButtonStyle.Success) 16 | if (allGreen) return 17 | 18 | for (let b of allButtons) { 19 | b.disabled = true 20 | b.emoji = JSON.parse(b.custom_id).src.e 21 | } 22 | 23 | return message.edit({ 24 | content: `⏱ | Tempo expirado.`, 25 | components 26 | }) 27 | } 28 | 29 | } -------------------------------------------------------------------------------- /src/structures/commands/functions/memorygame/functions/generator.coop.memory.js: -------------------------------------------------------------------------------- 1 | import { ButtonStyle } from 'discord.js' 2 | 3 | export default (emojis, e, memberId) => { 4 | 5 | const components = [] 6 | const id = ['a1', 'a2', 'a3', 'a4', 'a5', 'b1', 'b2', 'b3', 'b4', 'b5', 'c1', 'c2', 'c3', 'c4', 'c5', 'd1', 'd2', 'd3', 'd4', 'd5'] 7 | const duplicate = [...emojis, ...emojis] 8 | .randomize() 9 | .map((emoji, i) => ({ 10 | type: 2, 11 | emoji: '❔', 12 | custom_id: JSON.stringify({ 13 | c: 'mg', 14 | src: { 15 | id: id[i], 16 | e: emoji, 17 | mId: memberId 18 | } 19 | }), 20 | style: ButtonStyle.Secondary 21 | })) 22 | 23 | for (let i = 0; i < 4; i++) 24 | components.push({ type: 1, components: duplicate.splice(0, 5) }) 25 | 26 | return { default: components.flat() } 27 | } -------------------------------------------------------------------------------- /src/structures/commands/functions/memorygame/functions/generator.memory.js: -------------------------------------------------------------------------------- 1 | import { ButtonStyle } from 'discord.js' 2 | 3 | export default (emojis, e, limitedMode) => { 4 | 5 | const dateNow = Date.now() + 120000 6 | const components = [] 7 | const id = ['a1', 'a2', 'a3', 'a4', 'a5', 'b1', 'b2', 'b3', 'b4', 'b5', 'c1', 'c2', 'c3', 'c4', 'c5', 'd1', 'd2', 'd3', 'd4', 'd5'] 8 | const duplicate = [...emojis, ...emojis] 9 | .randomize() 10 | .map((emoji, i) => ({ 11 | type: 2, 12 | emoji: '❔', 13 | custom_id: JSON.stringify(jsonData(i, emoji)), 14 | style: ButtonStyle.Secondary 15 | })) 16 | 17 | for (let i = 0; i < 4; i++) 18 | components.push({ type: 1, components: duplicate.splice(0, 5) }) 19 | 20 | return { default: components.flat() } 21 | 22 | function jsonData(i, emoji) { 23 | 24 | const data = { 25 | c: 'mg', 26 | src: { 27 | id: id[i], 28 | e: emoji 29 | } 30 | } 31 | 32 | if (limitedMode) 33 | data.src.d = dateNow 34 | 35 | return data 36 | } 37 | } -------------------------------------------------------------------------------- /src/structures/commands/functions/memorygame/functions/generator.versus.memory.js: -------------------------------------------------------------------------------- 1 | import { ButtonStyle } from 'discord.js' 2 | 3 | export default (emojis, e, memberId) => { 4 | 5 | const components = [] 6 | const id = ['a1', 'a2', 'a3', 'a4', 'a5', 'b1', 'b2', 'b3', 'b4', 'b5', 'c1', 'c2', 'c3', 'c4', 'c5', 'd1', 'd2', 'd3', 'd4', 'd5'] 7 | const duplicate = [...emojis, ...emojis] 8 | .randomize() 9 | .map((emoji, i) => ({ 10 | type: 2, 11 | emoji: '❔', 12 | custom_id: JSON.stringify({ 13 | c: 'mg', 14 | src: { 15 | id: id[i], 16 | e: emoji, 17 | mId: memberId, 18 | up: 0, 19 | mp: 0, 20 | m: 'v' 21 | } 22 | }), 23 | style: ButtonStyle.Secondary 24 | })) 25 | 26 | for (let i = 0; i < 4; i++) 27 | components.push({ type: 1, components: duplicate.splice(0, 5) }) 28 | 29 | return { default: components.flat() } 30 | } -------------------------------------------------------------------------------- /src/structures/commands/functions/memorygame/solo.memory.js: -------------------------------------------------------------------------------- 1 | import emojisArray from './emojis.js' 2 | import buttonGenerator from './functions/generator.memory.js' 3 | import disable from './functions/disable.memory.js' 4 | 5 | export default async (interaction, Database, e) => { 6 | 7 | const { options } = interaction 8 | const mode = options.getString('mode') 9 | const limitedMinutes = mode === 'minutes' 10 | const emojiOption = options.getInteger('emojis') ?? -1 11 | const emojis = emojiOption === -1 ? emojisArray.random() : emojisArray[emojiOption] 12 | 13 | const msg = await interaction.reply({ 14 | content: `${e.Loading} | Construindo novo jogo...\n${limitedMinutes ? '⏱ | Modo limitado a 2 minutos' : ''}`, 15 | fetchReply: true 16 | }).catch(() => { }) 17 | 18 | const buttons = buttonGenerator(emojis, e, limitedMinutes) 19 | 20 | if (limitedMinutes) disable(msg, 119000) 21 | 22 | return await interaction.editReply({ 23 | content: `${e.Loading} | Tente achar os pares de emojis iguais.\n${e.Info} | Clique nos botões com calma para não estragar o jogo.\n${limitedMinutes ? `⏱ | ${Date.GetTimeout(120000, Date.now(), 'R')}` : ''}`, 24 | components: buttons.default 25 | }).catch(() => { }) 26 | } -------------------------------------------------------------------------------- /src/structures/commands/functions/memorygame/util.js: -------------------------------------------------------------------------------- 1 | export const indexButton = { 2 | a1: 0, 3 | a2: 0, 4 | a3: 0, 5 | a4: 0, 6 | a5: 0, 7 | b1: 1, 8 | b2: 1, 9 | b3: 1, 10 | b4: 1, 11 | b5: 1, 12 | c1: 2, 13 | c2: 2, 14 | c3: 2, 15 | c4: 2, 16 | c5: 2, 17 | d1: 3, 18 | d2: 3, 19 | d3: 3, 20 | d4: 3, 21 | d5: 3 22 | } -------------------------------------------------------------------------------- /src/structures/commands/functions/memorygame/versus.memory.js: -------------------------------------------------------------------------------- 1 | import emojisArray from './emojis.js' 2 | import buttonGenerator from './functions/generator.versus.memory.js' 3 | 4 | export default async (interaction, e) => { 5 | 6 | const { options, user } = interaction 7 | const member = options.getUser('member') 8 | 9 | if (member.id === user.id || member.bot) 10 | return await interaction.reply({ 11 | content: `${e.Deny} | Você não pode jogar com bots ou com você mesmo.`, 12 | ephemeral: true 13 | }) 14 | 15 | const emojiOption = options.getInteger('emojis') ?? -1 16 | const emojis = emojiOption === -1 ? emojisArray.random() : emojisArray[emojiOption] 17 | const playNow = [member, user].random() 18 | 19 | await interaction.reply({ 20 | content: `${e.Loading} | Construindo novo jogo competitivo...` 21 | }).catch(() => { }) 22 | 23 | const buttons = buttonGenerator(emojis, e, member.id) 24 | 25 | return await interaction.editReply({ 26 | content: `${e.Loading} | Tente achar os pares de emojis iguais.\n${e.Info} | Clique nos botões com calma para não estragar o jogo.\n🆚 | Modo competitivo: ${playNow}, é sua vez.\n📉 | ${user.username} \`0\` x \`0\` ${member.username}`, 27 | components: buttons.default 28 | }).catch(() => { }) 29 | } -------------------------------------------------------------------------------- /src/structures/commands/functions/tictactoe/generateButton.tictactoe.js: -------------------------------------------------------------------------------- 1 | import { ButtonStyle } from 'discord.js' 2 | 3 | export default (opponentId, authorId) => { 4 | 5 | /** 6 | * A1 A2 A3 7 | * B1 B2 B3 8 | * C1 C2 C3 9 | */ 10 | 11 | const components = [] 12 | const id = ['a1', 'a2', 'a3', 'b1', 'b2', 'b3', 'c1', 'c2', 'c3'] 13 | const buttons = id.map(id => ({ 14 | type: 2, 15 | emoji: '➖', 16 | custom_id: JSON.stringify({ 17 | c: 'ttt', 18 | src: { 19 | id: id, 20 | opponent: opponentId, 21 | authorId 22 | } 23 | }), 24 | style: ButtonStyle.Secondary 25 | })) 26 | 27 | for (let i = 0; i < 3; i++) 28 | components.push({ type: 1, components: buttons.splice(0, 3) }) 29 | 30 | return components.flat() 31 | 32 | } -------------------------------------------------------------------------------- /src/structures/commands/functions/tictactoe/newGame.tictactoe.js: -------------------------------------------------------------------------------- 1 | import { ChatInputCommandInteraction, GuildMember, Message } from 'discord.js'; 2 | import { Emojis as e } from '../../../../util/util.js'; 3 | import buttonGenerator from './generateButton.tictactoe.js'; 4 | 5 | /** 6 | * @param { ChatInputCommandInteraction | undefined } interaction 7 | * @param { GuildMember } opponent 8 | * @param { Message | undefined } message 9 | */ 10 | export default async (interaction, opponent, message) => { 11 | 12 | const components = buttonGenerator(opponent.id, interaction?.user?.id || message?.author?.id) 13 | 14 | const playerRandom = [interaction?.user || message.author, opponent].random() 15 | const dataReply = { content: `${e.Loading} | ${playerRandom}, é sua vez.`, components } 16 | 17 | if (message) return message.reply(dataReply) 18 | if (interaction) return interaction.reply(dataReply) 19 | return 20 | } -------------------------------------------------------------------------------- /src/structures/commands/prefix/bot/invite.js: -------------------------------------------------------------------------------- 1 | import { SaphireClient as client } from '../../../../classes/index.js'; 2 | import { Emojis as e } from '../../../../util/util.js'; 3 | import { Message } from 'discord.js'; 4 | 5 | export default { 6 | name: 'invite', 7 | description: 'Link de convite da Saphire', 8 | aliases: ['convite', 'inv', 'conv'], 9 | category: "Saphire", 10 | api_data: { 11 | tags: [], 12 | perms: { user: [], bot: [] } 13 | }, 14 | /** 15 | * @param { Message } message 16 | * @param { string[] } args 17 | */ 18 | async execute(message, args) { 19 | return message.reply({ 20 | embeds: [{ 21 | color: client.green, 22 | description: `${e.Animated.SaphireDance} Você pode me adicionar [clicando aqui](https://discord.com/oauth2/authorize?client_id=${client.user.id}&scope=bot%20applications.commands&permissions=2146958847).` 23 | }] 24 | }) 25 | } 26 | } -------------------------------------------------------------------------------- /src/structures/commands/prefix/economy/daily.js: -------------------------------------------------------------------------------- 1 | import { Message } from 'discord.js' 2 | import Daily from '../../slash/economy/daily/new.daily.js' 3 | 4 | export default { 5 | name: 'daily', 6 | description: 'Pegue uma recompensa diária todos os dias', 7 | aliases: ['diário'], 8 | category: "Economia", 9 | api_data: { 10 | tags: [], 11 | perms: { user: [], bot: [] } 12 | }, 13 | /** 14 | * @param { Message } message 15 | * @param { string[] } args 16 | */ 17 | async execute(message, args) { 18 | return new Daily({}, message).executePrefixCommand(message, args) 19 | } 20 | } -------------------------------------------------------------------------------- /src/structures/commands/prefix/games/tictactoe.js: -------------------------------------------------------------------------------- 1 | import { Message } from 'discord.js' 2 | import { Emojis as e } from '../../../../util/util.js' 3 | import TicTacToe from '../../functions/tictactoe/newGame.tictactoe.js' 4 | 5 | export default { 6 | name: 'tictactoe', 7 | description: 'O famoso jogo da velha', 8 | aliases: ['jogodavelha', 'jgv', 'ttt'], 9 | category: "Diversão", 10 | api_data: { 11 | tags: [], 12 | perms: { user: [], bot: [] } 13 | }, 14 | /** 15 | * @param { Message } message 16 | * @param { string[] } args 17 | */ 18 | async execute(message, args) { 19 | 20 | const member = await message.getMember(args[0]) 21 | 22 | if ( 23 | !member 24 | || member.user.id == message.author.id 25 | || member.user.bot 26 | ) return message.reply({ content: `${e.Deny} | Hey, selecione alguém para jogar contra você. Menos você mesmo e bots, eles ganhariam de você facilmente.` }) 27 | 28 | return TicTacToe(undefined, member, message) 29 | } 30 | } -------------------------------------------------------------------------------- /src/structures/commands/slash/admin/functions/admin/commit.admin.js: -------------------------------------------------------------------------------- 1 | import axios from "axios" 2 | import { Emojis as e } from "../../../../../../util/util.js" 3 | import { SaphireClient as client } from "../../../../../../classes/index.js" 4 | 5 | export default async interaction => { 6 | 7 | const { options } = interaction 8 | const discloudFile = options.getAttachment('discloud') 9 | const apiFile = options.getAttachment('api') 10 | 11 | if (!discloudFile && !api) 12 | return await interaction.reply({ 13 | content: `${e.Deny} | Pelo menos um arquivo deve ser enviado para alguma host.` 14 | }) 15 | 16 | if (discloudFile && discloudFile.contentType !== 'application/zip') 17 | return await interaction.reply({ 18 | content: `${e.Deny} | O arquivo enviado para a Discloud não está no formato \`.zip\``, 19 | ephemeral: true 20 | }) 21 | 22 | if (apiFile && apiFile.contentType !== 'application/zip') 23 | return await interaction.reply({ 24 | content: `${e.Deny} | O arquivo enviado para a API não está no formato \`.zip\``, 25 | ephemeral: true 26 | }) 27 | 28 | await interaction.reply({ 29 | content: `${e.Loading} | Enviando arquivo de commit para a Saphire API...` 30 | }) 31 | 32 | return await axios.post(client.apiUrl + '/commit', {}, { 33 | headers: { 34 | authorization: process.env.COMMIT_AUTHORIZATION, 35 | discloud: discloudFile?.attachment || null, 36 | api: apiFile?.attachment || null 37 | } 38 | }) 39 | .then(async () => await interaction.editReply({ content: `${e.Check} | Arquivo de commit enviado com sucesso.` }).catch(() => { })) 40 | .catch(async err => await interaction.editReply({ content: `${e.Deny} | Não foi possível efetuar o envio do arquivo de commit.\n${e.bug} | \`${err}\`` }).catch(() => { })) 41 | 42 | } -------------------------------------------------------------------------------- /src/structures/commands/slash/admin/functions/admin/delete.admin.js: -------------------------------------------------------------------------------- 1 | import { Database } from "../../../../../../classes/index.js" 2 | import { Emojis as e } from "../../../../../../util/util.js" 3 | 4 | export default async interaction => { 5 | 6 | const { options } = interaction 7 | const userId = options.getString('user') 8 | const serverId = options.getString('server') 9 | let responseMessage = '' 10 | 11 | await deleteUser() 12 | await deleteServer() 13 | 14 | if (!responseMessage) 15 | return await interaction.reply({ 16 | content: `${e.Deny} | Forneça um ID de um servidor ou usuário para efetuar o delete do banco de dados.`, 17 | ephemeral: true 18 | }) 19 | 20 | return await interaction.reply({ content: responseMessage }) 21 | 22 | async function deleteUser() { 23 | 24 | if (!userId) return 25 | 26 | const hasUser = await Database.User.exists({ id: userId }) 27 | 28 | if (!hasUser) 29 | return responseMessage += `\n${e.Deny} | Esse usuário não existe no banco de dados.` 30 | 31 | await Database.deleteUser(userId) 32 | return responseMessage += `\n${e.Check} | Esse usuário foi deletado com sucesso do banco de dados.` 33 | } 34 | 35 | async function deleteServer() { 36 | 37 | if (!serverId) return 38 | 39 | const hasGuild = await Database.Guild.exists({ id: serverId }) 40 | 41 | if (!hasGuild) 42 | return responseMessage += `\n${e.Deny} | Esse servidor não existe no banco de dados.` 43 | 44 | Database.deleteGuild(serverId) 45 | return responseMessage += `\n${e.Check} | Servidor deletado com sucesso do banco de dados.` 46 | } 47 | 48 | } -------------------------------------------------------------------------------- /src/structures/commands/slash/admin/functions/admin/fanart.admin.js: -------------------------------------------------------------------------------- 1 | import { Modals } from "../../../../../../classes/index.js" 2 | import { Emojis as e } from "../../../../../../util/util.js" 3 | 4 | export default async interaction => { 5 | 6 | const { options } = interaction 7 | const user = options.getUser("add") 8 | 9 | if (!user) 10 | return await interaction.reply({ 11 | content: `${e.Deny} | Usuário não encontrado.`, 12 | ephemeral: true 13 | }) 14 | 15 | return await interaction.showModal(Modals.addFanart(user)) 16 | 17 | } -------------------------------------------------------------------------------- /src/structures/commands/slash/admin/functions/admin/fetch_guild_members.admin.js: -------------------------------------------------------------------------------- 1 | import { SaphireClient as client } from "../../../../../../classes/index.js" 2 | import { Emojis as e } from "../../../../../../util/util.js" 3 | 4 | export default async interaction => { 5 | 6 | const { options } = interaction 7 | const guildId = options.getString('guild_id') 8 | await interaction.reply({ content: `${e.Loading} | Fetching...`, ephemeral: true }) 9 | 10 | const guild = await client.guilds.fetch(guildId).catch(() => null) 11 | 12 | if (!guild) 13 | return await interaction.editReply({ content: `${e.DenyX} | Servidor não encontrado.` }).catch(() => { }) 14 | 15 | const members = await guild.members.fetch().catch(() => null) 16 | 17 | if (!members) 18 | return await interaction.editReply({ content: `${e.DenyX} | Não foi possível executar o fetch dos membros do servidor \`${guild?.name || `Not Found`} - ${guildId}\`` }).catch(() => { }) 19 | 20 | return await interaction.editReply({ content: `${e.CheckV} | ${members.size} membros coletados neste fetch do servidor \`${guild?.name || `Not Found`} - ${guildId}\`.` }).catch(() => { }) 21 | } -------------------------------------------------------------------------------- /src/structures/commands/slash/admin/functions/admin/functions.admin.js: -------------------------------------------------------------------------------- 1 | import fetch_guild_members from './fetch_guild_members.admin.js' 2 | import roles_server from './roles_server.admin.js' 3 | import commands from './commandManager.admin.js' 4 | import register from './register.admin.js' 5 | import deleteDb from './delete.admin.js' 6 | import fanart from './fanart.admin.js' 7 | import commit from './commit.admin.js' 8 | import invite from './invite.admin.js' 9 | import reboot from './reboot.admin.js' 10 | import backup from './backup.admin.js' 11 | import test from './test.admin.js' 12 | 13 | export default async (interaction, subCommand) => { 14 | 15 | const command = { 16 | register, commands, test, fanart, commit, invite, reboot, 17 | delete: deleteDb, backup, fetch_guild_members, roles_server 18 | }[subCommand] 19 | 20 | if (!command) 21 | return await interaction.reply({ 22 | content: 'Sub-Command Function Not Found', 23 | ephemeral: true 24 | }) 25 | 26 | return command(interaction) 27 | } -------------------------------------------------------------------------------- /src/structures/commands/slash/admin/functions/admin/invite.admin.js: -------------------------------------------------------------------------------- 1 | import { SaphireClient as client } from "../../../../../../classes/index.js"; 2 | import { Emojis as e } from "../../../../../../util/util.js"; 3 | import { time } from "discord.js"; 4 | import axios from "axios"; 5 | 6 | export default async interaction => { 7 | 8 | const { options } = interaction 9 | const guildId = options.getString('server') 10 | 11 | const invites = await axios({ 12 | url: `https://discord.com/api/v10/guilds/${guildId}/invites`, 13 | method: 'GET', 14 | headers: { 15 | Authorization: `Bot ${process.env.DISCORD_TOKEN}` 16 | } 17 | }) 18 | .then(res => res.data) 19 | .catch(() => null) 20 | 21 | if (!invites) 22 | return await interaction.reply({ 23 | content: `${e.Deny} | Não foi possível obter nenhum link de convite deste servidor.`, 24 | ephemeral: true 25 | }) 26 | 27 | if (!invites.length) 28 | return await interaction.reply({ 29 | content: `${e.Deny} | Servidor sem nenhum convite.`, 30 | ephemeral: true 31 | }) 32 | 33 | const description = invites 34 | .slice(0, 50) 35 | .map(inv => `[${inv.code}](https://discord.gg/${inv.code}) ${inv.expires_at ? `${time(new Date(inv.expires_at), 'R')}` : 'Permanente'}`) 36 | .join('\n') 37 | .limit("MessageEmbedDescription") 38 | 39 | return interaction.reply({ 40 | embeds: [{ 41 | color: client.blue, 42 | title: '🔍 Convites do Servidor Requisitado', 43 | description: description || 'Nenhum convite disponível' 44 | }] 45 | }) 46 | } -------------------------------------------------------------------------------- /src/structures/commands/slash/admin/functions/admin/reboot.admin.js: -------------------------------------------------------------------------------- 1 | import { Database, SaphireClient as client } from "../../../../../../classes/index.js"; 2 | import { Emojis as e } from "../../../../../../util/util.js"; 3 | import { Config } from "../../../../../../util/Constants.js"; 4 | 5 | export default async interaction => { 6 | 7 | const { user, options, channel } = interaction 8 | 9 | if (user.id !== Config.ownerId) 10 | return await interaction.reply({ 11 | content: `${e.Deny} | Apenas o meu desenvolvedor pode iniciar este processo.`, 12 | ephemeral: true 13 | }) 14 | 15 | const message = options.getString('message') || 'Nenhum dado informado.' 16 | client.restart = message 17 | 18 | const msg = await interaction.reply({ content: `${e.Loading} | Reboot inicializado.`, fetchReply: true }) 19 | 20 | await Database.Cache.Client.set('Restart', { channelId: channel.id, message, messageId: msg.id }) 21 | return 22 | } -------------------------------------------------------------------------------- /src/structures/commands/slash/admin/functions/admin/test.admin.js: -------------------------------------------------------------------------------- 1 | export default () => { } -------------------------------------------------------------------------------- /src/structures/commands/slash/admin/functions/blacklist/remove.blacklist.js: -------------------------------------------------------------------------------- 1 | import { SaphireClient as client, Database } from "../../../../../../classes/index.js"; 2 | import { ChatInputCommandInteraction } from "discord.js"; 3 | import { Emojis as e } from "../../../../../../util/util.js"; 4 | import { socket } from "../../../../../../websocket/websocket.js"; 5 | 6 | /** 7 | * @param { ChatInputCommandInteraction } interaction 8 | */ 9 | export default async interaction => { 10 | 11 | const { user, options } = interaction 12 | if (!client.staff.includes(user.id)) 13 | return interaction.reply({ content: `${e.DenyX} | Acesso negado.`, ephemeral: true }) 14 | 15 | const id = options.getString("target") 16 | 17 | if (!id) 18 | return interaction.reply({ content: `$${e.DenyX} | Nenhum ID foi fornecido.`, ephemeral: true }) 19 | 20 | await interaction.reply({ content: `${e.Loading} | Removendo usuário da blacklist...` }) 21 | 22 | if (!socket?.connected) 23 | return interaction.editReply({ 24 | content: `${e.DenyX} | Websocket está se reconectando ou perdeu a conexão com a API. Por favor, tente novamente.` 25 | }).catch(() => { }) 26 | 27 | return await Database.Blacklist.deleteMany({ id }) 28 | .then(doc => { 29 | socket.send({ type: "clearIDBlacklist", id }) 30 | return interaction.editReply({ 31 | content: `${e.Info} | ${doc.deletedCount} alvos removidos da blacklist.` 32 | }).catch(() => { }) 33 | }) 34 | .catch(err => interaction.editReply({ content: `${e.DenyX} | Erro ao remover o alvo da blacklist.\n${e.bug} | \`${err}\`` }).catch(() => { })) 35 | } -------------------------------------------------------------------------------- /src/structures/commands/slash/admin/functions/discloud/apps.discloud.js: -------------------------------------------------------------------------------- 1 | import { SaphireClient as client, Discloud } from '../../../../../../classes/index.js' 2 | import { Emojis as e } from '../../../../../../util/util.js' 3 | 4 | export default async interaction => { 5 | 6 | await interaction.reply({ 7 | content: `${e.Loading} | Solicitando informações a Discloud Host...` 8 | }) 9 | 10 | const response = await Discloud.apps.fetch() 11 | 12 | if (!response) 13 | return await interaction.editReply({ 14 | content: `${e.Deny} | Nenhuma informação foi coletada.` 15 | }).catch(() => { }) 16 | 17 | const apps = [...response.values()] 18 | const embeds = [] 19 | 20 | for (let app of apps) 21 | embeds.push({ 22 | color: client.blue, 23 | title: '🤖 Informações das Aplicações | Discloud', 24 | fields: [ 25 | { 26 | name: '🧩 Informações Basicas', 27 | value: `Auto Restart: ${app.autoRestart ? e.Check : e.Deny}\nid: \`${app.id}\`\nLinguagem: \`${app.lang}\`\nArquivo Principal: \`${app.mainFile}\`` 28 | }, 29 | { 30 | name: `🛡 Moderadores - ${app.mods.length}`, 31 | value: app.mods.length > 0 ? app.mods.map(id => `${client.users.resolve(id)?.tag} - \`${id}\`` || `*Not Found* - \`${id}\``).join('\n') : 'Nenhum moderador' 32 | }, 33 | { 34 | name: '📡 Status', 35 | value: `${app.online ? `🟢 Online com ${e.Ram} ${app.ram}MB RAM disponível` : '🔴 Offline'}` 36 | } 37 | ] 38 | }) 39 | 40 | return await interaction.editReply({ 41 | content: null, 42 | embeds: embeds 43 | }) 44 | 45 | } -------------------------------------------------------------------------------- /src/structures/commands/slash/admin/functions/discloud/backup.discloud.js: -------------------------------------------------------------------------------- 1 | import { SaphireClient as client, Discloud } from '../../../../../../classes/index.js' 2 | import { Emojis as e } from '../../../../../../util/util.js' 3 | 4 | export default async interaction => { 5 | 6 | await interaction.deferReply({ ephemeral: true }) 7 | 8 | const response = await Discloud.apps.backup('saphire') 9 | 10 | if (!response) 11 | return interaction.editReply({ 12 | content: `${e.Deny} | Não foi possível concluir do backup.` 13 | }).catch(() => { }) 14 | 15 | return interaction.editReply({ 16 | embeds: [{ 17 | color: client.blue, 18 | title: `${e.Check} Discloud Backup`, 19 | description: `[Backup](${response.url}) gerado com sucesso.` 20 | }] 21 | }).catch(() => { }) 22 | 23 | 24 | 25 | } -------------------------------------------------------------------------------- /src/structures/commands/slash/admin/functions/discloud/clear.discloud.js: -------------------------------------------------------------------------------- 1 | import { Emojis as e } from "../../../../../../util/util.js" 2 | 3 | export default async interaction => { 4 | 5 | console.clear() 6 | 7 | return await interaction.reply({ 8 | content: `${e.Check} | O terminal foi limpo com sucesso.`, 9 | ephemeral: true 10 | }) 11 | } -------------------------------------------------------------------------------- /src/structures/commands/slash/admin/functions/discloud/functions.discloud.js: -------------------------------------------------------------------------------- 1 | import logs from './logs.discloud.js' 2 | import backup from './backup.discloud.js' 3 | import user from './user.discloud.js' 4 | import restart from './restart.discloud.js' 5 | import stop from './stop.discloud.js' 6 | import start from './start.discloud.js' 7 | import update from './update.discloud.js' 8 | import apps from './apps.discloud.js' 9 | import clear from './clear.discloud.js' 10 | 11 | export { 12 | logs, 13 | backup, 14 | user, 15 | restart, 16 | stop, 17 | start, 18 | update, 19 | apps, 20 | clear 21 | } -------------------------------------------------------------------------------- /src/structures/commands/slash/admin/functions/discloud/logs.discloud.js: -------------------------------------------------------------------------------- 1 | import { SaphireClient as client, Discloud } from '../../../../../../classes/index.js' 2 | import { Emojis as e } from '../../../../../../util/util.js' 3 | 4 | export default async interaction => { 5 | 6 | await interaction.deferReply({}) 7 | 8 | const response = await Discloud.apps.terminal('saphire').catch(() => null) 9 | 10 | if (!response) 11 | return await interaction.editReply({ 12 | content: `${e.Deny} | Não foi possível acessar o terminal.` 13 | }) 14 | 15 | if (!response.small || !response.small.length) 16 | return await interaction.editReply({ 17 | content: `${e.Deny} | O logs da aplicação está vázio.` 18 | }) 19 | 20 | return await interaction.editReply({ 21 | embeds: [{ 22 | color: client.blue, 23 | title: `${e.Reference} Discloud Logs`, 24 | url: response.url, 25 | description: `\`\`\`txt\n${response.small}\`\`\``.limit('MessageEmbedDescription') 26 | }] 27 | }).catch(() => { }) 28 | 29 | } -------------------------------------------------------------------------------- /src/structures/commands/slash/admin/functions/discloud/restart.discloud.js: -------------------------------------------------------------------------------- 1 | import { SaphireClient as client, Discloud } from '../../../../../../classes/index.js' 2 | import { Emojis as e } from '../../../../../../util/util.js' 3 | 4 | export default async interaction => { 5 | 6 | const { channel } = interaction 7 | 8 | const msg = await interaction.reply({ 9 | content: `${e.Loading} | Solicitando restart a Discloud Host...`, 10 | fetchReply: true 11 | }) 12 | 13 | client.restart = 'System reload was required.' 14 | await Database.Cache.Client.set('Restart', { 15 | channelId: channel.id, 16 | messageId: msg.id 17 | }) 18 | const response = await Discloud.apps.restart('saphire') 19 | 20 | if (!response) { 21 | delete client.restart 22 | await Database.Cache.Client.delete('Restart') 23 | return interaction.editReply({ content: `${e.Deny} | Não foi possível concluir o restart.` }).catch(() => { }) 24 | } 25 | 26 | return interaction.editReply({ content: `${e.Loading} | Reiniciando...` }).catch(() => { }) 27 | 28 | } -------------------------------------------------------------------------------- /src/structures/commands/slash/admin/functions/discloud/start.discloud.js: -------------------------------------------------------------------------------- 1 | import { Discloud } from '../../../../../../classes/index.js' 2 | import { Emojis as e } from '../../../../../../util/util.js' 3 | 4 | export default async interaction => { 5 | 6 | await interaction.reply({ 7 | content: `${e.Loading} | Solicitando start do client a Discloud Host...`, 8 | fetchReply: true 9 | }) 10 | 11 | const response = await Discloud.apps.start('saphire') 12 | 13 | if (!response) 14 | return await interaction.editReply({ 15 | content: `${e.Deny} | Não foi possível concluir o start.` 16 | }) 17 | 18 | return await interaction.editReply({ 19 | content: `${e.Check} | Inicialização solicitada com sucesso.`, 20 | }).catch(() => { }) 21 | } -------------------------------------------------------------------------------- /src/structures/commands/slash/admin/functions/discloud/stop.discloud.js: -------------------------------------------------------------------------------- 1 | import { Discloud } from '../../../../../../classes/index.js' 2 | import { Emojis as e } from '../../../../../../util/util.js' 3 | 4 | export default async interaction => { 5 | 6 | await interaction.reply({ 7 | content: `${e.Loading} | Solicitando desligamento do client na Discloud Host...`, 8 | fetchReply: true 9 | }) 10 | 11 | const response = await Discloud.apps.stop('saphire') 12 | 13 | if (!response) 14 | return await interaction.editReply({ 15 | content: `${e.Deny} | Não foi possível desligar o cliente.` 16 | }) 17 | 18 | return await interaction.editReply({ 19 | content: `${e.Check} | App parado com sucesso.`, 20 | }).catch() 21 | 22 | } -------------------------------------------------------------------------------- /src/structures/commands/slash/admin/functions/discloud/update.discloud.js: -------------------------------------------------------------------------------- 1 | import { Discloud } from '../../../../../../classes/index.js' 2 | import { Emojis as e } from '../../../../../../util/util.js' 3 | 4 | export default async interaction => { 5 | 6 | await interaction.deferReply({}) 7 | 8 | const response = await Discloud.apps.update('saphire', { file: './src.zip' }) 9 | .catch(err => { 10 | console.log(err) 11 | return false 12 | }) 13 | 14 | if (!response) 15 | return interaction.editReply({ content: `${e.Deny} | Não foi possivel realizar o commit.` }).catch(() => { }) 16 | 17 | return interaction.editReply({ content: `${e.Check} | Commit realizado com sucesso.` }).catch(() => { }) 18 | } -------------------------------------------------------------------------------- /src/structures/commands/slash/bot/botinfo.js: -------------------------------------------------------------------------------- 1 | import botinfoSaphire from "../../functions/bot/botinfo.saphire.js"; 2 | 3 | export default { 4 | name: 'botinfo', 5 | description: '[bot] Informações gerais referente ao bot', 6 | category: "bot", 7 | dm_permission: false, 8 | database: false, 9 | type: 1, 10 | api_data: { 11 | name: "botinfo", 12 | description: "Veja as informações técnicas da Saphire", 13 | category: "Saphire", 14 | synonyms: [], 15 | tags: [], 16 | perms: { 17 | user: [], 18 | bot: [] 19 | } 20 | }, 21 | execute: async ({ interaction }) => botinfoSaphire(interaction) 22 | } -------------------------------------------------------------------------------- /src/structures/commands/slash/bot/bug.js: -------------------------------------------------------------------------------- 1 | import { ApplicationCommandOptionType } from 'discord.js' 2 | import { Modals } from '../../../../classes/index.js' 3 | 4 | export default { 5 | name: 'bug', 6 | description: '[bot] Report bugs aos meus administradores', 7 | category: "bot", 8 | dm_permission: false, 9 | database: false, 10 | type: 1, 11 | options: [ 12 | { 13 | name: 'command', 14 | description: 'Comando que está bugado', 15 | type: ApplicationCommandOptionType.String, 16 | autocomplete: true 17 | } 18 | ], 19 | helpData: { 20 | description: 'Report bugs em comandos para meus administradores', 21 | }, 22 | api_data: { 23 | name: "bug", 24 | description: "Reporte um erro que você achou na Saphire", 25 | category: "Saphire", 26 | synonyms: [], 27 | tags: [], 28 | perms: { 29 | user: [], 30 | bot: [] 31 | } 32 | }, 33 | async execute({ interaction, client }) { 34 | 35 | return await interaction 36 | .showModal( 37 | Modals 38 | .reportBug( 39 | client.slashCommands 40 | .get(interaction.options.getString('command')) 41 | ) 42 | ) 43 | } 44 | } -------------------------------------------------------------------------------- /src/structures/commands/slash/bot/invite.js: -------------------------------------------------------------------------------- 1 | import { Emojis as e } from '../../../../util/util.js'; 2 | import { Colors } from '../../../../util/Constants.js'; 3 | 4 | export default { 5 | name: 'invite', 6 | name_localizations: { "en-US": "invite", 'pt-BR': 'convite' }, 7 | description: '[bot] Um link rápido para me colocar no seu servidor', 8 | category: "bot", 9 | dm_permission: false, 10 | database: false, 11 | type: 1, 12 | helpData: { 13 | description: 'Você pode me convidar usando esse comando. Legal, né? Tipo me convidar [clicando aqui](https://discord.com/oauth2/authorize?client_id=912509487984812043&scope=bot%20applications.commands&permissions=2146958847)' 14 | }, 15 | options: [], 16 | api_data: { 17 | name: "invite", 18 | description: "Receba um convite direto para me adicionar no seu servidor.", 19 | category: "Saphire", 20 | synonyms: ["convite"], 21 | tags: [], 22 | perms: { 23 | user: [], 24 | bot: [] 25 | } 26 | }, 27 | execute({ interaction, client }) { 28 | return interaction.reply({ 29 | embeds: [{ 30 | color: Colors.Green, 31 | description: `${e.Animated.SaphireDance} Você pode me adicionar [clicando aqui](https://discord.com/oauth2/authorize?client_id=${client.user.id}&scope=bot%20applications.commands&permissions=2146958847).` 32 | }] 33 | }) 34 | } 35 | } -------------------------------------------------------------------------------- /src/structures/commands/slash/economy/bet/class.bet.js: -------------------------------------------------------------------------------- 1 | import { Base } from '../../../../../classes/index.js' 2 | import end from './functions/end.bet.js' 3 | 4 | export default class Bet extends Base { 5 | constructor(message) { 6 | super() 7 | this.msg = message 8 | } 9 | 10 | async finish(message) { 11 | return end(message) 12 | } 13 | 14 | async save(messageId, data) { 15 | return await this.Database.Cache.Bet.set(messageId, data) 16 | } 17 | } -------------------------------------------------------------------------------- /src/structures/commands/slash/economy/bet/functions/addPlayer.bet.js: -------------------------------------------------------------------------------- 1 | import { Database, SaphireClient as client } from "../../../../../../classes/index.js" 2 | import { Emojis as e } from "../../../../../../util/util.js" 3 | import realizeBet from './realize.bet.js' 4 | 5 | export default async (cachedData, message, userId, finalize) => { 6 | 7 | const returnedData = await Database.Cache.Bet.push(`${message.id}.players`, userId) 8 | const thisBet = returnedData 9 | const newPlayers = thisBet.players 10 | const embed = message?.embeds[0]?.data 11 | const emojis = [e.OwnerCrow, '👤'] 12 | 13 | if (!embed) { 14 | client.emit('betRefund', cachedData) 15 | return await message.edit({ 16 | content: `${e.Deny} | Embed da aposta não encontrada.\n${e.Info} | Dinheiro devolvido a todos os participantes.`, 17 | embeds: [] 18 | }) 19 | } 20 | 21 | const betAuthorId = message.interaction.user.id 22 | 23 | embed.fields[0] = { 24 | name: `👥 Jogadores - ${newPlayers.length}/${cachedData.playersCount}`, 25 | value: newPlayers 26 | .map(id => `${id === betAuthorId ? emojis[0] : emojis[1]} <@${id}>`) 27 | .join('\n') 28 | .limit('MessageEmbedFieldValue') 29 | } 30 | 31 | const sucess = await message.edit({ embeds: [embed] }) 32 | .catch(() => null) 33 | 34 | if (sucess === null) { 35 | client.emit('betRefund', cachedData) 36 | return message.channel.send({ 37 | content: `${e.Deny} | Não foi possível editar a embed da aposta.\n${e.Info} | Todos os usuários teve seu dinheiro devolvido.` 38 | }) 39 | } 40 | 41 | Database.subtract(userId, cachedData.amount) 42 | if (finalize) return realizeBet(await Database.Cache.Bet.get(message.id), message) 43 | 44 | } -------------------------------------------------------------------------------- /src/structures/commands/slash/economy/bet/functions/button.multiplier.js: -------------------------------------------------------------------------------- 1 | import { ButtonStyle, parseEmoji } from "discord.js" 2 | import { Emojis as e } from "../../../../../../util/util.js" 3 | 4 | export default (mines = 0) => { 5 | 6 | let buttonId = 0 7 | const buttons = [] 8 | let emojis = [] 9 | 10 | for (let i = 0; i <= 24; i++) { 11 | mines > 0 ? emojis.push(1) : emojis.push(0) 12 | mines-- 13 | } 14 | 15 | emojis = emojis.sort(() => Math.random() - Math.random()) 16 | 17 | for (let a = 0; a <= 3; a++) { 18 | const keyLetter = ['a', 'b', 'c', 'd'][a] 19 | const button = { type: 1, components: [] } 20 | for (let i = 0; i <= 4; i++) 21 | button.components.push({ 22 | type: 2, 23 | emoji: parseEmoji(e.Animated.SaphireQuestion), 24 | custom_id: JSON.stringify({ c: 'bet', src: 'multi', type: 'game', id: `${keyLetter}${buttonId++}`, e: emojis[buttonId] }), 25 | style: ButtonStyle.Secondary 26 | }) 27 | 28 | buttons.push(button) 29 | } 30 | 31 | buttons.push({ 32 | type: 1, 33 | components: [ 34 | ...[1, 2, 3, 4].map(() => ({ 35 | type: 2, 36 | emoji: parseEmoji(e.Animated.SaphireQuestion), 37 | custom_id: JSON.stringify({ c: 'bet', src: 'multi', type: 'game', id: `e${buttonId++}`, e: emojis[buttonId] }), 38 | style: ButtonStyle.Secondary 39 | })), 40 | { 41 | type: 2, 42 | label: 'Parar', 43 | custom_id: JSON.stringify({ c: 'bet', src: 'multi', type: 'game', id: 'finish' }), 44 | style: ButtonStyle.Primary 45 | } 46 | ] 47 | }) 48 | 49 | return buttons 50 | } -------------------------------------------------------------------------------- /src/structures/commands/slash/economy/bet/functions/end.bet.js: -------------------------------------------------------------------------------- 1 | import { Emojis as e } from "../../../../../../util/util.js" 2 | import { SaphireClient as client, Database } from "../../../../../../classes/index.js" 3 | import realizeBet from "./realize.bet.js" 4 | 5 | export default async (message) => { 6 | 7 | const thisBet = await Database.Cache.Bet.get(message.id) || {} 8 | if (!thisBet) return 9 | 10 | if (thisBet?.players?.length > 1) return realizeBet(thisBet, message) 11 | 12 | const embed = message.embeds[0]?.data 13 | 14 | if (!embed) 15 | return await message.edit({ 16 | content: `${e.Deny} | Finalização corrompida.` 17 | }).catch(() => { }) 18 | 19 | embed.color = client.red 20 | embed.footer = { text: 'Aposta encerrada' } 21 | embed.fields[2].value = 'Tempo esgotado' 22 | 23 | message.reactions.removeAll().catch(() => { }) 24 | 25 | client.emit('betRefund', thisBet) 26 | 27 | return await message.edit({ embeds: [embed] }).catch(() => { }) 28 | } -------------------------------------------------------------------------------- /src/structures/commands/slash/economy/bet/refund.bet.js: -------------------------------------------------------------------------------- 1 | import { Database, SaphireClient as client } from '../../../../../classes/index.js' 2 | 3 | export default async ({ interaction, e }) => { 4 | 5 | const { options, user, guild } = interaction 6 | const messageId = options.getString('available_bets') 7 | if (messageId === 'all') return refundAll() 8 | 9 | const cachedData = await Database.Cache.Bet.get(messageId) 10 | 11 | if (!cachedData) 12 | return await interaction.reply({ 13 | content: `${e.Deny} | Dados da aposta não encontrado.`, 14 | ephemeral: true 15 | }) 16 | 17 | client.emit('betRefund', cachedData) 18 | return await interaction.reply({ 19 | content: `${e.Check} | A aposta foi resgatada e todos os participantes receberam seu dinheiro novamente.\n${e.Info} | A aposta não está mais disponível, qualquer reação irá desativa-la.\n> Aposta \`${messageId}\` resgatada e deletada.` 20 | }) 21 | 22 | async function refundAll() { 23 | 24 | const cachedInArray = await Database.Cache.Bet.all() || [] 25 | const allBetAuthor = cachedInArray.filter(bet => bet?.value?.authorId === user.id) 26 | let totalValue = 0 27 | 28 | for await (let { id, value } of allBetAuthor) { 29 | totalValue += parseInt((value.amount || value.value) * ((value.players?.length || [value?.red || [], value?.blue || []].flat().length) || 1)) 30 | await Database.Cache.Bet.delete(value.messageId || id) 31 | client.emit('betRefund', value, true) 32 | continue 33 | } 34 | 35 | return await interaction.reply({ 36 | content: `${e.Check} | Todas as ${allBetAuthor.length} apostas foram resgatas e todos os usuários de todas as apostas receberam seu dinheiro de volta.\n${e.Info} | Um total de **${totalValue} ${await guild.getCoin()}** foram movimentados nessas apostas.` 37 | }) 38 | } 39 | } -------------------------------------------------------------------------------- /src/structures/commands/slash/economy/emojibet/admin.emoji.js: -------------------------------------------------------------------------------- 1 | import { Modals, SaphireClient as client } from "../../../../../classes/index.js" 2 | import { Emojis as e } from "../../../../../util/util.js" 3 | 4 | export default async (interaction, method) => { 5 | 6 | const { user } = interaction 7 | 8 | if (!client.admins.includes(user.id)) 9 | return await interaction.reply({ 10 | content: `${e.Deny} | Apenas administradores do meu sistema tem acesso a este comando.`, 11 | ephemeral: true 12 | }) 13 | 14 | if (method === 'add') 15 | return await interaction.showModal(Modals.addEmoji) 16 | 17 | return await interaction.reply({ 18 | content: `${e.Loading} | Comando em construção.`, 19 | ephemeral: true 20 | }) 21 | } -------------------------------------------------------------------------------- /src/structures/commands/slash/economy/emojibet/handler.emoji.js: -------------------------------------------------------------------------------- 1 | import { Emojis as e } from "../../../../../util/util.js" 2 | import adminEmoji from "./admin.emoji.js" 3 | import handlerviewEmoji from "./handlerview.emoji.js" 4 | 5 | export default async interaction => { 6 | 7 | const method = interaction.options.getString('method') 8 | 9 | if (method === 'view') 10 | return handlerviewEmoji(interaction) 11 | 12 | if (['add', 'remove'].includes(method)) 13 | return adminEmoji(interaction, method) 14 | 15 | return await interaction.reply({ 16 | content: `${e.Deny} | Não foi possível obter a sub-função.`, 17 | ephemeral: true 18 | }) 19 | } -------------------------------------------------------------------------------- /src/structures/commands/slash/economy/emojibet/invest.emoji.js: -------------------------------------------------------------------------------- 1 | import betInvest from "./bet.invest.js" 2 | 3 | export default async (interaction) => { 4 | 5 | const command = interaction.options.getString('options') 6 | 7 | if (command === 'bet') 8 | return betInvest(interaction) 9 | 10 | // if (command === 'view') 11 | 12 | } -------------------------------------------------------------------------------- /src/structures/commands/slash/economy/emojibet/remove.bet.js: -------------------------------------------------------------------------------- 1 | import { Database } from "../../../../../classes/index.js" 2 | 3 | export default async (participants, value) => { 4 | 5 | for await (let objUser of participants) { 6 | await Database.Cache.EmojiBetRescue.sub(objUser.user, value) 7 | } 8 | 9 | return 10 | } -------------------------------------------------------------------------------- /src/structures/commands/slash/economy/emojibet/rescue.bet.js: -------------------------------------------------------------------------------- 1 | import { Database } from '../../../../../classes/index.js' 2 | import { Emojis as e } from '../../../../../util/util.js' 3 | import { socket } from '../../../../../websocket/websocket.js' 4 | 5 | export default async interaction => { 6 | 7 | const { user, guild } = interaction 8 | 9 | const cachedValue = await Database.Cache.EmojiBetRescue.get(user.id) 10 | 11 | if (!cachedValue) 12 | return await interaction.reply({ 13 | content: `${e.Deny} | Você não tem nenhum valor a ser resgatado.`, 14 | ephemeral: true 15 | }) 16 | 17 | if (cachedValue < 0) { 18 | await Database.Cache.EmojiBetRescue.delete(user.id) 19 | return await interaction.reply({ 20 | content: `${e.Deny} | Você não tem nenhum valor a ser resgatado.`, 21 | ephemeral: true 22 | }) 23 | } 24 | 25 | const transaction = { 26 | time: `${Date.format(0, true)}`, 27 | data: `${e.Admin} Resgatou ${cachedValue} Safiras perdidas no Emoji Bet` 28 | } 29 | 30 | socket?.send({ 31 | type: "transactions", 32 | transactionsData: { value: cachedValue, userId: user.id, transaction } 33 | }) 34 | 35 | await Database.User.findOneAndUpdate( 36 | { id: user.id }, 37 | { 38 | $inc: { Balance: cachedValue }, 39 | $push: { 40 | Transactions: { 41 | $each: [transaction], 42 | $position: 0 43 | } 44 | } 45 | }, 46 | { upsert: true, new: true } 47 | ) 48 | .then(doc => Database.saveUserCache(doc?.id, doc)) 49 | 50 | await Database.Cache.EmojiBetRescue.delete(user.id) 51 | const coin = await guild.getCoin() 52 | 53 | return await interaction.reply({ 54 | content: `${e.Check} | Você resgatou **${cachedValue.currency()} ${coin}** perdidas no emoji bet.` 55 | }) 56 | } -------------------------------------------------------------------------------- /src/structures/commands/slash/economy/emojibet/view.emoji.js: -------------------------------------------------------------------------------- 1 | import { parseEmoji } from "discord.js" 2 | import { Emojis as e } from "../../../../../util/util.js" 3 | 4 | export default async (interaction) => { 5 | 6 | const emojiParsed = parseEmoji(interaction.options.getString('emoji')) 7 | 8 | if (!emojiParsed) 9 | return await interaction.reply({ 10 | content: `${e.Deny} | Forneça um emoji válido para utulizar este comando.`, 11 | ephemeral: true 12 | }) 13 | 14 | const emojiData = { 15 | id: emojiParsed?.id || null, 16 | name: emojiParsed?.name || null, 17 | animated: emojiParsed?.animated ? ".gif" : ".png", 18 | url: `https://cdn.discordapp.com/emojis/${emojiParsed.id}${emojiParsed?.animated ? ".gif" : ".png"}` 19 | } 20 | 21 | if (!emojiData.id || !emojiData.name) 22 | return await interaction.reply({ 23 | content: `${e.Deny} | Emoji não reconhecido.`, 24 | ephemeral: true 25 | }) 26 | 27 | return await interaction.reply({ content: emojiData.url }) 28 | 29 | } -------------------------------------------------------------------------------- /src/structures/commands/slash/games/blackjack/blackjack.class.js: -------------------------------------------------------------------------------- 1 | import { Base } from '../../../../../classes/index.js' 2 | import { Emojis as e } from '../../../../../util/util.js' 3 | import * as fs from 'fs' 4 | 5 | export default class Blackjack extends Base { 6 | constructor(interaction, guildData) { 7 | super() 8 | this.guildData = guildData 9 | this.interaction = interaction 10 | this.options = interaction.options 11 | } 12 | 13 | async validateOptions() { 14 | 15 | const option = this.options.getSubcommand() 16 | 17 | switch (option) { 18 | case 'solo': import('./solo/index.js').then(solo => solo.default(this)); break; 19 | case 'multiplayer': import('./multiplayer/multiplayer.blackjack.js').then(multiplayer => multiplayer.default(this)); break; 20 | case 'refund': import('./refund/index.js').then(refund => refund.default(this)); break; 21 | 22 | default: 23 | await this.interaction.reply({ 24 | content: `${e.Deny} | Subcomando não encontrado.`, 25 | ephemeral: true 26 | }) 27 | break; 28 | } 29 | 30 | return 31 | } 32 | 33 | get BlackJackEmojis() { 34 | return JSON.parse(fs.readFileSync('./src/structures/commands/slash/games/blackjack/emojis.json')) 35 | } 36 | } -------------------------------------------------------------------------------- /src/structures/commands/slash/games/blackjack/solo/index.js: -------------------------------------------------------------------------------- 1 | export default async (data) => { 2 | 3 | const { options } = data 4 | const mode = options.getString('mode') 5 | 6 | if (mode === 'luck') return import('./luck.blackjack.js').then(luck => luck.default(data)) 7 | 8 | } -------------------------------------------------------------------------------- /src/structures/commands/slash/games/quiz/anime.quiz.js: -------------------------------------------------------------------------------- 1 | import { Emojis as e } from "../../../../../util/util.js" 2 | import options from "./anime/options.anime.js" 3 | import start from "./anime/start.anime.js" 4 | import suggest from './anime/suggest.anime.js' 5 | 6 | export default async interaction => { 7 | 8 | const subCommand = interaction.options.getSubcommand() 9 | 10 | const execute = { suggest, options, start }[subCommand] 11 | 12 | if (!execute) 13 | return await interaction.reply({ 14 | content: `${e.Deny} | Sub-Função não encontrada. #94463`, 15 | ephemeral: true 16 | }) 17 | 18 | return execute(interaction) 19 | 20 | } -------------------------------------------------------------------------------- /src/structures/commands/slash/games/quiz/anime/options.anime.js: -------------------------------------------------------------------------------- 1 | import { Emojis as e } from "../../../../../../util/util.js" 2 | import analise from './analise.anime.js' 3 | import viewer from "./viewer.anime.js" 4 | 5 | export default async (interaction, suggestId) => { 6 | 7 | const { options } = interaction 8 | const value = suggestId || options.getString('method') 9 | 10 | const execute = { analise }[value] 11 | if (execute) return execute(interaction) 12 | 13 | const isSearchValue = options.getString('search') || options.getString('my_content') 14 | if (isSearchValue) return viewer(interaction, isSearchValue) 15 | 16 | return await interaction.reply({ 17 | content: `${e.Deny} | Sub-Função não encontrada. #1659577784`, 18 | ephemeral: true 19 | }) 20 | } -------------------------------------------------------------------------------- /src/structures/commands/slash/games/quiz/anime/start.anime.js: -------------------------------------------------------------------------------- 1 | import { SaphireClient as client } from "../../../../../../classes/index.js" 2 | import { Emojis as e } from "../../../../../../util/util.js" 3 | import AnimeQuizManager from "./class.anime.js" 4 | 5 | export default async interaction => { 6 | 7 | const { channel } = interaction 8 | if (client.chatsInGame.includes(channel.id)) 9 | return await interaction.reply({ 10 | content: `${e.Deny} | Este canal já tem um game rolando. Espere ele terminar para começar outro, ok?`, 11 | ephemeral: true 12 | }) 13 | 14 | return new AnimeQuizManager(interaction).analise() 15 | 16 | } -------------------------------------------------------------------------------- /src/structures/commands/slash/games/rather/functions/addPoint.rather.js: -------------------------------------------------------------------------------- 1 | import { Database } from "../../../../../../classes/index.js" 2 | 3 | export default async (ratherId, option, userId) => { 4 | 5 | if (!ratherId || !option || !userId) return 6 | 7 | await Database.Rather.updateOne( 8 | { id: ratherId }, 9 | { 10 | $addToSet: { [`${option}.users`]: userId }, 11 | $pull: { [`${option === 'optionOne' ? 'optionTwo' : 'optionOne'}.users`]: userId } 12 | } 13 | ) 14 | 15 | const allData = await Database.Rather.find({}) 16 | return allData 17 | } -------------------------------------------------------------------------------- /src/structures/commands/slash/games/rather/options.rather.js: -------------------------------------------------------------------------------- 1 | import { Emojis as e } from "../../../../../util/util.js" 2 | import deleteRather from "./functions/delete.rather.js" 3 | import editRather from "./functions/edit.rather.js" 4 | import { Modals } from "../../../../../classes/index.js" 5 | import personalListRather from "./functions/personalList.rather.js" 6 | import viewRather from "./functions/view.rather.js" 7 | 8 | export default async interaction => { 9 | 10 | const { options } = interaction 11 | const optionName = options.data[0].options[0]?.name 12 | const optionValue = options.data[0].options[0]?.value 13 | 14 | if (optionValue === 'suggest') 15 | return await interaction.showModal(Modals.vocePrefere()) 16 | 17 | if (optionValue === 'myQuestions') 18 | return personalListRather(interaction) 19 | 20 | switch (optionName) { 21 | case 'delete': deleteRather(interaction, optionValue); break; 22 | case 'edit': editRather(interaction, optionValue); break; 23 | case 'view': viewRather(interaction, optionValue); break; 24 | default: 25 | await interaction.reply({ 26 | content: `${e.Deny} | Nenhuma sub-função definida.`, 27 | ephemeral: true 28 | }) 29 | break; 30 | } 31 | 32 | return 33 | } -------------------------------------------------------------------------------- /src/structures/commands/slash/games/tictactoe.js: -------------------------------------------------------------------------------- 1 | import { ApplicationCommandOptionType } from 'discord.js' 2 | import newGame from '../../functions/tictactoe/newGame.tictactoe.js' 3 | 4 | export default { 5 | name: 'tictactoe', 6 | description: '[games] O clássico jogo da velha', 7 | category: "games", 8 | dm_permission: false, 9 | name_localizations: { "en-US": "tictactoe", 'pt-BR': 'jogo-da-velha' }, 10 | database: false, 11 | type: 1, 12 | options: [ 13 | { 14 | name: 'oponente', 15 | description: 'Selecione o seu oponente', 16 | type: ApplicationCommandOptionType.User, 17 | required: true 18 | } 19 | ], 20 | api_data: { 21 | name: "tictactoe", 22 | description: "O clássico jogo da velha no Discord", 23 | category: "Diversão", 24 | synonyms: ["jogo-da-velha"], 25 | tags: [], 26 | perms: { 27 | user: [], 28 | bot: [] 29 | } 30 | }, 31 | async execute({ interaction, e }) { 32 | 33 | const { options, user } = interaction 34 | const opponent = options.getUser('oponente') 35 | 36 | if (opponent.bot || opponent.id === user.id) 37 | return interaction.reply({ 38 | content: `${e.Deny} | Você não pode jogar contra bots ou você mesmo.`, 39 | ephemeral: true 40 | }) 41 | 42 | return newGame(interaction, opponent) 43 | } 44 | } -------------------------------------------------------------------------------- /src/structures/commands/slash/images/changemymind.js: -------------------------------------------------------------------------------- 1 | import { Canvacord as Canvas } from 'canvacord' 2 | import { ApplicationCommandOptionType, AttachmentBuilder } from 'discord.js' 3 | 4 | export default { 5 | name: 'changemymind', 6 | description: '[images] Apenas changemymind', 7 | category: "images", 8 | dm_permission: false, 9 | database: false, 10 | type: 1, 11 | options: [ 12 | { 13 | name: 'content', 14 | description: 'Conteúdo a ser escrito no papel', 15 | max_length: 45, 16 | min_length: 1, 17 | type: ApplicationCommandOptionType.String, 18 | required: true 19 | }, 20 | ], 21 | api_data: { 22 | name: "changemymind", 23 | description: "Can you change my mind? (meme)", 24 | category: "Imagens", 25 | synonyms: [], 26 | tags: [], 27 | perms: { 28 | user: [], 29 | bot: [] 30 | } 31 | }, 32 | async execute({ interaction, e }) { 33 | 34 | const msg = await interaction.reply({ 35 | content: `${e.Loading} | Gerando o seu change my mind...`, 36 | fetchReply: true 37 | }) 38 | 39 | return await msg.edit({ 40 | content: null, 41 | files: [ 42 | new AttachmentBuilder( 43 | await Canvas.changemymind(interaction.options.getString('content')), 'phub.png' 44 | ) 45 | ] 46 | }) 47 | .catch(err => msg.edit({ 48 | content: `${e.Animated.SaphireCry} | Não foi possível gerar o seu change my mind.\n${e.bug} | \`${err}\`` 49 | })) 50 | 51 | } 52 | } -------------------------------------------------------------------------------- /src/structures/commands/slash/images/gifs/emotional.gifs.js: -------------------------------------------------------------------------------- 1 | import { SaphireClient as client } from "../../../../../classes/index.js" 2 | import { Emojis as e, Gifs } from "../../../../../util/util.js" 3 | 4 | export default async (interaction, gifData) => { 5 | 6 | const { options, user } = interaction 7 | const gifRequest = options.getString('reaction') 8 | const text = options.getString('text') 9 | const option = gifData.find(g => g.JSON === gifRequest) 10 | const gif = Gifs[gifRequest]?.random() || null 11 | 12 | if (!gif) 13 | return await interaction.reply({ 14 | content: `${e.Deny} | Não foi possível localizar o GIF.`, 15 | ephemeral: true 16 | }) 17 | 18 | return await interaction.reply({ 19 | embeds: [{ 20 | color: client.blue, 21 | image: { url: gif }, 22 | description: text?.limit('MessageEmbedDescription') || option.defaultMessage.replace('$user', user) 23 | }] 24 | }) 25 | } -------------------------------------------------------------------------------- /src/structures/commands/slash/images/gifs/measurer.gifs.js: -------------------------------------------------------------------------------- 1 | export default async (interaction, targetUser, measurerType) => { 2 | 3 | const measurer = { 4 | lgbt: `🏳️‍🌈 | Analisando o perfil de ${targetUser}, posso afirmar que é **{percent}% LGBTQIA+**.`, 5 | gado: `🐂 | Vendo o jeito de ${targetUser}, poderia falar que é **{percent}% gado**.`, 6 | cognitive: `🧠 | Pelo jeito que ${targetUser} fala, a **Capacidade Cognitiva** deste ser, está na faixa de **{percent}%**.`, 7 | future: `🗒️ | A chance de ${targetUser} ser alguém na vida, é mais ou menos **{percent}%**.`, 8 | }[measurerType] 9 | 10 | const percent = (Math.floor(Math.random() * 100) + 1).toFixed(0) 11 | const content = measurer.replace('{percent}', percent) 12 | 13 | return await interaction.reply({ content }) 14 | } -------------------------------------------------------------------------------- /src/structures/commands/slash/moderation/functions/autorole/index.autorole.js: -------------------------------------------------------------------------------- 1 | import { DiscordPermissons, PermissionsTranslate } from '../../../../../../util/Constants.js' 2 | import addAutorole from '../../../../functions/autorole/add.autorole.js' 3 | import painelAutorole from '../../../../functions/autorole/painel.autorole.js' 4 | 5 | export default async ({ interaction, guildData, Database, client, e }) => { 6 | 7 | const { options, guild, member } = interaction 8 | const subCommand = options.getSubcommand() 9 | 10 | if (!guild.members.me.permissions.has(DiscordPermissons.ManageRoles, true)) 11 | return await interaction.reply({ 12 | content: `${e.Deny} | Eu preciso da permissão **${PermissionsTranslate.ManageRoles}** para executar este comando.`, 13 | ephemeral: true 14 | }) 15 | 16 | if (!member.permissions.has(DiscordPermissons.ManageRoles, true)) 17 | return await interaction.reply({ 18 | content: `${e.Deny} | Você precisa da permissão **${PermissionsTranslate.ManageRoles}** para executar este comando.`, 19 | ephemeral: true 20 | }) 21 | 22 | if (subCommand === 'autorole') return addAutorole({ interaction, guildData, Database, client }) 23 | if (subCommand === 'painel') return painelAutorole({ interaction, guildData, Database, client }) 24 | 25 | return await interaction.reply({ content: `${e.Deny} | Sub-Comando não encontrado.`, ephemeral: true }) 26 | } -------------------------------------------------------------------------------- /src/structures/commands/slash/moderation/functions/twitch/categories.search.twitch.js: -------------------------------------------------------------------------------- 1 | import { ChatInputCommandInteraction } from "discord.js" 2 | import { Emojis as e } from "../../../../../../util/util.js" 3 | import { SaphireClient as client } from "../../../../../../classes/index.js" 4 | 5 | /** 6 | * @param { ChatInputCommandInteraction } interaction 7 | * @param { { box_art_url: 'imageUrl.jpg', id: 'numberString', name: 'string' } } data 8 | */ 9 | export default async (interaction, data) => { 10 | 11 | if (!data?.length) 12 | return interaction.editReply({ content: `${e.DenyX} | Nenhum dado encontrado.` }).catch(() => { }) 13 | 14 | const description = data 15 | .map(d => { 16 | d.url = `https://www.twitch.tv/directory/game/${d.name.replace(/\s/g, '%20')}` 17 | return d 18 | }) 19 | .map(d => `[${d.name}](${d.url})`) 20 | .join('\n') 21 | .limit('MessageEmbedDescription') 22 | 23 | return interaction.editReply({ 24 | content: null, 25 | embeds: [{ 26 | color: client.blue, 27 | title: `${e.twitch} ${client.user.username}'s Twitch Search Categories System`, 28 | description, 29 | footer: { 30 | text: `${data.length} categorias carregadas` 31 | } 32 | }] 33 | }) 34 | } -------------------------------------------------------------------------------- /src/structures/commands/slash/moderation/functions/twitch/search.twitch.js: -------------------------------------------------------------------------------- 1 | import { ChatInputCommandInteraction } from "discord.js" 2 | import { Emojis as e } from "../../../../../../util/util.js" 3 | import categories from './categories.search.twitch.js' 4 | import channels from './channels.search.twitch.js' 5 | import { SaphireClient as client } from "../../../../../../classes/index.js" 6 | 7 | /** 8 | * @param { ChatInputCommandInteraction } interaction 9 | */ 10 | export default async interaction => { 11 | 12 | const input = interaction.options.getString('input').replace(/\s/g, '%20') 13 | const where = interaction.options.getString('onde') 14 | await interaction.reply({ content: `${e.Loading} | Buscando informações na Twitch...` }) 15 | const query = await client.TwitchFetcher(`https://api.twitch.tv/helix/search/${where}?query=${input}&first=25`) 16 | 17 | if (query == 'TIMEOUT') 18 | return interaction.editReply({ 19 | content: `${e.Animated.SaphirePanic} | Aaaaah, o sistema da Twitch está pegando FOOOOGO 🔥\n🧑‍🚒 | Fica tranquilo, que tudo está normal em menos de 1 minuto. ||Rate limit é uma coisinha chata||` 20 | }).catch(() => { }) 21 | 22 | return { categories, channels }[where](interaction, query) 23 | } -------------------------------------------------------------------------------- /src/structures/commands/slash/nsfw/nsfw.js: -------------------------------------------------------------------------------- 1 | import { Emojis as e } from '../../../../util/util.js' 2 | import { ApplicationCommandOptionType } from 'discord.js' 3 | import images from '../../functions/nsfw/images.js' 4 | 5 | export default { 6 | name: 'nsfw', 7 | nsfw: true, 8 | description: '[nsfw] Not Safe For Work | Conteúdo maior de idade', 9 | dm_permission: false, 10 | type: 1, 11 | options: [ 12 | { 13 | name: 'images', 14 | name_localizations: { "pt-BR": "imagens" }, 15 | description: 'Imagens de conteúdo adulto', 16 | type: ApplicationCommandOptionType.Subcommand, 17 | options: [ 18 | { 19 | name: 'category', 20 | name_localizations: { "pt-BR": 'categoria' }, 21 | description: "Categoria desejada", 22 | type: ApplicationCommandOptionType.String, 23 | required: true, 24 | autocomplete: true 25 | } 26 | ] 27 | } 28 | ], 29 | api_data: { 30 | name: "nsfw", 31 | description: "Não use esse comando", 32 | category: "Imagens", 33 | synonyms: [], 34 | tags: [], 35 | perms: { 36 | user: [], 37 | bot: [] 38 | } 39 | }, 40 | helpData: {}, 41 | async execute({ interaction }) { 42 | 43 | const { options } = interaction 44 | const subCommand = options.getSubcommand() 45 | 46 | const execute = { 47 | images 48 | }[subCommand] 49 | 50 | if (!subCommand) 51 | return interaction.reply({ 52 | content: `${e.Animated.SaphirePanic} | Sub-comando não encontrado #1684854000`, 53 | ephemeral: true 54 | }) 55 | 56 | return execute(interaction) 57 | } 58 | } -------------------------------------------------------------------------------- /src/structures/commands/slash/perfil/level/Poppins-SemiBold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaphireBot/Bot/4ea5ea94db1c7a82e6fa049807242bd2532319cf/src/structures/commands/slash/perfil/level/Poppins-SemiBold.ttf -------------------------------------------------------------------------------- /src/structures/commands/slash/perfil/perfil/gender.profile.js: -------------------------------------------------------------------------------- 1 | export default async (interaction, ephemeral = false) => { 2 | 3 | const signs = { 4 | "Homem": "👨", 5 | "Mulher": "👩", 6 | "LGBTQIA+": "🏳️‍🌈", 7 | "Helicóptero de Guerra": "🚁" 8 | } 9 | 10 | const selectMenuObject = { 11 | type: 1, 12 | components: [{ 13 | type: 3, 14 | custom_id: ephemeral ? 'genderEphemeral' : 'gender', 15 | placeholder: 'Selecione o seu sexo', 16 | options: 17 | Object.entries(signs) 18 | .map(sign => ({ 19 | label: sign[0], 20 | emoji: `${sign[1]}`, 21 | value: `${sign[1]} ${sign[0]}` 22 | })) 23 | }] 24 | } 25 | 26 | return await interaction.reply({ 27 | components: [selectMenuObject], 28 | ephemeral 29 | }) 30 | } -------------------------------------------------------------------------------- /src/structures/commands/slash/perfil/perfil/sign.profile.js: -------------------------------------------------------------------------------- 1 | export default async (interaction, ephemeral = false) => { 2 | 3 | const signs = { 4 | "Aries": "♈", 5 | "Touro": "♉", 6 | "Gêmeos": "♊", 7 | "Câncer": "♋", 8 | "Leão": "♌", 9 | "Virgem": "♍", 10 | "Libra": "♎", 11 | "Escorpião": "♏", 12 | "Sagitário": "♐", 13 | "Capricórnio": "♑", 14 | "Aquário": "♒", 15 | "Peixes": "♓" 16 | } 17 | 18 | const selectMenuObject = { 19 | type: 1, 20 | components: [{ 21 | type: 3, 22 | custom_id: ephemeral ? 'signEphemeral' : 'sign', 23 | placeholder: 'Selecione o seu signo', 24 | options: 25 | Object.entries(signs) 26 | .map(sign => ({ 27 | label: sign[0], 28 | emoji: `${sign[1]}`, 29 | value: `${sign[1]} ${sign[0]}` 30 | })) 31 | }] 32 | } 33 | 34 | return await interaction.reply({ 35 | components: [selectMenuObject], 36 | ephemeral 37 | }) 38 | } -------------------------------------------------------------------------------- /src/structures/commands/slash/perfil/vip/viewer.vip.js: -------------------------------------------------------------------------------- 1 | import { ChatInputCommandInteraction } from "discord.js" 2 | import { Emojis as e } from "../../../../../util/util.js" 3 | import { Database } from "../../../../../classes/index.js" 4 | 5 | /** 6 | * @param { ChatInputCommandInteraction } interaction 7 | */ 8 | export default async interaction => { 9 | 10 | const { user: interactionUser, options } = interaction 11 | const user = options.getUser('user') || interactionUser 12 | 13 | await interaction.reply({ content: `${e.Loading} | Carregando os dados...` }) 14 | 15 | const data = await Database.getUser(user.id) 16 | const vipData = data?.Vip || {} 17 | 18 | if (vipData?.Permanent) 19 | return interaction.editReply({ 20 | content: `${e.Animated.SaphireReading} | ${user.id == interactionUser.id ? "Você" : user} tem o vip permanente.` 21 | }).catch(() => { }) 22 | 23 | if ( 24 | !vipData 25 | || !vipData.DateNow 26 | || !vipData.TimeRemaing 27 | ) 28 | return interaction.editReply({ 29 | content: `${e.Animated.SaphireCry} | ${user.id == interactionUser.id ? "Você" : user} não tem o vip ativo.` 30 | }).catch(() => { }) 31 | 32 | const time = vipData.DateNow + vipData.TimeRemaing 33 | 34 | return interaction.editReply({ 35 | content: `${e.Animated.SaphireReading} | ${user.id == interactionUser.id ? "Você" : user} tem o vip até ${Date.complete(new Date(time).valueOf())} (${Date.Timestamp(new Date(time - Date.now()).valueOf(), 'R')}).` 36 | }).catch(() => { }) 37 | } -------------------------------------------------------------------------------- /src/structures/commands/slash/util/tempcall/config.tempcall.js: -------------------------------------------------------------------------------- 1 | import { ChatInputCommandInteraction } from "discord.js" 2 | import { Emojis as e } from "../../../../../util/util.js" 3 | import { Database } from "../../../../../classes/index.js" 4 | import layout from './layout.tempcall.js' 5 | 6 | /** 7 | * @param { ChatInputCommandInteraction } interaction 8 | */ 9 | export default async (interaction, guildData) => { 10 | 11 | const { options, guild } = interaction 12 | const method = options.getString('method') 13 | 14 | return { reset, layout }[method](interaction, guildData) 15 | 16 | async function reset() { 17 | await interaction.reply({ content: `${e.Loading} | Carregando...` }) 18 | 19 | await Database.Guild.findOneAndUpdate( 20 | { id: guild.id }, 21 | { $unset: { 'TempCall.members': true } }, 22 | { new: true } 23 | ) 24 | .then(data => Database.saveGuildCache(data.id, data)) 25 | 26 | return interaction.editReply({ 27 | content: `${e.CheckV} | Ranking de Tempo em Call resetado.` 28 | }).catch(() => { }) 29 | } 30 | 31 | } -------------------------------------------------------------------------------- /src/structures/commands/slash/util/tempcall/member.ranking.tempcall.js: -------------------------------------------------------------------------------- 1 | import { ChatInputCommandInteraction } from "discord.js"; 2 | import { Emojis as e } from "../../../../../util/util.js"; 3 | 4 | /** 5 | * @param { ChatInputCommandInteraction } interaction 6 | */ 7 | export default async (interaction, guildData) => { 8 | 9 | const { options } = interaction 10 | const member = options.getMember('member') 11 | 12 | if (!member) 13 | return interaction.reply({ content: `${e.Deny} | Nenhum membro encontrado.` }) 14 | 15 | if (!guildData) guildData = {} 16 | if (!guildData?.TempCall) guildData.TempCall = {} 17 | if (!guildData?.TempCall?.members) guildData.TempCall.members = {} 18 | if (!guildData?.TempCall?.membersMuted) guildData.TempCall.membersMuted = {} 19 | const data = { member: member, OnTime: guildData?.TempCall?.members[member.user.id] || 0, offTime: guildData?.TempCall?.membersMuted[member.user.id] || 0 } 20 | 21 | return interaction.reply({ 22 | content: `👤 ${member?.user?.username || 'Not Found'} \`${member?.id}\`\n🎙️ \`${Date.stringDate(data.OnTime, true)}\`\n🔇 \`${Date.stringDate(data.offTime, true)}\`` 23 | }) 24 | } 25 | -------------------------------------------------------------------------------- /src/structures/events/betReaction.js: -------------------------------------------------------------------------------- 1 | import { Database, SaphireClient as client } from '../../classes/index.js' 2 | import { Emojis as e } from '../../util/util.js' 3 | import realizeBet from '../commands/slash/economy/bet/functions/realize.bet.js' 4 | import newBetUser from '../commands/slash/economy/bet/functions/addPlayer.bet.js' 5 | 6 | client.on('betReaction', async ({ message, user, emojiName }) => { 7 | 8 | const betCachedData = await Database.Cache.Bet.get(message.id) 9 | if (!betCachedData) { 10 | message.reactions.removeAll().catch(() => { }) 11 | return await message.edit({ 12 | content: `${e.Deny} | Esta aposta já foi finalizada ou não foi armazenada.`, 13 | embeds: [] 14 | }).catch(() => { }) 15 | } 16 | 17 | const embed = message.embeds[0]?.data 18 | if (!embed) { 19 | client.emit('betRefund', betCachedData) 20 | message.reactions.removeAll().catch(() => { }) 21 | return await message.edit({ 22 | content: `${e.Deny} | Aposta inválida.\n${e.Info} | Os valores foram devolvidos aos participantes.` 23 | }).catch(() => { }) 24 | } 25 | 26 | const timestamp = embed.fields[2].value.replace(/[^0-9]/g, '') 27 | const time = new Date(timestamp * 1000).valueOf() 28 | const { authorId, players, playersCount, versus, amount } = betCachedData 29 | const userData = await Database.getUser(user.id) 30 | const userBalance = userData?.Balance || 0 31 | 32 | if (time < Date.now() || emojiName === '✅' && user.id === authorId) 33 | return realizeBet(betCachedData, message) 34 | 35 | if ( 36 | players.includes(user.id) 37 | || versus && user.id !== versus 38 | || !userBalance 39 | || userBalance < amount 40 | ) return 41 | 42 | return newBetUser(betCachedData, message, user.id, (players.length + 1) >= playersCount) 43 | }) -------------------------------------------------------------------------------- /src/structures/events/betRefund.js: -------------------------------------------------------------------------------- 1 | import { Database, SaphireClient as client } from '../../classes/index.js' 2 | import { Emojis as e } from '../../util/util.js' 3 | import { socket } from '../../websocket/websocket.js' 4 | 5 | client.on('betRefund', async (data, noDelete = false) => { 6 | 7 | const players = [...new Set([data?.players || [data?.red || [], data?.blue || []].flat()])].flat() 8 | const amount = data?.amount || data?.value 9 | const messageId = data?.messageId 10 | 11 | if (!players.length || !amount || !messageId) return 12 | 13 | if (!noDelete) 14 | await Database.Cache.Bet.delete(messageId) 15 | 16 | if (players?.length > 0) { 17 | 18 | const transaction = { 19 | time: `${Date.format(0, true)}`, 20 | data: `${e.Admin} Recebeu ${amount} Safiras via *Bet System Refund*` 21 | } 22 | 23 | for (const userId of players) 24 | socket?.send({ 25 | type: "transactions", 26 | transactionsData: { value: amount, userId, transaction } 27 | }) 28 | 29 | await Database.User.updateMany( 30 | { id: { $in: players } }, 31 | { 32 | $inc: { Balance: amount }, 33 | $push: { 34 | Transactions: { 35 | $each: [transaction], 36 | $position: 0 37 | } 38 | } 39 | }, 40 | { upsert: true } 41 | ) 42 | Database.refreshUsersData(players) 43 | } 44 | return 45 | }) -------------------------------------------------------------------------------- /src/structures/events/blackjackRefund.js: -------------------------------------------------------------------------------- 1 | import { Database, SaphireClient as client } from '../../classes/index.js' 2 | import { Emojis as e } from '../../util/util.js' 3 | import { socket } from '../../websocket/websocket.js' 4 | 5 | client.on('blackjackRefund', async ({ availablePlayers, bet, messageId }, noDelete = false) => { 6 | 7 | if (!availablePlayers || !messageId) return 8 | 9 | if (!noDelete) 10 | await Database.Cache.Blackjack.delete(messageId) 11 | 12 | if (availablePlayers?.length > 0 && bet > 0) { 13 | 14 | const transaction = { 15 | time: `${Date.format(0, true)}`, 16 | data: `${e.Admin} Recebeu ${bet} Safiras via *Blackjack System Refund*` 17 | } 18 | 19 | for (const userId of availablePlayers) 20 | socket?.send({ 21 | type: "transactions", 22 | transactionsData: { value: bet, userId, transaction } 23 | }) 24 | 25 | await Database.User.updateMany( 26 | { id: { $in: availablePlayers } }, 27 | { 28 | $inc: { Balance: bet }, 29 | $push: { 30 | Transactions: { 31 | $each: [transaction], 32 | $position: 0 33 | } 34 | } 35 | }, 36 | { upsert: true } 37 | ) 38 | Database.refreshUsersData(availablePlayers) 39 | } 40 | return 41 | }) -------------------------------------------------------------------------------- /src/structures/events/error.js: -------------------------------------------------------------------------------- 1 | import { SaphireClient as client } from '../../classes/index.js' 2 | import unhandledRejection from '../../classes/modules/errors/process/unhandledRejection.js' 3 | 4 | client.on('error', error => { 5 | 6 | if ( 7 | [ 8 | 10062, // Unknown interaction 9 | 40060 10 | ] 11 | .includes(error?.code)) return 12 | 13 | return unhandledRejection(error) 14 | }) -------------------------------------------------------------------------------- /src/structures/events/functions/add.guildMemberAdd.js: -------------------------------------------------------------------------------- 1 | import { GuildMember } from "discord.js" 2 | import { replacePlaceholder } from "../../../functions/plugins/plugins.js" 3 | import { SaphireClient as client } from "../../../classes/index.js" 4 | 5 | /** 6 | * @param { GuildMember } member 7 | */ 8 | export default (member, data) => { 9 | 10 | if (!data.body) return 11 | 12 | const body = { 13 | content: replacePlaceholder(data.body.content, member) || null, 14 | embeds: data.body.embeds || [] 15 | } 16 | 17 | if (body.embeds[0]) { 18 | body.embeds[0].description = replacePlaceholder(body.embeds[0]?.description, member) 19 | body.embeds[0].title = replacePlaceholder(body.embeds[0]?.title, member) 20 | if (body.embeds[0]?.footer?.text) 21 | body.embeds[0].footer.text = replacePlaceholder(body.embeds[0]?.footer?.text, member) 22 | } 23 | 24 | body.channelId = data.channelId 25 | body.LogType = 'WelcomeChannel' 26 | body.method = 'post' 27 | body.guildId = member.guild.id 28 | client.pushMessage({ 29 | channelId: data.channelId, 30 | LogType: 'WelcomeChannel', 31 | method: 'post', 32 | guildId: member.guild.id, 33 | body 34 | }) 35 | 36 | return 37 | } -------------------------------------------------------------------------------- /src/structures/events/functions/integrationCreate.js: -------------------------------------------------------------------------------- 1 | import { GuildAuditLogsEntry, Guild } from 'discord.js'; 2 | import { Database } from '../../../classes/index.js'; 3 | 4 | /** 5 | * @param { GuildAuditLogsEntry } log 6 | * @param { Guild } guild 7 | */ 8 | export default async (log, guild) => { 9 | 10 | const integration = log?.target 11 | if (!log || !integration || !guild) return 12 | 13 | // const guildData = await Database.Guild.findOne({ id: guild.id }, 'LogSystem') 14 | const guildData = await Database.getGuild(guild.id) 15 | if (!guildData || !guildData?.LogSystem?.channel || !guildData?.LogSystem?.botAdd?.active) return 16 | 17 | const logChannel = await guild.channels.fetch(guildData?.LogSystem?.channel)?.catch(() => null) 18 | if (!logChannel) return 19 | 20 | const executor = await guild.members.fetch(log.executorId).then(member => member.user).catch(() => null) 21 | 22 | return await logChannel.send({ 23 | content: `🛰️ | **Global System Notification** | Bot Add\n \n**${executor?.username || '\`Not Found\`'} \`${executor?.id || '0'}\`** adicionou o bot **${integration?.name || '\`Not Found\`'} \`${integration?.id || '0'}\`**`, 24 | }).catch(() => { }) 25 | } -------------------------------------------------------------------------------- /src/structures/events/functions/integrationDelete.js: -------------------------------------------------------------------------------- 1 | import { GuildAuditLogsEntry, Guild } from 'discord.js'; 2 | import { Database } from '../../../classes/index.js'; 3 | 4 | /** 5 | * @param { GuildAuditLogsEntry } log 6 | * @param { Guild } guild 7 | */ 8 | export default async (log, guild) => { 9 | 10 | const integration = log?.target 11 | if (!log || !integration || !guild) return 12 | 13 | // const guildData = await Database.Guild.findOne({ id: guild.id }, 'LogSystem') 14 | const guildData = await Database.getGuild(guild.id) 15 | if (!guildData || !guildData?.LogSystem?.channel || !guildData?.LogSystem?.botAdd?.active) return 16 | 17 | const logChannel = await guild.channels.fetch(guildData?.LogSystem?.channel)?.catch(() => null) 18 | if (!logChannel) return 19 | 20 | const executor = await guild.members.fetch(log.executorId).then(member => member.user).catch(() => null) 21 | 22 | return await logChannel.send({ 23 | content: `🛰️ | **Global System Notification** | Bot Deleted\n \n**${executor?.username || '\`Not Found\`'} \`${executor?.id || '0'}\`** removeu o bot **${integration?.name || '\`Not Found\`'} \`${integration?.id || '0'}\`**`, 24 | }).catch(() => { }) 25 | } -------------------------------------------------------------------------------- /src/structures/events/functions/inviteCreate.js: -------------------------------------------------------------------------------- 1 | export default async (log, guild) => { 2 | // TODO: Criar novo sistema de logs 3 | } -------------------------------------------------------------------------------- /src/structures/events/functions/remove.guildMemberRemove.js: -------------------------------------------------------------------------------- 1 | import { GuildMember } from "discord.js" 2 | import { replacePlaceholder } from "../../../functions/plugins/plugins.js" 3 | import { SaphireClient as client } from "../../../classes/index.js" 4 | 5 | /** 6 | * @param { GuildMember } member 7 | */ 8 | export default (member, data) => { 9 | 10 | if (!data.body) return 11 | 12 | const body = { 13 | content: replacePlaceholder(data.body.content, member) || null, 14 | embeds: data.body.embeds || [] 15 | } 16 | 17 | if (body.embeds[0]) { 18 | body.embeds[0].description = replacePlaceholder(body.embeds[0]?.description, member) 19 | body.embeds[0].title = replacePlaceholder(body.embeds[0]?.title, member) 20 | if (body.embeds[0]?.footer?.text) 21 | body.embeds[0].footer.text = replacePlaceholder(body.embeds[0]?.footer?.text, member) 22 | } 23 | 24 | body.channelId = data.channelId 25 | body.LogType = 'WelcomeChannel' 26 | body.method = 'post' 27 | body.guildId = member.guild.id 28 | client.pushMessage({ 29 | channelId: data.channelId, 30 | LogType: 'WelcomeChannel', 31 | method: 'post', 32 | guildId: member.guild.id, 33 | body 34 | }) 35 | 36 | return 37 | } -------------------------------------------------------------------------------- /src/structures/events/giveaway.js: -------------------------------------------------------------------------------- 1 | import { SaphireClient as client, Database, GiveawayManager } from '../../classes/index.js' 2 | import { PermissionFlagsBits } from 'discord.js' 3 | import StartGiveaway from '../../functions/update/giveaway/start.giveaway.js' 4 | 5 | client.on('giveaway', async giveaway => { 6 | 7 | const guild = await client.guilds.fetch(giveaway.GuildId || '0').catch(() => null) 8 | if (!guild) return 9 | await guild.fetch() 10 | 11 | const channel = await guild?.channels?.fetch(giveaway.ChannelId || '0')?.catch(() => null) 12 | if (!channel?.id) return Database.deleteGiveaway(giveaway.MessageID, guild.id) 13 | 14 | const channelPermissions = channel.permissionsFor(client.user) 15 | const permissions = [PermissionFlagsBits.ViewChannel, PermissionFlagsBits.SendMessages] 16 | const greenCard = Array.from( 17 | new Set([ 18 | guild.members.me.permissions.missing(permissions), 19 | channelPermissions?.missing(permissions) 20 | ].flat()) 21 | ) 22 | 23 | if (greenCard.length) return GiveawayManager.retry(giveaway) 24 | const message = await channel.messages.fetch(giveaway.MessageID || '0').catch(() => null) 25 | if (giveaway.timeout) clearTimeout(giveaway.timeout) 26 | return StartGiveaway(giveaway, guild, channel, message) 27 | }) -------------------------------------------------------------------------------- /src/structures/events/guildDelete.js: -------------------------------------------------------------------------------- 1 | import { SaphireClient as client, Database } from '../../classes/index.js'; 2 | import { Emojis as e } from '../../util/util.js'; 3 | import { Config } from '../../util/Constants.js'; 4 | import { socket } from '../../websocket/websocket.js'; 5 | import { ServerinfoCachedData } from '../commands/functions/serverinfo/pages.serverinfo.js'; 6 | 7 | client.on('guildDelete', async guild => { 8 | if (!guild.id) return 9 | 10 | Database.Prefixes.delete(guild.id) 11 | ServerinfoCachedData.delete(guild.id) 12 | if (socket?.connected) 13 | socket?.send({ type: "guildDelete", id: guild.id }) 14 | 15 | Database.deleteGuild(guild.id) 16 | await Database.deleteAllGiveawayFromThisGuild(guild.id) 17 | 18 | if (!guild.ownerId) return 19 | const owner = await client.users.fetch(guild.ownerId).catch(() => null) 20 | 21 | return client.pushMessage({ 22 | channelId: Config.LogChannelId, 23 | method: 'post', 24 | body: { 25 | channelId: Config.LogChannelId, 26 | method: 'post', 27 | embeds: [{ 28 | color: client.red, 29 | title: `${e.Loud} Servidor Removido`, 30 | fields: [ 31 | { 32 | name: 'Servidor', 33 | value: `${guild.name} *\`(${guild.id})\`*` 34 | }, 35 | { 36 | name: 'Status', 37 | value: `**Dono:** ${owner?.username || '\`Not Found\`'} *\`(${guild.ownerId})\`*\n**Membros:** ${guild.memberCount}` 38 | } 39 | ] 40 | }] 41 | } 42 | }) 43 | }) -------------------------------------------------------------------------------- /src/structures/events/jokempoRefund.js: -------------------------------------------------------------------------------- 1 | import { Database, SaphireClient as client } from '../../classes/index.js' 2 | import { Emojis as e } from '../../util/util.js' 3 | import { socket } from '../../websocket/websocket.js' 4 | 5 | client.on('jokempoRefund', async (data) => { 6 | 7 | const players = data.value?.players || [] 8 | const value = data.value?.value || 0 9 | const messageId = data?.id 10 | 11 | if (players?.length > 0 && value > 0) { 12 | 13 | const transaction = { 14 | time: `${Date.format(0, true)}`, 15 | data: `${e.Admin} Recebeu ${value} Safiras via *Bet System Refund (Jokempo)*` 16 | } 17 | 18 | for (const userId of players) 19 | socket?.send({ 20 | type: "transactions", 21 | transactionsData: { value, userId, transaction } 22 | }) 23 | 24 | await Database.User.updateMany( 25 | { id: { $in: players } }, 26 | { 27 | $inc: { Balance: value }, 28 | $push: { 29 | Transactions: { 30 | $each: [transaction], 31 | $position: 0 32 | } 33 | } 34 | }, 35 | { upsert: true } 36 | ) 37 | Database.refreshUsersData(players) 38 | } 39 | 40 | return await Database.Cache.Jokempo.delete(messageId) 41 | }) -------------------------------------------------------------------------------- /src/structures/events/reactionCreate.js: -------------------------------------------------------------------------------- 1 | import { SaphireClient as client, Database } from '../../classes/index.js' 2 | import votePoll from '../classes/buttons/poll/vote.poll.js' 3 | import availableEmojis from './system/emojis.reactions.js' 4 | import executeStars from './system/execute.stars.js' 5 | const onCooldown = {} 6 | 7 | client.on('messageReactionAdd', async (MessageReaction, user) => { 8 | 9 | const emojiName = MessageReaction?.emoji.name 10 | if (!MessageReaction || !user || user.bot || !availableEmojis.includes(emojiName)) return 11 | 12 | const message = MessageReaction.message.author === null 13 | ? await (async () => { 14 | const reactionFetched = await MessageReaction.fetch().catch(() => null) 15 | return reactionFetched?.message || null 16 | })() 17 | : MessageReaction?.message 18 | 19 | if (!message || !message.id) return 20 | 21 | if (emojiName === '⭐' && MessageReaction.count >= 2) { 22 | // const guildData = await Database.Guild.findOne({ id: message.guild.id }, 'Stars') 23 | const guildData = await Database.getGuild(message.guild.id) 24 | if (guildData?.Stars?.channel && !guildData.Stars?.sended?.some(data => data.messageId == message.id)) { 25 | if (onCooldown[message.id]) 26 | setTimeout(() => delete onCooldown[message.id], 1000 * 10) 27 | else { 28 | onCooldown[message.id] = true 29 | executeStars({ MessageReaction, user, guildData, client }) 30 | } 31 | } 32 | } 33 | 34 | if (message.author.id !== client.user.id || !message.interaction) return 35 | 36 | if (message.interaction.commandName.includes('bet')) 37 | return client.emit('betReaction', { message, user, emojiName }) 38 | 39 | if (message.interaction.commandName.includes('poll')) 40 | return votePoll({ message }) 41 | }) -------------------------------------------------------------------------------- /src/structures/events/ready.js: -------------------------------------------------------------------------------- 1 | import { Database, SaphireClient as client } from '../../classes/index.js' 2 | import { Emojis as e } from '../../util/util.js' 3 | 4 | client.once('ready', async () => { 5 | 6 | if (client.shardId === 0) { 7 | restarting(await Database.Cache.Client.get('Restart')) 8 | Database.registerClient(client.user.id) 9 | } 10 | 11 | return console.log(`Shard ${client.shardId} | Ready.`) 12 | }) 13 | 14 | async function restarting(restart) { 15 | 16 | if (!restart) return 17 | await Database.Cache.Client.delete('Restart') 18 | 19 | if (!restart.channelId || !restart.messageId) return 20 | 21 | return client.pushMessage({ 22 | method: 'patch', 23 | channelId: restart.channelId, 24 | messageId: restart.messageId, 25 | body: { 26 | method: 'patch', 27 | channelId: restart.channelId, 28 | messageId: restart.messageId, 29 | content: `${e.CheckV} | Reboot concluído.` 30 | } 31 | }) 32 | 33 | } -------------------------------------------------------------------------------- /src/structures/events/shardReconnecting.js: -------------------------------------------------------------------------------- 1 | import { SaphireClient as client } from "../../classes/index.js"; 2 | import { Config } from "../../util/Constants.js"; 3 | import { Emojis as e } from "../../util/util.js"; 4 | 5 | client.on('shardReconnecting', async shardId => { 6 | return client.pushMessage({ 7 | channelId: Config.statusChannelNotification, 8 | body: { 9 | content: `${e.Loading} | Iniciando a reconecção da **Shard ${shardId}**.` 10 | } 11 | }) 12 | }) -------------------------------------------------------------------------------- /src/structures/events/typingStart.js: -------------------------------------------------------------------------------- 1 | import { SaphireClient as client } from "../../classes/index.js"; 2 | import { FastTypesGames } from "../commands/slash/games/fasttype.js"; 3 | 4 | client.on("typingStart", typing => { 5 | const { channel, user, startedTimestamp } = typing 6 | if (!FastTypesGames[`${channel.id}_${user.id}.startedAt`]) return 7 | FastTypesGames[`${channel.id}_${user.id}.typingStarted`] = startedTimestamp 8 | return 9 | }) -------------------------------------------------------------------------------- /src/structures/events/webhookUpdate.js: -------------------------------------------------------------------------------- 1 | import { SaphireClient as client, Database } from "../../classes/index.js"; 2 | 3 | client.on("webhooksUpdate", async channel => { 4 | 5 | const { guild } = channel 6 | const guildData = await Database.getGuild(guild.id) 7 | const isLogChannel = guildData?.LogSystem?.channel 8 | 9 | if (isLogChannel !== channel.id) return 10 | 11 | const webhookFetch = await channel.fetchWebhooks().catch(() => null) 12 | const webhook = webhookFetch?.find(w => w?.name === "Global System Notification") 13 | if (webhook) return 14 | 15 | await Database.Guild.findOneAndUpdate( 16 | { id: guild.id }, 17 | { $unset: { "LogSystem.webhookUrl": true } }, 18 | { new: true, upsert: true } 19 | ) 20 | .then(doc => Database.saveGuildCache(doc?.id, doc)) 21 | return; 22 | }) -------------------------------------------------------------------------------- /src/structures/handler/events.handler.js: -------------------------------------------------------------------------------- 1 | import { readdirSync } from 'fs' 2 | const eventsFilesNames = readdirSync('./src/structures/events/').filter(fileName => fileName.endsWith('.js')) 3 | for (const eventFileName of eventsFilesNames) 4 | import(`../events/${eventFileName}`) -------------------------------------------------------------------------------- /src/util/Bind.js: -------------------------------------------------------------------------------- 1 | export function bindFunctions(instance) { 2 | if (!instance) return; 3 | 4 | const propertyNames = Object.getOwnPropertyNames(Object.getPrototypeOf(instance)); 5 | 6 | for (const propertyName of propertyNames) 7 | if (typeof instance[propertyName] === "function") 8 | (instance)[propertyName] = instance[propertyName].bind(instance); 9 | } -------------------------------------------------------------------------------- /src/util/Bytes.js: -------------------------------------------------------------------------------- 1 | export default class Bytes { 2 | units = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']; 3 | 4 | constructor(x) { 5 | this.x = x 6 | this.index = this._index 7 | this.bytes = this._bytes 8 | this.unit = this._unit 9 | } 10 | 11 | get _index() { 12 | if (!this.x) return 0; 13 | return Math.floor(Math.log(this.x) / Math.log(1000)); 14 | } 15 | 16 | get _bytes() { 17 | if (!this.x) return '0.00'; 18 | return (this.x / Math.pow(1024, this.index)).toFixed(2); 19 | } 20 | 21 | get _unit() { 22 | return this.units[this.index]; 23 | } 24 | 25 | toArray() { 26 | return [Number(this.bytes), this.unit]; 27 | } 28 | 29 | toString() { 30 | return `${this.bytes} ${this.unit}`; 31 | } 32 | 33 | toJSON() { 34 | return { 35 | bytes: Number(this.bytes), 36 | unit: this.unit, 37 | }; 38 | } 39 | 40 | *[Symbol.iterator]() { 41 | yield* this.toArray(); 42 | } 43 | } -------------------------------------------------------------------------------- /src/websocket/datamodels/animes.get.js: -------------------------------------------------------------------------------- 1 | import { Database } from "../../classes/index.js" 2 | 3 | export default async (req, res) => { 4 | 5 | if (req.headers?.authorization !== process.env.ROUTE_GET_DATA_FROM_DATABASE_PASSWORD) 6 | return res 7 | .send({ status: 401, response: "Authorization is not defined correctly." }); 8 | 9 | const documents = await Database.Anime.find() 10 | const docs = documents 11 | .map(doc => { 12 | const newDoc = Object.assign({}, doc)._doc 13 | newDoc._id = { "$oid": `${newDoc._id}` } 14 | return newDoc 15 | }) 16 | 17 | return res 18 | .status(200) 19 | .send(docs) 20 | } -------------------------------------------------------------------------------- /src/websocket/datamodels/cantadas.get.js: -------------------------------------------------------------------------------- 1 | import { Database } from "../../classes/index.js" 2 | 3 | export default async (req, res) => { 4 | 5 | if (req.headers?.authorization !== process.env.ROUTE_GET_DATA_FROM_DATABASE_PASSWORD) 6 | return res 7 | .send({ status: 401, response: "Authorization is not defined correctly." }); 8 | 9 | const documents = await Database.Cantadas.find() 10 | const docs = documents 11 | .map(doc => { 12 | const newDoc = Object.assign({}, doc)._doc 13 | newDoc._id = { "$oid": `${newDoc._id}` } 14 | return newDoc 15 | }) 16 | 17 | return res 18 | .status(200) 19 | .send(docs) 20 | } -------------------------------------------------------------------------------- /src/websocket/datamodels/client.get.js: -------------------------------------------------------------------------------- 1 | import { Database } from "../../classes/index.js" 2 | 3 | export default async (req, res) => { 4 | 5 | if (req.headers?.authorization !== process.env.ROUTE_GET_DATA_FROM_DATABASE_PASSWORD) 6 | return res 7 | .send({ status: 401, response: "Authorization is not defined correctly." }); 8 | 9 | const documents = await Database.Client.find() 10 | const docs = documents 11 | .map(doc => { 12 | const newDoc = Object.assign({}, doc)._doc 13 | newDoc._id = { "$oid": `${newDoc._id}` } 14 | return newDoc 15 | }) 16 | 17 | return res 18 | .status(200) 19 | .send(docs) 20 | } -------------------------------------------------------------------------------- /src/websocket/datamodels/economies.get.js: -------------------------------------------------------------------------------- 1 | import { Database } from "../../classes/index.js" 2 | 3 | export default async (req, res) => { 4 | 5 | if (req.headers?.authorization !== process.env.ROUTE_GET_DATA_FROM_DATABASE_PASSWORD) 6 | return res 7 | .send({ status: 401, response: "Authorization is not defined correctly." }); 8 | 9 | const documents = await Database.Economy.find() 10 | const docs = documents 11 | .map(doc => { 12 | const newDoc = Object.assign({}, doc)._doc 13 | newDoc._id = { "$oid": `${newDoc._id}` } 14 | return newDoc 15 | }) 16 | 17 | return res 18 | .status(200) 19 | .send(docs) 20 | } -------------------------------------------------------------------------------- /src/websocket/datamodels/fanarts.get.js: -------------------------------------------------------------------------------- 1 | import { Database } from "../../classes/index.js" 2 | 3 | export default async (req, res) => { 4 | 5 | if (req.headers?.authorization !== process.env.ROUTE_GET_DATA_FROM_DATABASE_PASSWORD) 6 | return res 7 | .send({ status: 401, response: "Authorization is not defined correctly." }); 8 | 9 | const documents = await Database.Fanart.find() 10 | const docs = documents 11 | .map(doc => { 12 | const newDoc = Object.assign({}, doc)._doc 13 | newDoc._id = { "$oid": `${newDoc._id}` } 14 | return newDoc 15 | }) 16 | 17 | return res 18 | .status(200) 19 | .send(docs) 20 | } -------------------------------------------------------------------------------- /src/websocket/datamodels/guilds.get.js: -------------------------------------------------------------------------------- 1 | import { Database } from "../../classes/index.js" 2 | 3 | export default async (req, res) => { 4 | 5 | if (req.headers?.authorization !== process.env.ROUTE_GET_DATA_FROM_DATABASE_PASSWORD) 6 | return res 7 | .send({ status: 401, response: "Authorization is not defined correctly." }); 8 | 9 | const documents = await Database.Guild.find() 10 | const docs = documents 11 | .map(doc => { 12 | const newDoc = Object.assign({}, doc)._doc 13 | newDoc._id = { "$oid": `${newDoc._id}` } 14 | return newDoc 15 | }) 16 | 17 | return res 18 | .status(200) 19 | .send(docs) 20 | } -------------------------------------------------------------------------------- /src/websocket/datamodels/indications.get.js: -------------------------------------------------------------------------------- 1 | import { Database } from "../../classes/index.js" 2 | 3 | export default async (req, res) => { 4 | 5 | if (req.headers?.authorization !== process.env.ROUTE_GET_DATA_FROM_DATABASE_PASSWORD) 6 | return res 7 | .send({ status: 401, response: "Authorization is not defined correctly." }); 8 | 9 | const documents = await Database.Indications.find() 10 | const docs = documents 11 | .map(doc => { 12 | const newDoc = Object.assign({}, doc)._doc 13 | newDoc._id = { "$oid": `${newDoc._id}` } 14 | return newDoc 15 | }) 16 | 17 | return res 18 | .status(200) 19 | .send(docs) 20 | } -------------------------------------------------------------------------------- /src/websocket/datamodels/rathers.get.js: -------------------------------------------------------------------------------- 1 | import { Database } from "../../classes/index.js" 2 | 3 | export default async (req, res) => { 4 | 5 | if (req.headers?.authorization !== process.env.ROUTE_GET_DATA_FROM_DATABASE_PASSWORD) 6 | return res 7 | .send({ status: 401, response: "Authorization is not defined correctly." }); 8 | 9 | const documents = await Database.Rather.find() 10 | const docs = documents 11 | .map(doc => { 12 | const newDoc = Object.assign({}, doc)._doc 13 | newDoc._id = { "$oid": `${newDoc._id}` } 14 | return newDoc 15 | }) 16 | 17 | return res 18 | .status(200) 19 | .send(docs) 20 | } -------------------------------------------------------------------------------- /src/websocket/datamodels/reminders.get.js: -------------------------------------------------------------------------------- 1 | import { Database } from "../../classes/index.js" 2 | 3 | export default async (req, res) => { 4 | 5 | if (req.headers?.authorization !== process.env.ROUTE_GET_DATA_FROM_DATABASE_PASSWORD) 6 | return res 7 | .send({ status: 401, response: "Authorization is not defined correctly." }); 8 | 9 | const documents = await Database.Reminder.find() 10 | const docs = documents 11 | .map(doc => { 12 | const newDoc = Object.assign({}, doc)._doc 13 | newDoc._id = { "$oid": `${newDoc._id}` } 14 | return newDoc 15 | }) 16 | 17 | return res 18 | .status(200) 19 | .send(docs) 20 | } -------------------------------------------------------------------------------- /src/websocket/datamodels/users.get.js: -------------------------------------------------------------------------------- 1 | import { Database } from "../../classes/index.js" 2 | 3 | export default async (req, res) => { 4 | 5 | if (req.headers?.authorization !== process.env.ROUTE_GET_DATA_FROM_DATABASE_PASSWORD) 6 | return res 7 | .send({ status: 401, response: "Authorization is not defined correctly." }); 8 | 9 | const documents = await Database.User.find() 10 | const docs = documents 11 | .map(doc => { 12 | const newDoc = Object.assign({}, doc)._doc 13 | newDoc._id = { "$oid": `${newDoc._id}` } 14 | return newDoc 15 | }) 16 | 17 | return res 18 | .status(200) 19 | .send(docs) 20 | } -------------------------------------------------------------------------------- /temp/temp.txt: -------------------------------------------------------------------------------- 1 | Just a folder to keep safe some temp files --------------------------------------------------------------------------------