command to change server icon

This commit is contained in:
Lamp 2022-04-06 01:25:03 -07:00
parent 0fcd5f125c
commit e19f11acae

@ -123,7 +123,7 @@ var commands = module.exports = [
exec: i => commands.find(x => x.name == "steal").exec(i)
},
{
name: "setbanner",
name: "setserverbanner",
description: "Set the server banner image",
options: [
{
@ -150,6 +150,35 @@ var commands = module.exports = [
await i.reply(error.message);
}
}
},
{
name: "setservericon",
description: "Change the server icon",
options: [
{
name: "url",
description: "HTTP(S) URL to an image",
type: "STRING"
}
],
exec: async i => {
var url = i.options.getString("url");
try {
if (!url) {
await i.guild.setIcon(null);
await i.reply("cleared the server icon");
} else {
if (/^https?:\/\//i.test(url)) {
await i.guild.setIcon(url);
await i.reply(url);
} else {
await i.reply("http image url only!");
}
}
} catch (error) {
await i.reply(error.message);
}
}
}
];