Compare commits
2 Commits
ace8e05b67
...
770118d937
Author | SHA1 | Date | |
---|---|---|---|
770118d937 | |||
bfa33ddcc2 |
@ -1,15 +1,13 @@
|
||||
const { SlashCommandBuilder } = require('@discordjs/builders');
|
||||
const { MessageAttachment } = require("discord.js");
|
||||
const fs = require('node:fs');
|
||||
const { submissions, commands } = require("../config/config.js")
|
||||
|
||||
async function execute(interaction) {
|
||||
const game = interaction.options.getString("game");
|
||||
|
||||
let fname;
|
||||
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 {
|
||||
const fname = submissions[game];
|
||||
if (fname === undefined) {
|
||||
await interaction.reply({content: "Invalid game specified!", ephemeral: true});
|
||||
return;
|
||||
}
|
||||
@ -33,7 +31,7 @@ module.exports = {
|
||||
option.setName("game")
|
||||
.setDescription("Select the maptest game")
|
||||
.setRequired(true)
|
||||
.addChoices({name: "bhop", value: "bhop"}, {name: "surf", value: "surf"}, {name: "deathrun", value: "deathrun"}))
|
||||
.addChoices(commands))
|
||||
,
|
||||
execute
|
||||
};
|
@ -3,6 +3,7 @@ const { parse } = require("csv-parse/sync");
|
||||
const fs = require('node:fs');
|
||||
const noblox = require("noblox.js");
|
||||
const axios = require("axios").default;
|
||||
const { submissions, commands } = require("../config/config.js")
|
||||
|
||||
async function robloxUserFromDiscord(id) {
|
||||
if (isNaN(id)) return undefined;
|
||||
@ -33,11 +34,8 @@ async function execute(interaction) {
|
||||
}
|
||||
const game = interaction.options.getString("game");
|
||||
|
||||
let fname;
|
||||
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 {
|
||||
const fname = submissions[game];
|
||||
if (fname === undefined) {
|
||||
await interaction.reply({content: "Invalid game specified!", ephemeral: true});
|
||||
return;
|
||||
}
|
||||
@ -97,7 +95,7 @@ module.exports = {
|
||||
option.setName("game")
|
||||
.setDescription("Select the maptest game")
|
||||
.setRequired(true)
|
||||
.addChoices({name: "bhop", value: "bhop"}, {name: "surf", value: "surf"}, {name: "deathrun", value: "deathrun"}))
|
||||
.addChoices(commands))
|
||||
.addIntegerOption(option =>
|
||||
option.setName("asset_id")
|
||||
.setDescription("The asset ID of the model")
|
||||
|
@ -1,14 +1,11 @@
|
||||
const { SlashCommandBuilder } = require('@discordjs/builders');
|
||||
const noblox = require("noblox.js");
|
||||
const { bhopCookie, surfCookie, deathrunCookie } = require("../config/config.json");
|
||||
const { cookies, commands } = require("../config/config.js")
|
||||
|
||||
async function execute(interaction) {
|
||||
const game = interaction.options.getString("game");
|
||||
let cookie;
|
||||
if (game === "bhop") cookie = bhopCookie;
|
||||
else if (game === "surf") cookie = surfCookie;
|
||||
else if (game === "deathrun") cookie = deathrunCookie;
|
||||
else {
|
||||
const cookie = cookies[game];
|
||||
if (cookie === undefined) {
|
||||
await interaction.reply({content: "Invalid game specified!", ephemeral: true});
|
||||
return;
|
||||
}
|
||||
@ -59,7 +56,7 @@ module.exports = {
|
||||
option.setName("game")
|
||||
.setDescription("Select the maptest game")
|
||||
.setRequired(true)
|
||||
.addChoices({name: "bhop", value: "bhop"}, {name: "surf", value: "surf"}, {name: "deathrun", value: "deathrun"}))
|
||||
.addChoices(commands))
|
||||
.addIntegerOption(option =>
|
||||
option.setName("asset_id")
|
||||
.setDescription("The asset ID of the model")
|
||||
|
1
config/.gitignore
vendored
1
config/.gitignore
vendored
@ -1,3 +1,4 @@
|
||||
*
|
||||
!config.js
|
||||
!example_config.json
|
||||
!.gitignore
|
18
config/config.js
Normal file
18
config/config.js
Normal file
@ -0,0 +1,18 @@
|
||||
const { bhopCookie, surfCookie, deathrunCookie, flytrialsCookie } = require("config.json");
|
||||
const cookies = {
|
||||
bhop: bhopCookie,
|
||||
surf: surfCookie,
|
||||
deathrun: deathrunCookie,
|
||||
flytrials: flytrialsCookie,
|
||||
};
|
||||
const submissions = {
|
||||
bhop: "files/bhop_submissions.csv",
|
||||
surf: "files/surf_submissions.csv",
|
||||
deathrun: "files/deathrun_submissions.csv",
|
||||
flytrials: "files/flytrials_submissions.csv",
|
||||
};
|
||||
const commands = [];
|
||||
for (const game of Object.keys(submissions)) {
|
||||
commands.push({name: game, value: game})
|
||||
}
|
||||
export { submissions, cookies, commands }
|
@ -3,5 +3,6 @@
|
||||
"clientId": "",
|
||||
"bhopCookie": "",
|
||||
"surfCookie": "",
|
||||
"deathrunCookie": ""
|
||||
"deathrunCookie": "",
|
||||
"flytrialsCookie": ""
|
||||
}
|
Loading…
Reference in New Issue
Block a user