3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-13 13:25:03 +00:00

migrate permissions

Signed-off-by: GitHub <noreply@github.com>
This commit is contained in:
metal 2023-03-11 14:31:59 +00:00 committed by GitHub
parent 8281299369
commit fda9a35f29
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 75 additions and 70 deletions

View file

@ -1,6 +1,6 @@
import { GuildPluginData } from "knub";
import { InternalPosterPluginType } from "../types";
import { AnyChannel, GuildChannel, MessageManager, NewsChannel, Permissions, TextChannel } from "discord.js";
import { AnyChannel, GuildChannel, MessageManager, NewsChannel, PermissionsBitField, TextChannel } from "discord.js";
import { isDiscordAPIError } from "../../../utils";
type WebhookInfo = [id: string, token: string];
@ -27,7 +27,7 @@ export async function getOrCreateWebhookForChannel(
// Create new webhook
const member = pluginData.client.user && pluginData.guild.members.cache.get(pluginData.client.user.id);
if (!member || member.permissions.has(Permissions.FLAGS.MANAGE_WEBHOOKS)) {
if (!member || member.permissions.has(PermissionsBitField.Flags.ManageWebhooks)) {
try {
const webhook = await channel.createWebhook(`Zephook ${channel.id}`);
await pluginData.state.webhooks.create({