Fix emote, help, and Select Image
This commit is contained in:
parent
d7597ee2b0
commit
238f44967b
3 changed files with 4 additions and 5 deletions
|
@ -6,7 +6,7 @@ class EmoteCommand extends Command {
|
||||||
const emoji = this.options.emoji ?? this.content;
|
const emoji = this.options.emoji ?? this.content;
|
||||||
if (emoji && emoji.trim() && emoji.split(" ")[0].match(/^<a?:.+:\d+>$/)) {
|
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"}`;
|
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 = [];
|
const codePoints = [];
|
||||||
for (const codePoint of emoji) {
|
for (const codePoint of emoji) {
|
||||||
codePoints.push(codePoint.codePointAt(0).toString(16));
|
codePoints.push(codePoint.codePointAt(0).toString(16));
|
||||||
|
|
|
@ -5,8 +5,7 @@ import { random } from "../../utils/misc.js";
|
||||||
import paginator from "../../utils/pagination/pagination.js";
|
import paginator from "../../utils/pagination/pagination.js";
|
||||||
import * as help from "../../utils/help.js";
|
import * as help from "../../utils/help.js";
|
||||||
import Command from "../../classes/command.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 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"];
|
||||||
const argTypes = Object.keys(Constants.ApplicationCommandOptionTypes);
|
|
||||||
|
|
||||||
class HelpCommand extends Command {
|
class HelpCommand extends Command {
|
||||||
async run() {
|
async run() {
|
||||||
|
@ -43,7 +42,7 @@ class HelpCommand extends Command {
|
||||||
const flagInfo = [];
|
const flagInfo = [];
|
||||||
for (const flag of info.flags) {
|
for (const flag of info.flags) {
|
||||||
if (flag.type === 1) continue;
|
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) {
|
if (flagInfo.length !== 0) {
|
||||||
embed.embeds[0].fields.push({
|
embed.embeds[0].fields.push({
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { selectedImages } from "../../utils/collections.js";
|
||||||
|
|
||||||
class SelectImageCommand extends Command {
|
class SelectImageCommand extends Command {
|
||||||
async run() {
|
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);
|
const image = await imageDetect(this.client, message, this.interaction, this.options, true, false, false, true);
|
||||||
this.success = false;
|
this.success = false;
|
||||||
if (image === undefined) {
|
if (image === undefined) {
|
||||||
|
|
Loading…
Reference in a new issue