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("embedLinks")) return "I don't have the `Embed Links` permission!";
 | 
			
		||||
    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 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!";
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,7 +2,7 @@ const Command = require("../../classes/command.js");
 | 
			
		|||
 | 
			
		||||
class ImageStatsCommand extends Command {
 | 
			
		||||
  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 embed = {
 | 
			
		||||
      embed: {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,7 @@ const imageDetect = require("../../utils/imagedetect.js");
 | 
			
		|||
 | 
			
		||||
class RawCommand extends Command {
 | 
			
		||||
  async run() {
 | 
			
		||||
    this.message.channel.sendTyping();
 | 
			
		||||
    this.client.sendChannelTyping(this.message.channel.id);
 | 
			
		||||
    const image = await imageDetect(this.client, this.message);
 | 
			
		||||
    if (image === undefined) return "You need to provide an image to get a raw URL!";
 | 
			
		||||
    return image.path;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5,7 +5,7 @@ class SoundReloadCommand extends Command {
 | 
			
		|||
  run() {
 | 
			
		||||
    return new Promise((resolve) => {
 | 
			
		||||
      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.register("soundReloadSuccess", (msg) => {
 | 
			
		||||
        this.ipc.unregister("soundReloadSuccess");
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -10,7 +10,7 @@ class InteractionCollector extends EventEmitter {
 | 
			
		|||
    this.bot = client;
 | 
			
		||||
    this.listener = async (packet) => {
 | 
			
		||||
      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);
 | 
			
		||||
    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) {
 | 
			
		||||
    const interactionCollector = new InteractionCollector(client, currentPage, { time: timeout });
 | 
			
		||||
    interactionCollector.on("interaction", async (msg, interaction, id, token, member) => {
 | 
			
		||||
      if (member.user.id === message.author.id) {
 | 
			
		||||
      if (member === message.author.id) {
 | 
			
		||||
        switch (interaction) {
 | 
			
		||||
          case "back":
 | 
			
		||||
            await fetch(`https://discord.com/api/v8/interactions/${id}/${token}/callback`, ackOptions);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue