Compare commits

..

No commits in common. "85fd5e9de9acbb26622bd9f83223921b46d24035" and "f6600f3f741c7a5800682e963f11e0eb61378020" have entirely different histories.

6 changed files with 23 additions and 32 deletions

View File

@ -1,13 +1,15 @@
const { SlashCommandBuilder } = require('@discordjs/builders'); const { SlashCommandBuilder } = require('@discordjs/builders');
const { MessageAttachment } = require("discord.js"); const { MessageAttachment } = require("discord.js");
const fs = require('node:fs'); const fs = require('node:fs');
const { submissions, commands } = require("../config/config.js");
async function execute(interaction) { async function execute(interaction) {
const game = interaction.options.getString("game"); const game = interaction.options.getString("game");
const fname = submissions[game]; let fname;
if (fname === undefined) { if (game === "bhop") fname = "files/bhop_submissions.csv";
else if (game === "surf") fname = "files/surf_submissions.csv";
else if (game === "deathrun") fname = "files/deathrun_submissions.csv";
else {
await interaction.reply({content: "Invalid game specified!", ephemeral: true}); await interaction.reply({content: "Invalid game specified!", ephemeral: true});
return; return;
} }
@ -31,7 +33,7 @@ module.exports = {
option.setName("game") option.setName("game")
.setDescription("Select the maptest game") .setDescription("Select the maptest game")
.setRequired(true) .setRequired(true)
.addChoices(commands)) .addChoices({name: "bhop", value: "bhop"}, {name: "surf", value: "surf"}, {name: "deathrun", value: "deathrun"}))
, ,
execute execute
}; };

View File

@ -3,7 +3,6 @@ const { parse } = require("csv-parse/sync");
const fs = require('node:fs'); const fs = require('node:fs');
const noblox = require("noblox.js"); const noblox = require("noblox.js");
const axios = require("axios").default; const axios = require("axios").default;
const { submissions, commands } = require("../config/config.js");
async function robloxUserFromDiscord(id) { async function robloxUserFromDiscord(id) {
if (isNaN(id)) return undefined; if (isNaN(id)) return undefined;
@ -34,8 +33,11 @@ async function execute(interaction) {
} }
const game = interaction.options.getString("game"); const game = interaction.options.getString("game");
const fname = submissions[game]; let fname;
if (fname === undefined) { if (game === "bhop") fname = "files/bhop_submissions.csv";
else if (game === "surf") fname = "files/surf_submissions.csv";
else if (game === "deathrun") fname = "files/deathrun_submissions.csv";
else {
await interaction.reply({content: "Invalid game specified!", ephemeral: true}); await interaction.reply({content: "Invalid game specified!", ephemeral: true});
return; return;
} }
@ -95,7 +97,7 @@ module.exports = {
option.setName("game") option.setName("game")
.setDescription("Select the maptest game") .setDescription("Select the maptest game")
.setRequired(true) .setRequired(true)
.addChoices(commands)) .addChoices({name: "bhop", value: "bhop"}, {name: "surf", value: "surf"}, {name: "deathrun", value: "deathrun"}))
.addIntegerOption(option => .addIntegerOption(option =>
option.setName("asset_id") option.setName("asset_id")
.setDescription("The asset ID of the model") .setDescription("The asset ID of the model")
@ -135,4 +137,4 @@ function getProductInfo (asset) {
return reject(error); return reject(error);
} }
}) })
} }

View File

@ -1,11 +1,14 @@
const { SlashCommandBuilder } = require('@discordjs/builders'); const { SlashCommandBuilder } = require('@discordjs/builders');
const noblox = require("noblox.js"); const noblox = require("noblox.js");
const { cookies, commands } = require("../config/config.js"); const { bhopCookie, surfCookie, deathrunCookie } = require("../config/config.json");
async function execute(interaction) { async function execute(interaction) {
const game = interaction.options.getString("game"); const game = interaction.options.getString("game");
const cookie = cookies[game]; let cookie;
if (cookie === undefined) { if (game === "bhop") cookie = bhopCookie;
else if (game === "surf") cookie = surfCookie;
else if (game === "deathrun") cookie = deathrunCookie;
else {
await interaction.reply({content: "Invalid game specified!", ephemeral: true}); await interaction.reply({content: "Invalid game specified!", ephemeral: true});
return; return;
} }
@ -56,7 +59,7 @@ module.exports = {
option.setName("game") option.setName("game")
.setDescription("Select the maptest game") .setDescription("Select the maptest game")
.setRequired(true) .setRequired(true)
.addChoices(commands)) .addChoices({name: "bhop", value: "bhop"}, {name: "surf", value: "surf"}, {name: "deathrun", value: "deathrun"}))
.addIntegerOption(option => .addIntegerOption(option =>
option.setName("asset_id") option.setName("asset_id")
.setDescription("The asset ID of the model") .setDescription("The asset ID of the model")
@ -148,4 +151,4 @@ function getProductInfo (asset) {
return reject(error); return reject(error);
} }
}) })
} }

1
config/.gitignore vendored
View File

@ -1,4 +1,3 @@
* *
!config.js
!example_config.json !example_config.json
!.gitignore !.gitignore

View File

@ -1,14 +0,0 @@
const { bhopCookie, surfCookie, deathrunCookie, flytrialsCookie } = require("config.json");
const cookies = {
bhop: bhopCookie,
surf: surfCookie,
deathrun: deathrunCookie,
flytrials: flytrialsCookie,
};
const submissions = {};
const commands = [];
for (const game in cookies) {
submissions[game] = "files/" + game + "_submissions.csv";
commands.push({name: game, value: game});
}
export { cookies, submissions, commands };

View File

@ -3,6 +3,5 @@
"clientId": "", "clientId": "",
"bhopCookie": "", "bhopCookie": "",
"surfCookie": "", "surfCookie": "",
"deathrunCookie": "", "deathrunCookie": ""
"flytrialsCookie": ""
} }