Compare commits
No commits in common. "444e8d78aa2f51a3555af6095bd2db7bfdad93e8" and "a2759ae0e4136326686e390d4ebaa8a4d5266ffa" have entirely different histories.
444e8d78aa
...
a2759ae0e4
@ -2,7 +2,7 @@
|
||||
|
||||
to setup (requires node.js):
|
||||
|
||||
* (in the config folder) create a copy of example_config.json named config.json
|
||||
* create a copy of example_config.json named config.json
|
||||
* fill out empty values with correct values in config.json (token is discord token, cookie is .ROBLOSECURITY cookie, clientId is the bot's ID (right click bot in discord then choose copy ID with developer mode enabled))
|
||||
* install dependencies
|
||||
```
|
||||
|
@ -2,34 +2,8 @@ const { SlashCommandBuilder } = require('@discordjs/builders');
|
||||
const { parse } = require("csv-parse/sync");
|
||||
const fs = require('node:fs');
|
||||
const noblox = require("noblox.js");
|
||||
const axios = require("axios").default
|
||||
|
||||
async function robloxUserFromDiscord(id) {
|
||||
if (isNaN(id)) return undefined;
|
||||
try {
|
||||
const res = await axios.get(`https://verify.eryn.io/api/user/${id}`)
|
||||
return res.data.robloxId
|
||||
} catch (error) {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
async function robloxUsernameFromId(id) {
|
||||
if (isNaN(id)) return undefined;
|
||||
try {
|
||||
const res = await axios.get(`https://users.roblox.com/v1/users/${id}`)
|
||||
return res.data.name
|
||||
} catch (error) {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
async function execute(interaction) {
|
||||
const userId = await robloxUserFromDiscord(interaction.user.id)
|
||||
if (!userId) {
|
||||
const msg = "You don't have a Roblox account linked with your Discord account. Visit https://verify.eryn.io/";
|
||||
await interaction.reply({content: msg, ephemeral: true});
|
||||
}
|
||||
const game = interaction.options.getString("game");
|
||||
|
||||
let fname;
|
||||
@ -52,13 +26,6 @@ async function execute(interaction) {
|
||||
await interaction.reply({content: `(id: ${id}) is not a valid model ID.`, ephemeral: true});
|
||||
return;
|
||||
}
|
||||
if (info.Creator.Id != userId) {
|
||||
const assetUsername = await robloxUsernameFromId(info.Creator.Id);
|
||||
const interactionUsername = await robloxUsernameFromId(userId);
|
||||
const msg = `The account linked to your Discord (${interactionUsername}) is not the owner of this model (${assetUsername}), so you cannot submit it.`
|
||||
await interaction.reply({content: msg, ephemeral: true});
|
||||
return
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
await interaction.reply({content: `There is a problem with this asset ID (id: ${id}).`, ephemeral: true});
|
||||
|
3
config/.gitignore
vendored
3
config/.gitignore
vendored
@ -1,3 +0,0 @@
|
||||
*
|
||||
!example_config.json
|
||||
!.gitignore
|
@ -2,7 +2,6 @@
|
||||
"dependencies": {
|
||||
"@discordjs/builders": "^0.13.0",
|
||||
"@discordjs/rest": "^0.4.1",
|
||||
"axios": "^0.27.2",
|
||||
"csv-parse": "^5.0.4",
|
||||
"discord-api-types": "^0.32.1",
|
||||
"discord.js": "^13.6.0",
|
||||
|
Loading…
Reference in New Issue
Block a user