Fixed flag returning an error on a nonexistent flag
This commit is contained in:
parent
108afc3626
commit
11ab4ad1d4
2 changed files with 4 additions and 4 deletions
|
@ -33,7 +33,7 @@ class ImageCommand extends Command {
|
|||
]
|
||||
};*/
|
||||
|
||||
criteria() {
|
||||
async criteria() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,7 @@ class ImageCommand extends Command {
|
|||
}
|
||||
|
||||
if (this.constructor.requiresText) {
|
||||
if (this.args.length === 0 || !this.criteria(this.args)) {
|
||||
if (this.args.length === 0 || !await this.criteria(this.args)) {
|
||||
collections.runningCommands.delete(this.message.author.id);
|
||||
return `${this.message.author.mention}, ${this.constructor.noText}`;
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ const ImageCommand = require("../../classes/imageCommand.js");
|
|||
class FlagCommand extends ImageCommand {
|
||||
flagPath = "";
|
||||
|
||||
criteria(args) {
|
||||
async criteria(args) {
|
||||
if (!args[0].match(emojiRegex)) return false;
|
||||
const flag = emoji.unemojify(args[0]).replaceAll(":", "").replace("flag-", "");
|
||||
let path = `./assets/images/region-flags/png/${flag.toUpperCase()}.png`;
|
||||
|
@ -15,7 +15,7 @@ class FlagCommand extends ImageCommand {
|
|||
if (flag === "checkered_flag") path = "./assets/images/checkeredflag.png";
|
||||
if (flag === "🏳️⚧️") path = "./assets/images/transflag.png";
|
||||
try {
|
||||
fs.promises.access(path);
|
||||
await fs.promises.access(path);
|
||||
this.flagPath = path;
|
||||
return true;
|
||||
} catch {
|
||||
|
|
Loading…
Reference in a new issue