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:
parent
8281299369
commit
fda9a35f29
23 changed files with 75 additions and 70 deletions
|
@ -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({
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue