Added (hacky) message command support, lots of work to prepare for message content intent enforcement, improve broadcast, remove evalraw, update packages

This commit is contained in:
Essem 2022-08-31 20:00:34 -05:00
parent 3392c3c89e
commit d33a7804d7
No known key found for this signature in database
GPG key ID: 7D497397CC3A2A8C
56 changed files with 443 additions and 315 deletions

View file

@ -0,0 +1,23 @@
import Command from "../../classes/command.js";
import imageDetect from "../../utils/imagedetect.js";
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 image = await imageDetect(this.client, message, this.interaction, this.options, true, false, false, true);
this.success = false;
if (image === undefined) {
return "I couldn't find an image in that message!";
} else if (image.type === "large") {
return "That image is too large (>= 25MB)! Try using a smaller image.";
} else if (image.type === "tenorlimit") {
return "I've been rate-limited by Tenor. Please try uploading your GIF elsewhere.";
}
selectedImages.set(this.author.id, image);
this.success = true;
return "The image has been selected for your next command.";
}
}
export default SelectImageCommand;