Compare commits

...

2 Commits

Author SHA1 Message Date
09836797c2 Merge pull request 'update discord to roblox api' (#2) from feature/fix-verify into master
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone Build is passing
Reviewed-on: #2
2022-11-15 22:13:40 -05:00
bc9fe79efc update discord to roblox api 2022-11-15 22:12:58 -05:00

View File

@ -2,13 +2,13 @@ const { SlashCommandBuilder } = require('@discordjs/builders');
const { parse } = require("csv-parse/sync"); 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;
async function robloxUserFromDiscord(id) { async function robloxUserFromDiscord(id) {
if (isNaN(id)) return undefined; if (isNaN(id)) return undefined;
try { try {
const res = await axios.get(`https://verify.eryn.io/api/user/${id}`) const res = await axios.get(`https://api.fiveman1.net/v1/users/${id}`);
return res.data.robloxId return res.data.result.robloxId;
} catch (error) { } catch (error) {
return undefined; return undefined;
} }
@ -17,17 +17,17 @@ async function robloxUserFromDiscord(id) {
async function robloxUsernameFromId(id) { async function robloxUsernameFromId(id) {
if (isNaN(id)) return undefined; if (isNaN(id)) return undefined;
try { try {
const res = await axios.get(`https://users.roblox.com/v1/users/${id}`) const res = await axios.get(`https://users.roblox.com/v1/users/${id}`);
return res.data.name return res.data.name;
} catch (error) { } catch (error) {
return undefined; return undefined;
} }
} }
async function execute(interaction) { async function execute(interaction) {
const userId = await robloxUserFromDiscord(interaction.user.id) const userId = await robloxUserFromDiscord(interaction.user.id);
if (!userId) { if (!userId) {
const msg = "You don't have a Roblox account linked with your Discord account. Visit https://verify.eryn.io/"; const msg = "You don't have a Roblox account linked with your Discord account. Use !link with rbhop dog to link your account.";
await interaction.reply({content: msg, ephemeral: true}); await interaction.reply({content: msg, ephemeral: true});
return; return;
} }