From 1da08869506d0a3b76eb63dd65a5d12278efbf17 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Mon, 20 Nov 2023 00:01:50 +0000 Subject: [PATCH 1/6] Update dependency @types/uuid to v9.0.7 --- yarn.lock | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/yarn.lock b/yarn.lock index 93ad72a..0b9f066 100644 --- a/yarn.lock +++ b/yarn.lock @@ -937,14 +937,7 @@ resolved "https://registry.yarnpkg.com/@types/mime/-/mime-1.3.5.tgz#1ef302e01cf7d2b5a0fa526790c9123bf1d06690" integrity sha512-/pyBZWSLD2n0dcHE3hq8s8ZvcETHtEuF+3E7XVt0Ig2nvsVQXdghHVcEkIWjy9A0wKfTn97a/PSDYohKIlnP/w== -"@types/node@*": - version "20.9.0" - resolved "https://registry.yarnpkg.com/@types/node/-/node-20.9.0.tgz#bfcdc230583aeb891cf51e73cfdaacdd8deae298" - integrity sha512-nekiGu2NDb1BcVofVcEKMIwzlx4NjHlcjhoxxKBNLtz15Y1z7MYf549DFvkHSId02Ax6kGwWntIBPC3l/JZcmw== - dependencies: - undici-types "~5.26.4" - -"@types/node@^20.0.0": +"@types/node@*", "@types/node@^20.0.0": version "20.9.0" resolved "https://registry.yarnpkg.com/@types/node/-/node-20.9.0.tgz#bfcdc230583aeb891cf51e73cfdaacdd8deae298" integrity sha512-nekiGu2NDb1BcVofVcEKMIwzlx4NjHlcjhoxxKBNLtz15Y1z7MYf549DFvkHSId02Ax6kGwWntIBPC3l/JZcmw== @@ -996,14 +989,14 @@ integrity sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw== "@types/uuid@^9.0.0": - version "9.0.6" - resolved "https://registry.yarnpkg.com/@types/uuid/-/uuid-9.0.6.tgz#c91ae743d8344a54b2b0c691195f5ff5265f6dfb" - integrity sha512-BT2Krtx4xaO6iwzwMFUYvWBWkV2pr37zD68Vmp1CDV196MzczBRxuEpD6Pr395HAgebC/co7hOphs53r8V7jew== + version "9.0.7" + resolved "https://registry.yarnpkg.com/@types/uuid/-/uuid-9.0.7.tgz#b14cebc75455eeeb160d5fe23c2fcc0c64f724d8" + integrity sha512-WUtIVRUZ9i5dYXefDEAI7sh9/O7jGvHg7Df/5O/gtH3Yabe5odI3UWopVR1qbPXQtvOxWu3mM4XxlYeZtMWF4g== "@types/ws@^8.5.5": - version "8.5.8" - resolved "https://registry.yarnpkg.com/@types/ws/-/ws-8.5.8.tgz#13efec7bd439d0bdf2af93030804a94f163b1430" - integrity sha512-flUksGIQCnJd6sZ1l5dqCEG/ksaoAg/eUwiLAGTJQcfgvZJKF++Ta4bJA6A5aPSJmsr+xlseHn4KLgVlNnvPTg== + version "8.5.9" + resolved "https://registry.yarnpkg.com/@types/ws/-/ws-8.5.9.tgz#384c489f99c83225a53f01ebc3eddf3b8e202a8c" + integrity sha512-jbdrY0a8lxfdTp/+r7Z4CkycbOFN8WX+IOchLJr3juT/xzbJ8URyTVSJ/hvNdadTgM1mnedb47n+Y31GsFnQlg== dependencies: "@types/node" "*" From de9f3d42733d7dcf7041732c13dd983b1afb5093 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Mon, 20 Nov 2023 18:31:24 +0000 Subject: [PATCH 2/6] Update dependency @types/node to v20.9.2 (#93) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node) ([source](https://github.com/DefinitelyTyped/DefinitelyTyped)) | devDependencies | patch | [`20.9.0` -> `20.9.2`](https://renovatebot.com/diffs/npm/@types%2fnode/20.9.0/20.9.2) | --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). Reviewed-on: https://gitea.vylpes.xyz/External/card-drop/pulls/93 Reviewed-by: Vylpes Co-authored-by: Renovate Bot Co-committed-by: Renovate Bot --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 93ad72a..edf7c7e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -945,9 +945,9 @@ undici-types "~5.26.4" "@types/node@^20.0.0": - version "20.9.0" - resolved "https://registry.yarnpkg.com/@types/node/-/node-20.9.0.tgz#bfcdc230583aeb891cf51e73cfdaacdd8deae298" - integrity sha512-nekiGu2NDb1BcVofVcEKMIwzlx4NjHlcjhoxxKBNLtz15Y1z7MYf549DFvkHSId02Ax6kGwWntIBPC3l/JZcmw== + version "20.9.2" + resolved "https://registry.yarnpkg.com/@types/node/-/node-20.9.2.tgz#002815c8e87fe0c9369121c78b52e800fadc0ac6" + integrity sha512-WHZXKFCEyIUJzAwh3NyyTHYSR35SevJ6mZ1nWwJafKtiQbqRTIKSRcw3Ma3acqgsent3RRDqeVwpHntMk+9irg== dependencies: undici-types "~5.26.4" From 0d6005044c6f8f5bd810df3e219f2c918565825d Mon Sep 17 00:00:00 2001 From: Ethan Lane Date: Thu, 23 Nov 2023 17:28:15 +0000 Subject: [PATCH 3/6] Add resync commmand --- src/Functions/CardSetupFunction.ts | 7 ++++-- src/commands/resync.ts | 38 ++++++++++++++++++++++++++++++ src/registry.ts | 2 ++ 3 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 src/commands/resync.ts diff --git a/src/Functions/CardSetupFunction.ts b/src/Functions/CardSetupFunction.ts index 037b87b..ea8c2c6 100644 --- a/src/Functions/CardSetupFunction.ts +++ b/src/Functions/CardSetupFunction.ts @@ -7,8 +7,8 @@ import { CardRarity, CardRarityToString } from "../constants/CardRarity"; import Config from "../database/entities/app/Config"; export default class CardSetupFunction { - public static async Execute() { - if (await Config.GetValue('safemode') == "true") return; + public static async Execute(): Promise { + if (await Config.GetValue('safemode') == "true") return false; try { await this.ClearDatabase(); @@ -16,7 +16,10 @@ export default class CardSetupFunction { await this.ReadCards(); } catch { await Config.SetValue('safemode', 'true'); + return false; } + + return true; } private static async ClearDatabase() { diff --git a/src/commands/resync.ts b/src/commands/resync.ts new file mode 100644 index 0000000..a3ea823 --- /dev/null +++ b/src/commands/resync.ts @@ -0,0 +1,38 @@ +import { CacheType, CommandInteraction, PermissionsBitField, SlashCommandBuilder } from "discord.js"; +import { Command } from "../type/command"; +import CardSetupFunction from "../Functions/CardSetupFunction"; +import Config from "../database/entities/app/Config"; + +export default class Resync extends Command { + constructor() { + super(); + + super.CommandBuilder = new SlashCommandBuilder() + .setName('resync') + .setDescription('Resync the card database') + .setDefaultMemberPermissions(PermissionsBitField.Flags.Administrator); + } + + public override async execute(interaction: CommandInteraction) { + if (!interaction.isChatInputCommand()) return; + + const whitelistedUsers = process.env.GDRIVESYNC_WHITELIST!.split(','); + + if (!whitelistedUsers.find(x => x == interaction.user.id)) { + await interaction.reply("Only whitelisted users can use this command."); + return; + } + + if (await CardSetupFunction.Execute()) { + if (await Config.GetValue('safemode') == "true") { + await Config.SetValue('safemode', 'false'); + await interaction.reply("Resynced database and disabled safe mode."); + + return; + } + await interaction.reply("Resynced database."); + } else { + await interaction.reply("Resync failed, safe mode has been activated until successful resync."); + } + } +} \ No newline at end of file diff --git a/src/registry.ts b/src/registry.ts index 9619437..e602198 100644 --- a/src/registry.ts +++ b/src/registry.ts @@ -4,6 +4,7 @@ import { CoreClient } from "./client/client"; import About from "./commands/about"; import Drop from "./commands/drop"; import Gdrivesync from "./commands/gdrivesync"; +import Resync from "./commands/resync"; // Test Command Imports import Dropnumber from "./commands/stage/dropnumber"; @@ -20,6 +21,7 @@ export default class Registry { CoreClient.RegisterCommand('about', new About()); CoreClient.RegisterCommand('drop', new Drop()); CoreClient.RegisterCommand('gdrivesync', new Gdrivesync()); + CoreClient.RegisterCommand('resync', new Resync()); // Test Commands CoreClient.RegisterCommand('dropnumber', new Dropnumber(), Environment.Test); From e37d5969e0c3fd4abedcc76dd1e5c8dbcf8d6f7f Mon Sep 17 00:00:00 2001 From: Ethan Lane Date: Thu, 23 Nov 2023 17:28:40 +0000 Subject: [PATCH 4/6] 0.2.1 --- .dev.env | 2 +- .prod.env | 2 +- .stage.env | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.dev.env b/.dev.env index 02c46a1..26a975e 100644 --- a/.dev.env +++ b/.dev.env @@ -7,7 +7,7 @@ # any secret values. BOT_TOKEN= -BOT_VER=0.2 DEV +BOT_VER=0.2.1 DEV BOT_AUTHOR=Vylpes BOT_OWNERID=147392775707426816 BOT_CLIENTID=682942374040961060 diff --git a/.prod.env b/.prod.env index 1f338a2..f2356de 100644 --- a/.prod.env +++ b/.prod.env @@ -7,7 +7,7 @@ # any secret values. BOT_TOKEN= -BOT_VER=0.2 +BOT_VER=0.2.1 BOT_AUTHOR=Vylpes BOT_OWNERID=147392775707426816 BOT_CLIENTID=1093810443589529631 diff --git a/.stage.env b/.stage.env index 0a63651..ab0babf 100644 --- a/.stage.env +++ b/.stage.env @@ -7,7 +7,7 @@ # any secret values. BOT_TOKEN= -BOT_VER=0.2 BETA +BOT_VER=0.2.1 BETA BOT_AUTHOR=Vylpes BOT_OWNERID=147392775707426816 BOT_CLIENTID=1147976642942214235 From b9c0151285d3e1a97e8e5835f61112513a6319ed Mon Sep 17 00:00:00 2001 From: Ethan Lane Date: Thu, 23 Nov 2023 17:30:00 +0000 Subject: [PATCH 5/6] v0.2.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ebe4870..ad7a30f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "card-drop", - "version": "0.2.0", + "version": "0.2.1", "main": "./dist/bot.js", "typings": "./dist", "scripts": { From 28c1f888dedbfc463752acba595dabd5153c747e Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Mon, 27 Nov 2023 00:00:51 +0000 Subject: [PATCH 6/6] Update dependency @types/uuid to v9.0.7 --- yarn.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/yarn.lock b/yarn.lock index edf7c7e..e71953d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -996,14 +996,14 @@ integrity sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw== "@types/uuid@^9.0.0": - version "9.0.6" - resolved "https://registry.yarnpkg.com/@types/uuid/-/uuid-9.0.6.tgz#c91ae743d8344a54b2b0c691195f5ff5265f6dfb" - integrity sha512-BT2Krtx4xaO6iwzwMFUYvWBWkV2pr37zD68Vmp1CDV196MzczBRxuEpD6Pr395HAgebC/co7hOphs53r8V7jew== + version "9.0.7" + resolved "https://registry.yarnpkg.com/@types/uuid/-/uuid-9.0.7.tgz#b14cebc75455eeeb160d5fe23c2fcc0c64f724d8" + integrity sha512-WUtIVRUZ9i5dYXefDEAI7sh9/O7jGvHg7Df/5O/gtH3Yabe5odI3UWopVR1qbPXQtvOxWu3mM4XxlYeZtMWF4g== "@types/ws@^8.5.5": - version "8.5.8" - resolved "https://registry.yarnpkg.com/@types/ws/-/ws-8.5.8.tgz#13efec7bd439d0bdf2af93030804a94f163b1430" - integrity sha512-flUksGIQCnJd6sZ1l5dqCEG/ksaoAg/eUwiLAGTJQcfgvZJKF++Ta4bJA6A5aPSJmsr+xlseHn4KLgVlNnvPTg== + version "8.5.10" + resolved "https://registry.yarnpkg.com/@types/ws/-/ws-8.5.10.tgz#4acfb517970853fa6574a3a6886791d04a396787" + integrity sha512-vmQSUcfalpIq0R9q7uTo2lXs6eGIpt9wtnLdMv9LVpIjCA/+ufZRozlVoVelIYixx1ugCBKDhn89vnsEGOCx9A== dependencies: "@types/node" "*"