This commit is contained in:
@ -5,8 +5,9 @@ exports.description =
|
||||
exports.usage =
|
||||
"CLIENT_PREFIX:estimate [summary of item you want the price of]";
|
||||
exports.example =
|
||||
"CLIENT_PREFIX:estimate 1600 ab2\nCLIENT_PREFIX:estimate 1100 thp\nCLIENT_PREFIX:estimate 2400 app builder staff\n(you can also include `showtable` anywhere to show raw price data)\n(always put number first, do not put conflicting data to avoid confusion)";
|
||||
"CLIENT_PREFIX:estimate 1600 ab2\nCLIENT_PREFIX:estimate 1100 thp\nCLIENT_PREFIX:estimate 2400 app builder staff\nCLIENT_PREFIX:estimate 2200 app builder piece\nCLIENT_PREFIX:estimate 2200 app armor\n(you can also include `showtable` anywhere to show raw price data)\n(always put number first, do not put conflicting data to avoid confusion)";
|
||||
exports.hidden = false;
|
||||
exports.isAlias = false;
|
||||
exports.run = async (client, message, args) => {
|
||||
if (!args[0]) {
|
||||
return fetch(client.sharedEndpoint + "estimate" + "?getPriceTable=true")
|
||||
@ -22,6 +23,11 @@ exports.run = async (client, message, args) => {
|
||||
}
|
||||
const combined = args.join(" ");
|
||||
let showtable = combined.includes("showtable");
|
||||
if (combined.startsWith("help")) {
|
||||
require("./help").run(client, message, ["estimate"]);
|
||||
return;
|
||||
}
|
||||
|
||||
fetch(
|
||||
client.sharedEndpoint +
|
||||
"estimate" +
|
||||
@ -31,7 +37,17 @@ exports.run = async (client, message, args) => {
|
||||
.then((d) => d.json())
|
||||
.then((data) => {
|
||||
if (data.error) {
|
||||
return message.channel.send(data.error);
|
||||
if (data.error == "entry-not-found")
|
||||
return message.channel.send(
|
||||
"Your query couldn't be matched with anything, please refine your query or reffer to `CLIENT_PREFIX:help estimate`. You can also use `CLIENT_PREFIX:estimate` to see all available price tables for more information.".replaceAll(
|
||||
"CLIENT_PREFIX:",
|
||||
client.prefix
|
||||
)
|
||||
);
|
||||
if (data.error == "")
|
||||
return message.channel.send(
|
||||
"API query is somehow empty, but did not error for `entry-not-found`, please contact shiro."
|
||||
);
|
||||
} else {
|
||||
if (showtable) {
|
||||
const { returnKeyWord, subtable } = data;
|
||||
|
Reference in New Issue
Block a user