Don't rely on lavacord eris helper package, another pagination fix attempt, make cowsay use a different lib
This commit is contained in:
		
							parent
							
								
									45bb53d521
								
							
						
					
					
						commit
						2499fb2a3b
					
				
					 7 changed files with 4705 additions and 671 deletions
				
			
		| 
						 | 
					@ -1,65 +1,16 @@
 | 
				
			||||||
const cowsay = require("cowsay");
 | 
					const cowsay = require("cowsay2");
 | 
				
			||||||
const cowList = ["beavis.zen",
 | 
					const cows = require("cowsay2/cows");
 | 
				
			||||||
  "bong",
 | 
					 | 
				
			||||||
  "bud-frogs",
 | 
					 | 
				
			||||||
  "bunny",
 | 
					 | 
				
			||||||
  "cheese",
 | 
					 | 
				
			||||||
  "cower",
 | 
					 | 
				
			||||||
  "daemon",
 | 
					 | 
				
			||||||
  "default",
 | 
					 | 
				
			||||||
  "doge",
 | 
					 | 
				
			||||||
  "dragon-and-cow",
 | 
					 | 
				
			||||||
  "dragon",
 | 
					 | 
				
			||||||
  "elephant-in-snake",
 | 
					 | 
				
			||||||
  "elephant",
 | 
					 | 
				
			||||||
  "eyes",
 | 
					 | 
				
			||||||
  "flaming-sheep",
 | 
					 | 
				
			||||||
  "ghostbusters",
 | 
					 | 
				
			||||||
  "goat",
 | 
					 | 
				
			||||||
  "hedgehog",
 | 
					 | 
				
			||||||
  "hellokitty",
 | 
					 | 
				
			||||||
  "kiss",
 | 
					 | 
				
			||||||
  "kitty",
 | 
					 | 
				
			||||||
  "koala",
 | 
					 | 
				
			||||||
  "kosh",
 | 
					 | 
				
			||||||
  "luke-koala",
 | 
					 | 
				
			||||||
  "mech-and-cow",
 | 
					 | 
				
			||||||
  "meow",
 | 
					 | 
				
			||||||
  "milk",
 | 
					 | 
				
			||||||
  "moofasa",
 | 
					 | 
				
			||||||
  "moose",
 | 
					 | 
				
			||||||
  "mutilated",
 | 
					 | 
				
			||||||
  "ren",
 | 
					 | 
				
			||||||
  "satanic",
 | 
					 | 
				
			||||||
  "sheep",
 | 
					 | 
				
			||||||
  "skeleton",
 | 
					 | 
				
			||||||
  "small",
 | 
					 | 
				
			||||||
  "squirrel",
 | 
					 | 
				
			||||||
  "stegosaurus",
 | 
					 | 
				
			||||||
  "stimpy",
 | 
					 | 
				
			||||||
  "supermilker",
 | 
					 | 
				
			||||||
  "surgery",
 | 
					 | 
				
			||||||
  "telebears",
 | 
					 | 
				
			||||||
  "turkey",
 | 
					 | 
				
			||||||
  "turtle",
 | 
					 | 
				
			||||||
  "tux",
 | 
					 | 
				
			||||||
  "vader-koala",
 | 
					 | 
				
			||||||
  "vader",
 | 
					 | 
				
			||||||
  "whale",
 | 
					 | 
				
			||||||
  "www"
 | 
					 | 
				
			||||||
];
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
exports.run = async (message, args) => {
 | 
					exports.run = async (message, args) => {
 | 
				
			||||||
  if (args.length === 0) {
 | 
					  if (args.length === 0) {
 | 
				
			||||||
    return `${message.author.mention}, you need to provide some text for the cow to say!`;
 | 
					    return `${message.author.mention}, you need to provide some text for the cow to say!`;
 | 
				
			||||||
  } else if (cowList.includes(args[0].toLowerCase())) {
 | 
					  } else if (cows[args[0].toLowerCase()] != undefined) {
 | 
				
			||||||
    const cow = args.shift().toLowerCase();
 | 
					    const cow = cows[args.shift().toLowerCase()];
 | 
				
			||||||
    return `\`\`\`\n${cowsay.say({
 | 
					    return `\`\`\`\n${cowsay.say(args.join(" "), {
 | 
				
			||||||
      text: args.join(" "),
 | 
					      cow
 | 
				
			||||||
      f: cow
 | 
					 | 
				
			||||||
    })}\n\`\`\``;
 | 
					    })}\n\`\`\``;
 | 
				
			||||||
  } else {
 | 
					  } else {
 | 
				
			||||||
    return `\`\`\`\n${cowsay.say({ text: args.join(" ") })}\n\`\`\``;
 | 
					    return `\`\`\`\n${cowsay.say(args.join(" "))}\n\`\`\``;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										16
									
								
								events/rawWS.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								events/rawWS.js
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,16 @@
 | 
				
			||||||
 | 
					const player = require("../utils/soundplayer.js");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// run when a raw packet is sent, used for sending data to lavalink
 | 
				
			||||||
 | 
					module.exports = async (packet) => {
 | 
				
			||||||
 | 
					  switch (packet.t) {
 | 
				
			||||||
 | 
					    case "VOICE_SERVER_UPDATE":
 | 
				
			||||||
 | 
					      await player.manager.voiceServerUpdate(packet.d);
 | 
				
			||||||
 | 
					      break;
 | 
				
			||||||
 | 
					    case "VOICE_STATE_UPDATE":
 | 
				
			||||||
 | 
					      await player.manager.voiceStateUpdate(packet.d);
 | 
				
			||||||
 | 
					      break;
 | 
				
			||||||
 | 
					    case "GUILD_CREATE":
 | 
				
			||||||
 | 
					      for (const state of packet.d.voice_states) await player.manager.voiceStateUpdate({ ...state, guild_id: packet.d.id });
 | 
				
			||||||
 | 
					      break;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
							
								
								
									
										5267
									
								
								package-lock.json
									
										
									
										generated
									
									
									
								
							
							
						
						
									
										5267
									
								
								package-lock.json
									
										
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							| 
						 | 
					@ -22,13 +22,12 @@
 | 
				
			||||||
    "url": "git+https://github.com/esmBot/esmBot.git"
 | 
					    "url": "git+https://github.com/esmBot/esmBot.git"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "dependencies": {
 | 
					  "dependencies": {
 | 
				
			||||||
    "@lavacord/eris": "0.0.3",
 | 
					 | 
				
			||||||
    "abort-controller": "^3.0.0",
 | 
					    "abort-controller": "^3.0.0",
 | 
				
			||||||
    "cowsay": "^1.4.0",
 | 
					    "cowsay2": "^2.0.4",
 | 
				
			||||||
    "dblapi.js": "^2.4.1",
 | 
					    "dblapi.js": "^2.4.1",
 | 
				
			||||||
    "dotenv": "^8.2.0",
 | 
					    "dotenv": "^8.2.0",
 | 
				
			||||||
    "duckduckgo-images-api": "github:benpbolton/duckduckgo-images-api",
 | 
					    "duckduckgo-images-api": "^1.0.5",
 | 
				
			||||||
    "emoji-regex": "^8.0.0",
 | 
					    "emoji-regex": "^9.2.2",
 | 
				
			||||||
    "eris": "^0.14.0",
 | 
					    "eris": "^0.14.0",
 | 
				
			||||||
    "file-type": "^16.1.0",
 | 
					    "file-type": "^16.1.0",
 | 
				
			||||||
    "jsqr": "^1.3.1",
 | 
					    "jsqr": "^1.3.1",
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -28,7 +28,7 @@ Default prefix is \`&\`.
 | 
				
			||||||
    general: ["## 💻 General"],
 | 
					    general: ["## 💻 General"],
 | 
				
			||||||
    tags: ["## 🏷️ Tags"],
 | 
					    tags: ["## 🏷️ Tags"],
 | 
				
			||||||
    fun: ["## 👌 Fun"],
 | 
					    fun: ["## 👌 Fun"],
 | 
				
			||||||
    images: ["## 🖼️ Image Editing", "> These commands support the PNG, JPEG, WEBP, and GIF formats. (GIF support is currently experimental)\n"],
 | 
					    images: ["## 🖼️ Image Editing", "> These commands support the PNG, JPEG, WEBP, and GIF formats.\n"],
 | 
				
			||||||
    soundboard: ["## 🔊 Soundboard"],
 | 
					    soundboard: ["## 🔊 Soundboard"],
 | 
				
			||||||
    music: ["## 🎤 Music"]
 | 
					    music: ["## 🎤 Music"]
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -50,8 +50,13 @@ module.exports = async (message, pages, timeout = 120000) => {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
  reactionCollector.once("end", async () => {
 | 
					  reactionCollector.once("end", async () => {
 | 
				
			||||||
    if (currentPage.channel.messages.get(currentPage.id) && manageMessages) {
 | 
					    try {
 | 
				
			||||||
      await currentPage.removeReactions();
 | 
					      await currentPage.channel.getMessage(currentPage.id);
 | 
				
			||||||
 | 
					      if (manageMessages) {
 | 
				
			||||||
 | 
					        await currentPage.removeReactions();
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    } catch {
 | 
				
			||||||
 | 
					      return;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
  return currentPage;
 | 
					  return currentPage;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -4,7 +4,7 @@ const paginator = require("./pagination/pagination.js");
 | 
				
			||||||
const fetch = require("node-fetch");
 | 
					const fetch = require("node-fetch");
 | 
				
			||||||
const moment = require("moment");
 | 
					const moment = require("moment");
 | 
				
			||||||
require("moment-duration-format");
 | 
					require("moment-duration-format");
 | 
				
			||||||
const { Manager } = require("@lavacord/eris");
 | 
					const { Manager } = require("lavacord");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
let nodes = require("../servers.json").lava;
 | 
					let nodes = require("../servers.json").lava;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -35,8 +35,14 @@ exports.checkStatus = async () => {
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
exports.connect = async () => {
 | 
					exports.connect = async () => {
 | 
				
			||||||
  this.manager = new Manager(client, nodes, {
 | 
					  this.manager = new Manager(nodes, {
 | 
				
			||||||
    user: client.user.id
 | 
					    user: client.user.id,
 | 
				
			||||||
 | 
					    shards: client.shards.size || 1,
 | 
				
			||||||
 | 
					    send: (packet) => {
 | 
				
			||||||
 | 
					      const guild = client.guilds.get(packet.d.guild_id);
 | 
				
			||||||
 | 
					      if (!guild) return;
 | 
				
			||||||
 | 
					      return guild.shard.sendWS(packet.op, packet.d);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
  const { length } = await this.manager.connect();
 | 
					  const { length } = await this.manager.connect();
 | 
				
			||||||
  logger.log(`Successfully connected to ${length} Lavalink node(s).`);
 | 
					  logger.log(`Successfully connected to ${length} Lavalink node(s).`);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue