Fixed image API request closing prematurely, disabled music commands in production, various fixes regarding direct messages, fixed reply image checking, and removed yoda

This commit is contained in:
TheEssem 2020-12-26 12:17:10 -06:00
parent 7a254a5139
commit 8a2d4e6669
16 changed files with 57 additions and 52 deletions

View file

@ -24,7 +24,7 @@ exports.run = async (message, args) => {
"name": "esmBot Help",
"icon_url": client.user.avatarURL
},
"title": `${prefix}${command}`,
"title": `${message.channel.guild ? prefix : ""}${command}`,
"url": "https://projectlounge.pw/esmBot/help.html",
"description": command === "tags" ? "The main tags command. Check the help page for more info: https://projectlounge.pw/esmBot/help.html" : info.description,
"color": 16711680,
@ -106,7 +106,7 @@ exports.run = async (message, args) => {
},
"fields": [{
"name": "Prefix",
"value": prefix
"value": message.channel.guild ? prefix : "N/A"
}, {
"name": "Tip",
"value": misc.random(tips)

View file

@ -16,7 +16,7 @@ exports.run = async () => {
},
{
"name": "📝 Credits:",
"value": "Bot by **[Essem](https://essem.space)**\nIcon by **[MintBorrow](https://mintborrow.newgrounds.com)**"
"value": "Bot by **[Essem](https://essem.space)** and **[various contributors](https://github.com/esmBot/esmBot/graphs/contributors)**\nIcon by **[MintBorrow](https://mintborrow.newgrounds.com)**"
},
{
"name": "💬 Total Servers:",

View file

@ -1,6 +1,7 @@
const soundPlayer = require("../utils/soundplayer.js");
exports.run = async (message) => {
if (process.env.NODE_ENV === "production") return "Music commands are coming soon, but they aren't ready yet. Stay tuned to @esmBot_ on Twitter for updates!";
return await soundPlayer.loop(message);
};

View file

@ -1,6 +1,7 @@
const soundPlayer = require("../utils/soundplayer.js");
exports.run = async (message) => {
if (process.env.NODE_ENV === "production") return "Music commands are coming soon, but they aren't ready yet. Stay tuned to @esmBot_ on Twitter for updates!";
return await soundPlayer.playing(message);
};

View file

@ -1,6 +1,7 @@
const soundPlayer = require("../utils/soundplayer.js");
exports.run = async (message) => {
if (process.env.NODE_ENV === "production") return "Music commands are coming soon, but they aren't ready yet. Stay tuned to @esmBot_ on Twitter for updates!";
return await soundPlayer.pause(message);
};

View file

@ -3,6 +3,7 @@ const urlRegex = /(?:\w+:)?\/\/(\S+)/;
const searchRegex = /^(sc|yt)search:/;
exports.run = async (message, args) => {
if (process.env.NODE_ENV === "production") return "Music commands are coming soon, but they aren't ready yet. Stay tuned to @esmBot_ on Twitter for updates!";
if (!args[0]) return `${message.author.mention}, you need to provide what you want to play!`;
const query = args.join(" ").trim();
const search = urlRegex.test(query) ? query : (searchRegex.test(query) ? query : `ytsearch:${query}`);

View file

@ -1,11 +1,13 @@
const jsqr = require("jsqr");
const fetch = require("node-fetch");
const sharp = require("sharp");
exports.run = async (message) => {
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide an image with a QR code to read!`;
message.channel.sendTyping();
const rawData = await sharp(image.path).ensureAlpha().raw().toBuffer({ resolveWithObject: true });
const data = await (await fetch(image.path)).buffer();
const rawData = await sharp(data).ensureAlpha().raw().toBuffer({ resolveWithObject: true });
const qrBuffer = jsqr(rawData.data, rawData.info.width, rawData.info.height);
if (!qrBuffer) return `${message.author.mention}, I couldn't find a QR code!`;
return `\`\`\`\n${qrBuffer.data}\n\`\`\``;

View file

@ -1,6 +1,7 @@
const soundPlayer = require("../utils/soundplayer.js");
exports.run = async (message) => {
if (process.env.NODE_ENV === "production") return "Music commands are coming soon, but they aren't ready yet. Stay tuned to @esmBot_ on Twitter for updates!";
return await soundPlayer.queue(message);
};

View file

@ -1,6 +1,7 @@
const soundPlayer = require("../utils/soundplayer.js");
exports.run = async (message) => {
if (process.env.NODE_ENV === "production") return "Music commands are coming soon, but they aren't ready yet. Stay tuned to @esmBot_ on Twitter for updates!";
return await soundPlayer.skip(message);
};

View file

@ -1,6 +1,7 @@
const soundPlayer = require("../utils/soundplayer.js");
exports.run = async (message) => {
if (process.env.NODE_ENV === "production") return "Music commands are coming soon, but they aren't ready yet. Stay tuned to @esmBot_ on Twitter for updates!";
return await soundPlayer.stop(message);
};

View file

@ -1,14 +0,0 @@
const fetch = require("node-fetch");
exports.run = async (message, args) => {
return `${message.author.mention}, this command is currently disabled due to various issues. We are looking for a fix.`;
/*if (args.length === 0) return `${message.author.mention}, you need to provide some text to translate to Yodish!`;
const request = await fetch(`https://yoda-api.appspot.com/api/v1/yodish?text=${encodeURIComponent(args.join(" "))}`);
const json = await request.json();
return json.yodish;*/
};
exports.aliases = ["yodish"];
exports.category = 4;
exports.help = "Translates a message to Yodish (disabled)";
exports.params = "[text]";