Fix emote, help, and Select Image

This commit is contained in:
Essem 2022-09-24 12:58:59 -05:00
parent d7597ee2b0
commit 238f44967b
No known key found for this signature in database
GPG key ID: 7D497397CC3A2A8C
3 changed files with 4 additions and 5 deletions

View file

@ -6,7 +6,7 @@ class EmoteCommand extends Command {
const emoji = this.options.emoji ?? this.content;
if (emoji && emoji.trim() && emoji.split(" ")[0].match(/^<a?:.+:\d+>$/)) {
return `https://cdn.discordapp.com/emojis/${emoji.split(" ")[0].replace(/^<(a)?:.+:(\d+)>$/, "$2")}.${emoji.split(" ")[0].replace(/^<(a)?:.+:(\d+)>$/, "$1") === "a" ? "gif" : "png"}`;
} else if (emoji.match(emojiRegex)) {
} else if (emoji.match(emojiRegex())) {
const codePoints = [];
for (const codePoint of emoji) {
codePoints.push(codePoint.codePointAt(0).toString(16));

View file

@ -5,8 +5,7 @@ import { random } from "../../utils/misc.js";
import paginator from "../../utils/pagination/pagination.js";
import * as help from "../../utils/help.js";
import Command from "../../classes/command.js";
const tips = ["You can change the bot's prefix using the prefix command.", "Image commands also work with images previously posted in that channel.", "You can use the tags commands to save things for later use.", "You can visit https://projectlounge.pw/esmBot/help.html for a web version of this command list.", "You can view a command's aliases by putting the command name after the help command (e.g. help image).", "Parameters wrapped in [] are required, while parameters wrapped in {} are optional.", "esmBot is hosted and paid for completely out-of-pocket by the main developer. If you want to support development, please consider donating! https://patreon.com/TheEssem", "You can run commands in DMs as well, just message the bot with your command - no prefix needed!"];
const argTypes = Object.keys(Constants.ApplicationCommandOptionTypes);
const tips = ["You can change the bot's prefix using the prefix command.", "Image commands also work with images previously posted in that channel.", "You can use the tags commands to save things for later use.", "You can visit https://projectlounge.pw/esmBot/help.html for a web version of this command list.", "You can view a command's aliases by putting the command name after the help command (e.g. help image).", "Parameters wrapped in [] are required, while parameters wrapped in {} are optional.", "esmBot is hosted and paid for completely out-of-pocket by the main developer. If you want to support development, please consider donating! https://patreon.com/TheEssem"];
class HelpCommand extends Command {
async run() {
@ -43,7 +42,7 @@ class HelpCommand extends Command {
const flagInfo = [];
for (const flag of info.flags) {
if (flag.type === 1) continue;
flagInfo.push(`\`--${flag.name}${flag.type ? `=[${argTypes[flag.type - 1]}]` : ""}\` - ${flag.description}`);
flagInfo.push(`\`--${flag.name}${flag.type ? `=[${Constants.ApplicationCommandOptionTypes[flag.type]}]` : ""}\` - ${flag.description}`);
}
if (flagInfo.length !== 0) {
embed.embeds[0].fields.push({

View file

@ -4,7 +4,7 @@ import { selectedImages } from "../../utils/collections.js";
class SelectImageCommand extends Command {
async run() {
const message = this.interaction.data.resolved.messages.get(this.interaction.data.target_id);
const message = this.interaction.data.target;
const image = await imageDetect(this.client, message, this.interaction, this.options, true, false, false, true);
this.success = false;
if (image === undefined) {