From 3e2a3cd567efac2a448e2d5c02f563511999a990 Mon Sep 17 00:00:00 2001 From: Cynthia Foxwell Date: Thu, 26 Aug 2021 11:18:50 -0600 Subject: [PATCH] utility.banner: server support --- src/modules/utility.js | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/modules/utility.js b/src/modules/utility.js index 8893988..55ded50 100644 --- a/src/modules/utility.js +++ b/src/modules/utility.js @@ -137,7 +137,28 @@ banner.usage = ""; banner.callback = async function (msg, line) { let id = msg.author.id; - if (line) { + if (line == "--server" || line == "--guild") { + if (!msg.channel.guild) { + return "`--server/--guild` can only be used within guilds."; + } else { + const url = `${BANNER_BASE}${msg.channel.guild.id}/${ + msg.channel.guild.banner + }.${ + msg.channel.guild.banner.startsWith("a_") + ? "gif?size=1024&_=.gif" + : "png?size=1024" + }`; + return { + embed: { + title: "Server Banner", + url, + image: { + url, + }, + }, + }; + } + } else if (line) { const lookup = await lookupUser(msg, line); if ( lookup == "No results" ||