Use alternate API for current user and skip cookie validation
This commit is contained in:
@ -4,7 +4,7 @@ const fs = require('node:fs');
|
||||
const noblox = require("noblox.js");
|
||||
const axios = require("axios").default;
|
||||
const { submissions, commands, cookies } = require("../config/config.js");
|
||||
const { getAssetInfo, SubmissionColumnsString, createSubmissionLine, getSubmissionLine, validateMapAsset, getValidationMessage } = require("../common.js");
|
||||
const { getAssetInfo, getCurrentUser, SubmissionColumnsString, createSubmissionLine, getSubmissionLine, validateMapAsset, getValidationMessage } = require("../common.js");
|
||||
|
||||
async function robloxUserFromDiscord(id) {
|
||||
if (isNaN(id)) return undefined;
|
||||
@ -48,11 +48,11 @@ async function execute(interaction) {
|
||||
}
|
||||
|
||||
const id = interaction.options.getInteger("asset_id", true);
|
||||
await noblox.setCookie(cookies[game]);
|
||||
noblox.setCookie(cookies[game], false);
|
||||
|
||||
try {
|
||||
// Check that the bot owns this model
|
||||
if (!(await noblox.getOwnership(await noblox.getCurrentUser("UserID"), id, "Asset"))) {
|
||||
if (!(await noblox.getOwnership(await getCurrentUser(), id, "Asset"))) {
|
||||
const msg = `🚫 The ${game} maptest bot's inventory does not contain this asset (id: \`${id}\`). You must use the /take command first.`;
|
||||
await interaction.editReply(msg);
|
||||
return;
|
||||
|
Reference in New Issue
Block a user