Fixed pagination and typing in DMs
This commit is contained in:
parent
a75c55a1ca
commit
e3fca9f4e9
6 changed files with 6 additions and 6 deletions
|
@ -9,7 +9,7 @@ class ImageSearchCommand extends Command {
|
||||||
if (this.message.channel.guild && !this.message.channel.permissionsOf(this.client.user.id).has("addReactions")) return "I don't have the `Add Reactions` permission!";
|
if (this.message.channel.guild && !this.message.channel.permissionsOf(this.client.user.id).has("addReactions")) return "I don't have the `Add Reactions` permission!";
|
||||||
if (this.message.channel.guild && !this.message.channel.permissionsOf(this.client.user.id).has("embedLinks")) return "I don't have the `Embed Links` permission!";
|
if (this.message.channel.guild && !this.message.channel.permissionsOf(this.client.user.id).has("embedLinks")) return "I don't have the `Embed Links` permission!";
|
||||||
if (this.args.length === 0) return "You need to provide something to search for!";
|
if (this.args.length === 0) return "You need to provide something to search for!";
|
||||||
await this.message.channel.sendTyping();
|
this.client.sendChannelTyping(this.message.channel.id);
|
||||||
const embeds = [];
|
const embeds = [];
|
||||||
const rawImages = await fetch(`${random(searx)}/search?format=json&safesearch=2&categories=images&q=!goi%20!bii%20!ddi%20${encodeURIComponent(this.args.join(" "))}`).then(res => res.json());
|
const rawImages = await fetch(`${random(searx)}/search?format=json&safesearch=2&categories=images&q=!goi%20!bii%20!ddi%20${encodeURIComponent(this.args.join(" "))}`).then(res => res.json());
|
||||||
if (rawImages.results.length === 0) return "I couldn't find any results!";
|
if (rawImages.results.length === 0) return "I couldn't find any results!";
|
||||||
|
|
|
@ -2,7 +2,7 @@ const Command = require("../../classes/command.js");
|
||||||
|
|
||||||
class ImageStatsCommand extends Command {
|
class ImageStatsCommand extends Command {
|
||||||
async run() {
|
async run() {
|
||||||
await this.message.channel.sendTyping();
|
await this.client.sendChannelTyping(this.message.channel.id);
|
||||||
const servers = await this.ipc.command("image", { type: "stats" }, true);
|
const servers = await this.ipc.command("image", { type: "stats" }, true);
|
||||||
const embed = {
|
const embed = {
|
||||||
embed: {
|
embed: {
|
||||||
|
|
|
@ -3,7 +3,7 @@ const imageDetect = require("../../utils/imagedetect.js");
|
||||||
|
|
||||||
class RawCommand extends Command {
|
class RawCommand extends Command {
|
||||||
async run() {
|
async run() {
|
||||||
this.message.channel.sendTyping();
|
this.client.sendChannelTyping(this.message.channel.id);
|
||||||
const image = await imageDetect(this.client, this.message);
|
const image = await imageDetect(this.client, this.message);
|
||||||
if (image === undefined) return "You need to provide an image to get a raw URL!";
|
if (image === undefined) return "You need to provide an image to get a raw URL!";
|
||||||
return image.path;
|
return image.path;
|
||||||
|
|
|
@ -5,7 +5,7 @@ class SoundReloadCommand extends Command {
|
||||||
run() {
|
run() {
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
if (this.message.author.id !== process.env.OWNER) return "Only the bot owner can reload Lavalink!";
|
if (this.message.author.id !== process.env.OWNER) return "Only the bot owner can reload Lavalink!";
|
||||||
this.message.channel.sendTyping();
|
this.client.sendChannelTyping(this.message.channel.id);
|
||||||
this.ipc.broadcast("soundreload");
|
this.ipc.broadcast("soundreload");
|
||||||
this.ipc.register("soundReloadSuccess", (msg) => {
|
this.ipc.register("soundReloadSuccess", (msg) => {
|
||||||
this.ipc.unregister("soundReloadSuccess");
|
this.ipc.unregister("soundReloadSuccess");
|
||||||
|
|
|
@ -10,7 +10,7 @@ class InteractionCollector extends EventEmitter {
|
||||||
this.bot = client;
|
this.bot = client;
|
||||||
this.listener = async (packet) => {
|
this.listener = async (packet) => {
|
||||||
if (packet.t !== "INTERACTION_CREATE") return;
|
if (packet.t !== "INTERACTION_CREATE") return;
|
||||||
await this.verify(packet.d.message, packet.d.data.custom_id, packet.d.id, packet.d.token, packet.d.member);
|
await this.verify(packet.d.message, packet.d.data.custom_id, packet.d.id, packet.d.token, packet.d.member ? packet.d.member.id : packet.d.user.id);
|
||||||
};
|
};
|
||||||
this.bot.on("rawWS", this.listener);
|
this.bot.on("rawWS", this.listener);
|
||||||
if (options.time) setTimeout(() => this.stop("time"), options.time);
|
if (options.time) setTimeout(() => this.stop("time"), options.time);
|
||||||
|
|
|
@ -74,7 +74,7 @@ module.exports = async (client, message, pages, timeout = 120000) => {
|
||||||
if (pages.length > 1) {
|
if (pages.length > 1) {
|
||||||
const interactionCollector = new InteractionCollector(client, currentPage, { time: timeout });
|
const interactionCollector = new InteractionCollector(client, currentPage, { time: timeout });
|
||||||
interactionCollector.on("interaction", async (msg, interaction, id, token, member) => {
|
interactionCollector.on("interaction", async (msg, interaction, id, token, member) => {
|
||||||
if (member.user.id === message.author.id) {
|
if (member === message.author.id) {
|
||||||
switch (interaction) {
|
switch (interaction) {
|
||||||
case "back":
|
case "back":
|
||||||
await fetch(`https://discord.com/api/v8/interactions/${id}/${token}/callback`, ackOptions);
|
await fetch(`https://discord.com/api/v8/interactions/${id}/${token}/callback`, ackOptions);
|
||||||
|
|
Loading…
Reference in a new issue