Removed unnecessary try/catch block from pagination, fixed font coloring with sonic

This commit is contained in:
TheEssem 2019-12-10 08:24:13 -06:00
parent c1f2eadf88
commit 346312f006
2 changed files with 3 additions and 7 deletions

View file

@ -9,8 +9,8 @@ exports.run = async (message, args) => {
message.channel.sendTyping();
const template = "./assets/images/sonic.jpg";
const file = `/tmp/${Math.random().toString(36).substring(2, 15)}.png`;
const cleanedMessage = args.join(" ").replace(/&/g, "\\&amp;").replace(/>/g, "\\&gt;").replace(/</g, "\\&lt;");
gm(474, 332).out("+size").gravity("Center").out("-pointsize", 40).out("-font", "Bitstream Vera Sans").out(`pango:${wrap(cleanedMessage, {width: 15, indent: ""})}`).negative().out("-fuzz", "30%").transparent("black").write(file, async (error) => {
const cleanedMessage = args.join(" ").replace(/&/g, "\\&amp;").replace(/>/g, "\\&gt;").replace(/</g, "\\&lt;").replace(/"/g, "\\&quot;").replace(/'/g, "\\&apos;");
gm(474, 332).out("+size").background("none").gravity("Center").out("-pointsize", 72).out("-font", "Bitstream Vera Sans").out(`pango:<span foreground="white">${wrap(cleanedMessage, {width: 15, indent: ""})}</span>`).write(file, async (error) => {
if (error) console.error;
const command = gm(template).composite(file).gravity("Center").geometry("474x332+160+10");
const resultBuffer = await gmToBuffer(command, "png");

View file

@ -56,11 +56,7 @@ const paginationEmbed = async (message, pages, timeout = 120000) => {
}
});
reactionCollector.once("end", () => {
try {
if (!deleted) currentPage.removeReactions();
} catch (e) {
console.log("Reaction message was deleted");
}
if (!deleted) currentPage.removeReactions();
});
return currentPage;
};