mirror of
https://github.com/JonnyBro/JaBa.git
synced 2024-11-21 20:54:58 +05:00
update scripts
This commit is contained in:
parent
7049245b12
commit
10bb0a9309
5 changed files with 24 additions and 23 deletions
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"To get access to these emojis,": "add your bot on https://emojis.atlanta-bot.fr",
|
||||
"To get access to these emojis,": "add your bot on https://discord.gg/5wrBEwE4bc",
|
||||
|
||||
"stats": "<:atlanta_stats:598179382657286152>",
|
||||
"ram": "<:atlanta_ram:598178809031688192>",
|
||||
|
|
|
@ -7,7 +7,8 @@
|
|||
"scripts": {
|
||||
"start": "node .",
|
||||
"lint": "eslint . --ext .js",
|
||||
"testcfg": "node scripts/verify-config.js"
|
||||
"testcfg": "node scripts/verify-config.js",
|
||||
"migratedb": "node scripts/migrate-db-from-v4.6-to-v4.7.js"
|
||||
},
|
||||
"author": "Jonny_Bro",
|
||||
"license": "ISC",
|
||||
|
|
|
@ -6,7 +6,7 @@ let MongoClient;
|
|||
try {
|
||||
MongoClient = require("mongodb").MongoClient;
|
||||
} catch (e) {
|
||||
console.log(chalk.red("Cannot find module mongodb. Please install it using \"npm install mongodb\" before executing migration scripts."));
|
||||
console.log(chalk.red("Cannot find module mongodb. Please install it using \"npm install mongodb\" before executing script."));
|
||||
process.exit(1);
|
||||
};
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ let MongoClient;
|
|||
try {
|
||||
MongoClient = require("mongodb").MongoClient;
|
||||
} catch (e) {
|
||||
console.log(chalk.red("Cannot find module mongodb. Please install it using \"npm install mongodb\" before executing migration scripts."));
|
||||
console.log(chalk.red("Cannot find module mongodb. Please install it using \"npm install mongodb\" before executing script."));
|
||||
process.exit(1);
|
||||
};
|
||||
|
||||
|
@ -23,11 +23,11 @@ client.connect().then(async () => {
|
|||
const db = client.db(dbName);
|
||||
const guilds = db.collection("guilds");
|
||||
|
||||
const count = await guilds.countDocuments({ $or: [ { language: "english" }, { language: "french" } ] });
|
||||
const count = await guilds.countDocuments({ $or: [ { language: "english" }, { language: "russian" } ] });
|
||||
console.log(chalk.yellow(`${count} guilds need to be migrated. Migrating...`));
|
||||
|
||||
await guilds.updateMany({ language: "english" }, { $set: { language: "ru-RU"} });
|
||||
await guilds.updateMany({ language: "french" }, { $set: { language: "ru-RU"} });
|
||||
await guilds.updateMany({ language: "english" }, { $set: { language: "en-US"} });
|
||||
await guilds.updateMany({ language: "russian" }, { $set: { language: "ru-RU"} });
|
||||
|
||||
console.log(chalk.green(`${count} guilds migrated.`));
|
||||
console.log(chalk.blue("\n\nDatabase migrated from v4.6.4 to v4.7.0..."));
|
||||
|
|
|
@ -29,16 +29,16 @@ const checks = [
|
|||
let readyResolve;
|
||||
new Promise((resolve) => readyResolve = resolve);
|
||||
client.login(config.token).then(async () => {
|
||||
success("valid bot token");
|
||||
success("Valid bot token");
|
||||
await readyResolve();
|
||||
if (!client.guilds.cache.has("568120814776614924")) {
|
||||
error("should be added to the emojis server", "please add your bot on this server: https://emojis.atlanta-bot.fr to make the emojis working");
|
||||
error("Should be added to the emojis server", "please add your bot on this server: https://discord.gg/5wrBEwE4bc to make the emojis working");
|
||||
} else {
|
||||
success("added to the emojis server");
|
||||
success("Added to the emojis server");
|
||||
};
|
||||
res();
|
||||
}).catch(() => {
|
||||
error("should be a valid bot token");
|
||||
error("Should be a valid bot token");
|
||||
res();
|
||||
});
|
||||
client.on("ready", readyResolve);
|
||||
|
@ -57,7 +57,7 @@ const checks = [
|
|||
success("Connection to Mongo database success");
|
||||
res();
|
||||
}).catch(() => {
|
||||
error("should be able to connect to Mongo database", "please verify if the MongoDB server is started");
|
||||
error("Should be able to connect to Mongo database", "please verify if the MongoDB server is started");
|
||||
res();
|
||||
});
|
||||
});
|
||||
|
@ -66,7 +66,7 @@ const checks = [
|
|||
console.log("\n\nAPI keys");
|
||||
return new Promise(async (resolve) => {
|
||||
if (!config.apiKeys.amethyste) {
|
||||
ignore("amethyste API is not configured, key should not be checked.");
|
||||
ignore("Amethyste API is not configured, key should not be checked.");
|
||||
} else {
|
||||
const res = await fetch("https://v1.api.amethyste.moe/generate/blurple", {
|
||||
method: "POST",
|
||||
|
@ -76,9 +76,9 @@ const checks = [
|
|||
});
|
||||
const result = await res.json();
|
||||
if (result.status === 401) {
|
||||
error("should be a valid Amethyste API key", "get your key here: https://api.amethyste.moe/");
|
||||
error("Should be a valid Amethyste API key", "get your key here: https://api.amethyste.moe/");
|
||||
} else {
|
||||
success("valid Amethyste API key");
|
||||
success("Valid Amethyste API key");
|
||||
};
|
||||
}
|
||||
if (!config.apiKeys.blagueXYZ) {
|
||||
|
@ -91,9 +91,9 @@ const checks = [
|
|||
});
|
||||
const result = await res.json();
|
||||
if (result.status === 401) {
|
||||
error("should be a valid blague.xyz key", "get your key here: https://blague.xyz/");
|
||||
error("Should be a valid blague.xyz key", "get your key here: https://blague.xyz/");
|
||||
} else {
|
||||
success("valid blague.xyz key");
|
||||
success("Valid blague.xyz key");
|
||||
};
|
||||
};
|
||||
if (!config.apiKeys.dbl) {
|
||||
|
@ -107,9 +107,9 @@ const checks = [
|
|||
});
|
||||
const result = await res.json();
|
||||
if (result.error && result.error === "Unauthorized") {
|
||||
error("should be a valid DBL key", "get your key here: https://top.gg/ OR delete the key from the config if you don't have a key");
|
||||
error("Should be a valid DBL key", "get your key here: https://top.gg/ OR delete the key from the config if you don't have a key");
|
||||
} else {
|
||||
success("valid DBL key");
|
||||
success("Valid DBL key");
|
||||
};
|
||||
};
|
||||
if (!config.apiKeys.fortniteFNBR) {
|
||||
|
@ -122,9 +122,9 @@ const checks = [
|
|||
});
|
||||
const result = await res.json();
|
||||
if (result.status && result.status === 401) {
|
||||
error("should be a valid FNBR key", "get your key here: https://fnbr.co/api/docs");
|
||||
error("Should be a valid FNBR key", "get your key here: https://fnbr.co/api/docs");
|
||||
} else {
|
||||
success("valid FNBR key");
|
||||
success("Valid FNBR key");
|
||||
};
|
||||
};
|
||||
if (!config.apiKeys.sentryDSN) {
|
||||
|
@ -167,9 +167,9 @@ const checks = [
|
|||
};
|
||||
const isPortTaken = await checkPortTaken(config.dashboard.port);
|
||||
if (isPortTaken) {
|
||||
error("dashboard port should be available", "you have probably another process using this port");
|
||||
error("Dashboard port should be available", "you have probably another process using this port");
|
||||
} else {
|
||||
success("dashboard port is available");
|
||||
success("Dashboard port is available");
|
||||
};
|
||||
};
|
||||
resolve();
|
||||
|
|
Loading…
Reference in a new issue