Improve error messages a bit for new API

This commit is contained in:
2024-08-26 21:38:17 -05:00
parent 4e73ce1330
commit b3fdd8e2f1
3 changed files with 14 additions and 11 deletions

@ -53,7 +53,7 @@ async function execute(interaction) {
try {
// Check that the bot owns this model
if (!(await noblox.getOwnership(await noblox.getCurrentUser("UserID"), id, "Asset"))) {
const msg = `🚫 The ${game} maptest bot's inventory does not contain this asset (\`${id}\`). You must use the /take command first.`;
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;
}
@ -61,13 +61,13 @@ async function execute(interaction) {
if (error.message !== "400 The specified Asset does not exist!") {
throw error;
}
await interaction.editReply(`🚫 This asset does not exist (\`${id}\`).`);
await interaction.editReply(`🚫 This asset does not exist (id: \`${id}\`).`);
return;
}
const assetInfo = await getAssetInfo(id);
if (!assetInfo.isModel) {
await interaction.editReply(`🚫 This asset (\`${id}\`) is not a model. Your map must be a model.`);
await interaction.editReply(`🚫 This asset (id: \`${id}\`) is not a model. Your map must be a model.`);
return;
}
@ -87,7 +87,7 @@ async function execute(interaction) {
for (let lineStr of lines) {
const line = getSubmissionLine(lineStr);
if (id === line.modelId) {
await interaction.editReply(`🚫 This map (id: ${id}) was already submitted on <t:${line.timestamp}:d>.`);
await interaction.editReply(`🚫 This map (id: \`${id}\`) was already submitted on <t:${line.timestamp}:d>.`);
return;
}
}
@ -112,7 +112,7 @@ async function execute(interaction) {
csvString += createSubmissionLine(id, unixTimestamp, userId, await robloxUsernameFromId(userId), validation.displayName, validation.creator);
fs.writeFileSync(fname, csvString);
await interaction.followUp(`Map (id: ${id}) successfully submitted.`);
await interaction.followUp(`Map (id: \`${id}\`) successfully submitted.`);
}
module.exports = {