Compare commits
2 Commits
f6600f3f74
...
3213bfdd91
Author | SHA1 | Date | |
---|---|---|---|
3213bfdd91 | |||
d8a0890e26 |
@ -1,15 +1,22 @@
|
|||||||
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 gameDict = {
|
||||||
|
bhop: "files/bhop_submissions.csv",
|
||||||
|
surf: "files/surf_submissions.csv",
|
||||||
|
deathrun: "files/deathrun_submissions.csv",
|
||||||
|
flytrials: "files/flytrials_submissions.csv",
|
||||||
|
};
|
||||||
|
var commandChoices = [];
|
||||||
|
for (const [game, file] of Object.entries(gameDict)) {
|
||||||
|
commandChoices.push({name: game, value: game})
|
||||||
|
}
|
||||||
|
|
||||||
async function execute(interaction) {
|
async function execute(interaction) {
|
||||||
const game = interaction.options.getString("game");
|
const game = interaction.options.getString("game");
|
||||||
|
|
||||||
let fname;
|
let fname = gameDict[game];
|
||||||
if (game === "bhop") fname = "files/bhop_submissions.csv";
|
if (fname === undefined) {
|
||||||
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;
|
||||||
}
|
}
|
||||||
@ -33,7 +40,7 @@ module.exports = {
|
|||||||
option.setName("game")
|
option.setName("game")
|
||||||
.setDescription("Select the maptest game")
|
.setDescription("Select the maptest game")
|
||||||
.setRequired(true)
|
.setRequired(true)
|
||||||
.addChoices({name: "bhop", value: "bhop"}, {name: "surf", value: "surf"}, {name: "deathrun", value: "deathrun"}))
|
.addChoices(commandChoices))
|
||||||
,
|
,
|
||||||
execute
|
execute
|
||||||
};
|
};
|
@ -3,6 +3,16 @@ 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 gameDict = {
|
||||||
|
bhop: "files/bhop_submissions.csv",
|
||||||
|
surf: "files/surf_submissions.csv",
|
||||||
|
deathrun: "files/deathrun_submissions.csv",
|
||||||
|
flytrials: "files/flytrials_submissions.csv",
|
||||||
|
};
|
||||||
|
var commandChoices = [];
|
||||||
|
for (const [game, file] of Object.entries(gameDict)) {
|
||||||
|
commandChoices.push({name: game, value: game})
|
||||||
|
}
|
||||||
|
|
||||||
async function robloxUserFromDiscord(id) {
|
async function robloxUserFromDiscord(id) {
|
||||||
if (isNaN(id)) return undefined;
|
if (isNaN(id)) return undefined;
|
||||||
@ -33,11 +43,8 @@ async function execute(interaction) {
|
|||||||
}
|
}
|
||||||
const game = interaction.options.getString("game");
|
const game = interaction.options.getString("game");
|
||||||
|
|
||||||
let fname;
|
let fname = gameDict[game];
|
||||||
if (game === "bhop") fname = "files/bhop_submissions.csv";
|
if (fname === undefined) {
|
||||||
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;
|
||||||
}
|
}
|
||||||
@ -97,7 +104,7 @@ module.exports = {
|
|||||||
option.setName("game")
|
option.setName("game")
|
||||||
.setDescription("Select the maptest game")
|
.setDescription("Select the maptest game")
|
||||||
.setRequired(true)
|
.setRequired(true)
|
||||||
.addChoices({name: "bhop", value: "bhop"}, {name: "surf", value: "surf"}, {name: "deathrun", value: "deathrun"}))
|
.addChoices(commandChoices))
|
||||||
.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")
|
||||||
|
@ -1,14 +1,21 @@
|
|||||||
const { SlashCommandBuilder } = require('@discordjs/builders');
|
const { SlashCommandBuilder } = require('@discordjs/builders');
|
||||||
const noblox = require("noblox.js");
|
const noblox = require("noblox.js");
|
||||||
const { bhopCookie, surfCookie, deathrunCookie } = require("../config/config.json");
|
const { bhopCookie, surfCookie, deathrunCookie, flytrialsCookie } = require("../config/config.json");
|
||||||
|
const cookieDict = {
|
||||||
|
bhop: bhopCookie,
|
||||||
|
surf: surfCookie,
|
||||||
|
deathrun: deathrunCookie,
|
||||||
|
flytrials: flytrialsCookie,
|
||||||
|
};
|
||||||
|
var commandChoices = [];
|
||||||
|
for (const [game, file] of Object.entries(gameDict)) {
|
||||||
|
commandChoices.push({name: game, value: game})
|
||||||
|
}
|
||||||
|
|
||||||
async function execute(interaction) {
|
async function execute(interaction) {
|
||||||
const game = interaction.options.getString("game");
|
const game = interaction.options.getString("game");
|
||||||
let cookie;
|
let cookie = cookieDict[game];
|
||||||
if (game === "bhop") cookie = bhopCookie;
|
if (cookie === undefined) {
|
||||||
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;
|
||||||
}
|
}
|
||||||
@ -59,7 +66,7 @@ module.exports = {
|
|||||||
option.setName("game")
|
option.setName("game")
|
||||||
.setDescription("Select the maptest game")
|
.setDescription("Select the maptest game")
|
||||||
.setRequired(true)
|
.setRequired(true)
|
||||||
.addChoices({name: "bhop", value: "bhop"}, {name: "surf", value: "surf"}, {name: "deathrun", value: "deathrun"}))
|
.addChoices(commandChoices))
|
||||||
.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")
|
||||||
|
@ -3,5 +3,6 @@
|
|||||||
"clientId": "",
|
"clientId": "",
|
||||||
"bhopCookie": "",
|
"bhopCookie": "",
|
||||||
"surfCookie": "",
|
"surfCookie": "",
|
||||||
"deathrunCookie": ""
|
"deathrunCookie": "",
|
||||||
|
"flytrialsCookie": ""
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user