mirror of
https://github.com/discordeno/discordeno.git
synced 2026-09-17 08:47:22 +00:00
fix(plugins/permissions): getting disabled welcome screens requires MANAGE_GUILD (#2034)
* fix: require manage guild perm in welcome screen * fix: perm check only if screen disabled
This commit is contained in:
@@ -1,6 +1,19 @@
|
||||
import { BotWithCache } from "../../deps.ts";
|
||||
import { requireBotGuildPermissions } from "../permissions.ts";
|
||||
|
||||
export function getWelcomeScreen(bot: BotWithCache) {
|
||||
const getWelcomeScreenOld = bot.helpers.getWelcomeScreen;
|
||||
|
||||
bot.helpers.getWelcomeScreen = function (guildId) {
|
||||
const guild = bot.guilds.get(guildId);
|
||||
if (!guild?.welcomeScreen) {
|
||||
requireBotGuildPermissions(bot, guildId, ["MANAGE_GUILD"]);
|
||||
}
|
||||
|
||||
return getWelcomeScreenOld(guildId);
|
||||
};
|
||||
}
|
||||
|
||||
export function editWelcomeScreen(bot: BotWithCache) {
|
||||
const editWelcomeScreenOld = bot.helpers.editWelcomeScreen;
|
||||
|
||||
@@ -12,5 +25,6 @@ export function editWelcomeScreen(bot: BotWithCache) {
|
||||
}
|
||||
|
||||
export default function setupWelcomeScreenPermChecks(bot: BotWithCache) {
|
||||
getWelcomeScreen(bot);
|
||||
editWelcomeScreen(bot);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user