Compare commits
No commits in common. "232e4b260f770225b9b981915efeb98088f60cb8" and "de9f3d42733d7dcf7041732c13dd983b1afb5093" have entirely different histories.
232e4b260f
...
de9f3d4273
7 changed files with 6 additions and 49 deletions
2
.dev.env
2
.dev.env
|
@ -7,7 +7,7 @@
|
||||||
# any secret values.
|
# any secret values.
|
||||||
|
|
||||||
BOT_TOKEN=
|
BOT_TOKEN=
|
||||||
BOT_VER=0.2.1 DEV
|
BOT_VER=0.2 DEV
|
||||||
BOT_AUTHOR=Vylpes
|
BOT_AUTHOR=Vylpes
|
||||||
BOT_OWNERID=147392775707426816
|
BOT_OWNERID=147392775707426816
|
||||||
BOT_CLIENTID=682942374040961060
|
BOT_CLIENTID=682942374040961060
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
# any secret values.
|
# any secret values.
|
||||||
|
|
||||||
BOT_TOKEN=
|
BOT_TOKEN=
|
||||||
BOT_VER=0.2.1
|
BOT_VER=0.2
|
||||||
BOT_AUTHOR=Vylpes
|
BOT_AUTHOR=Vylpes
|
||||||
BOT_OWNERID=147392775707426816
|
BOT_OWNERID=147392775707426816
|
||||||
BOT_CLIENTID=1093810443589529631
|
BOT_CLIENTID=1093810443589529631
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
# any secret values.
|
# any secret values.
|
||||||
|
|
||||||
BOT_TOKEN=
|
BOT_TOKEN=
|
||||||
BOT_VER=0.2.1 BETA
|
BOT_VER=0.2 BETA
|
||||||
BOT_AUTHOR=Vylpes
|
BOT_AUTHOR=Vylpes
|
||||||
BOT_OWNERID=147392775707426816
|
BOT_OWNERID=147392775707426816
|
||||||
BOT_CLIENTID=1147976642942214235
|
BOT_CLIENTID=1147976642942214235
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "card-drop",
|
"name": "card-drop",
|
||||||
"version": "0.2.1",
|
"version": "0.2.0",
|
||||||
"main": "./dist/bot.js",
|
"main": "./dist/bot.js",
|
||||||
"typings": "./dist",
|
"typings": "./dist",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
|
@ -7,8 +7,8 @@ import { CardRarity, CardRarityToString } from "../constants/CardRarity";
|
||||||
import Config from "../database/entities/app/Config";
|
import Config from "../database/entities/app/Config";
|
||||||
|
|
||||||
export default class CardSetupFunction {
|
export default class CardSetupFunction {
|
||||||
public static async Execute(): Promise<boolean> {
|
public static async Execute() {
|
||||||
if (await Config.GetValue('safemode') == "true") return false;
|
if (await Config.GetValue('safemode') == "true") return;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await this.ClearDatabase();
|
await this.ClearDatabase();
|
||||||
|
@ -16,10 +16,7 @@ export default class CardSetupFunction {
|
||||||
await this.ReadCards();
|
await this.ReadCards();
|
||||||
} catch {
|
} catch {
|
||||||
await Config.SetValue('safemode', 'true');
|
await Config.SetValue('safemode', 'true');
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static async ClearDatabase() {
|
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 About from "./commands/about";
|
||||||
import Drop from "./commands/drop";
|
import Drop from "./commands/drop";
|
||||||
import Gdrivesync from "./commands/gdrivesync";
|
import Gdrivesync from "./commands/gdrivesync";
|
||||||
import Resync from "./commands/resync";
|
|
||||||
|
|
||||||
// Test Command Imports
|
// Test Command Imports
|
||||||
import Dropnumber from "./commands/stage/dropnumber";
|
import Dropnumber from "./commands/stage/dropnumber";
|
||||||
|
@ -21,7 +20,6 @@ export default class Registry {
|
||||||
CoreClient.RegisterCommand('about', new About());
|
CoreClient.RegisterCommand('about', new About());
|
||||||
CoreClient.RegisterCommand('drop', new Drop());
|
CoreClient.RegisterCommand('drop', new Drop());
|
||||||
CoreClient.RegisterCommand('gdrivesync', new Gdrivesync());
|
CoreClient.RegisterCommand('gdrivesync', new Gdrivesync());
|
||||||
CoreClient.RegisterCommand('resync', new Resync());
|
|
||||||
|
|
||||||
// Test Commands
|
// Test Commands
|
||||||
CoreClient.RegisterCommand('dropnumber', new Dropnumber(), Environment.Test);
|
CoreClient.RegisterCommand('dropnumber', new Dropnumber(), Environment.Test);
|
||||||
|
|
Loading…
Reference in a new issue