Compare commits
2 Commits
8fa05099be
...
5681e21fbe
Author | SHA1 | Date | |
---|---|---|---|
5681e21fbe | |||
0853602afb |
@ -1,12 +1,21 @@
|
|||||||
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")
|
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");
|
||||||
|
|
||||||
const fname = submissions[game];
|
let fname = gameDict[game];
|
||||||
if (fname === undefined) {
|
if (fname === undefined) {
|
||||||
await interaction.reply({content: "Invalid game specified!", ephemeral: true});
|
await interaction.reply({content: "Invalid game specified!", ephemeral: true});
|
||||||
return;
|
return;
|
||||||
@ -31,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(commands))
|
.addChoices(commandChoices))
|
||||||
,
|
,
|
||||||
execute
|
execute
|
||||||
};
|
};
|
@ -3,7 +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 { submissions, commands } = require("../config/config.js")
|
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;
|
||||||
@ -34,7 +43,7 @@ async function execute(interaction) {
|
|||||||
}
|
}
|
||||||
const game = interaction.options.getString("game");
|
const game = interaction.options.getString("game");
|
||||||
|
|
||||||
const fname = submissions[game];
|
let fname = gameDict[game];
|
||||||
if (fname === undefined) {
|
if (fname === undefined) {
|
||||||
await interaction.reply({content: "Invalid game specified!", ephemeral: true});
|
await interaction.reply({content: "Invalid game specified!", ephemeral: true});
|
||||||
return;
|
return;
|
||||||
@ -95,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(commands))
|
.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,10 +1,20 @@
|
|||||||
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, flytrialsCookie } = require("../config/config.json");
|
||||||
|
const cookieDict = {
|
||||||
|
bhop: bhopCookie,
|
||||||
|
surf: surfCookie,
|
||||||
|
deathrun: deathrunCookie,
|
||||||
|
flytrials: flytrialsCookie,
|
||||||
|
};
|
||||||
|
var commandChoices = [];
|
||||||
|
for (const [game, file] of Object.entries(cookieDict)) {
|
||||||
|
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");
|
||||||
const cookie = cookies[game];
|
let cookie = cookieDict[game];
|
||||||
if (cookie === undefined) {
|
if (cookie === undefined) {
|
||||||
await interaction.reply({content: "Invalid game specified!", ephemeral: true});
|
await interaction.reply({content: "Invalid game specified!", ephemeral: true});
|
||||||
return;
|
return;
|
||||||
@ -56,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(commands))
|
.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
config/.gitignore
vendored
1
config/.gitignore
vendored
@ -1,4 +1,3 @@
|
|||||||
*
|
*
|
||||||
!config.js
|
|
||||||
!example_config.json
|
!example_config.json
|
||||||
!.gitignore
|
!.gitignore
|
@ -1,18 +0,0 @@
|
|||||||
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": "",
|
"clientId": "",
|
||||||
"bhopCookie": "",
|
"bhopCookie": "",
|
||||||
"surfCookie": "",
|
"surfCookie": "",
|
||||||
"deathrunCookie": ""
|
"deathrunCookie": "",
|
||||||
|
"flytrialsCookie": ""
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user