Compare commits
1 commit
28c1f888de
...
1da0886950
Author | SHA1 | Date | |
---|---|---|---|
1da0886950 |
8 changed files with 10 additions and 60 deletions
2
.dev.env
2
.dev.env
|
@ -7,7 +7,7 @@
|
|||
# any secret values.
|
||||
|
||||
BOT_TOKEN=
|
||||
BOT_VER=0.2.1 DEV
|
||||
BOT_VER=0.2 DEV
|
||||
BOT_AUTHOR=Vylpes
|
||||
BOT_OWNERID=147392775707426816
|
||||
BOT_CLIENTID=682942374040961060
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
# any secret values.
|
||||
|
||||
BOT_TOKEN=
|
||||
BOT_VER=0.2.1
|
||||
BOT_VER=0.2
|
||||
BOT_AUTHOR=Vylpes
|
||||
BOT_OWNERID=147392775707426816
|
||||
BOT_CLIENTID=1093810443589529631
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
# any secret values.
|
||||
|
||||
BOT_TOKEN=
|
||||
BOT_VER=0.2.1 BETA
|
||||
BOT_VER=0.2 BETA
|
||||
BOT_AUTHOR=Vylpes
|
||||
BOT_OWNERID=147392775707426816
|
||||
BOT_CLIENTID=1147976642942214235
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "card-drop",
|
||||
"version": "0.2.1",
|
||||
"version": "0.2.0",
|
||||
"main": "./dist/bot.js",
|
||||
"typings": "./dist",
|
||||
"scripts": {
|
||||
|
|
|
@ -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(): Promise<boolean> {
|
||||
if (await Config.GetValue('safemode') == "true") return false;
|
||||
public static async Execute() {
|
||||
if (await Config.GetValue('safemode') == "true") return;
|
||||
|
||||
try {
|
||||
await this.ClearDatabase();
|
||||
|
@ -16,10 +16,7 @@ export default class CardSetupFunction {
|
|||
await this.ReadCards();
|
||||
} catch {
|
||||
await Config.SetValue('safemode', 'true');
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private static async ClearDatabase() {
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
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<CacheType>) {
|
||||
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.");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -4,7 +4,6 @@ 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";
|
||||
|
@ -21,7 +20,6 @@ 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);
|
||||
|
|
15
yarn.lock
15
yarn.lock
|
@ -937,20 +937,13 @@
|
|||
resolved "https://registry.yarnpkg.com/@types/mime/-/mime-1.3.5.tgz#1ef302e01cf7d2b5a0fa526790c9123bf1d06690"
|
||||
integrity sha512-/pyBZWSLD2n0dcHE3hq8s8ZvcETHtEuF+3E7XVt0Ig2nvsVQXdghHVcEkIWjy9A0wKfTn97a/PSDYohKIlnP/w==
|
||||
|
||||
"@types/node@*":
|
||||
"@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==
|
||||
dependencies:
|
||||
undici-types "~5.26.4"
|
||||
|
||||
"@types/node@^20.0.0":
|
||||
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"
|
||||
|
||||
"@types/normalize-package-data@^2.4.1":
|
||||
version "2.4.3"
|
||||
resolved "https://registry.yarnpkg.com/@types/normalize-package-data/-/normalize-package-data-2.4.3.tgz#291c243e4b94dbfbc0c0ee26b7666f1d5c030e2c"
|
||||
|
@ -1001,9 +994,9 @@
|
|||
integrity sha512-WUtIVRUZ9i5dYXefDEAI7sh9/O7jGvHg7Df/5O/gtH3Yabe5odI3UWopVR1qbPXQtvOxWu3mM4XxlYeZtMWF4g==
|
||||
|
||||
"@types/ws@^8.5.5":
|
||||
version "8.5.10"
|
||||
resolved "https://registry.yarnpkg.com/@types/ws/-/ws-8.5.10.tgz#4acfb517970853fa6574a3a6886791d04a396787"
|
||||
integrity sha512-vmQSUcfalpIq0R9q7uTo2lXs6eGIpt9wtnLdMv9LVpIjCA/+ufZRozlVoVelIYixx1ugCBKDhn89vnsEGOCx9A==
|
||||
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" "*"
|
||||
|
||||
|
|
Loading…
Reference in a new issue