mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-10 12:25:02 +00:00
Update to discord.js v13.8.0, adding support for text-in-voice
This commit is contained in:
parent
ba78103807
commit
b05fbe1d04
32 changed files with 151 additions and 149 deletions
|
@ -1,17 +1,20 @@
|
|||
import { GuildPluginData } from "knub";
|
||||
import { InternalPosterPluginType } from "../types";
|
||||
import { NewsChannel, Permissions, TextChannel } from "discord.js";
|
||||
import { AnyChannel, GuildChannel, MessageManager, NewsChannel, Permissions, TextChannel } from "discord.js";
|
||||
import { isDiscordAPIError } from "../../../utils";
|
||||
|
||||
type WebhookInfo = [id: string, token: string];
|
||||
|
||||
export type WebhookableChannel = Extract<AnyChannel, { createWebhook: (...args: any[]) => any }>;
|
||||
|
||||
export function channelIsWebhookable(channel: AnyChannel): channel is WebhookableChannel {
|
||||
return "createWebhook" in channel;
|
||||
}
|
||||
|
||||
export async function getOrCreateWebhookForChannel(
|
||||
pluginData: GuildPluginData<InternalPosterPluginType>,
|
||||
channel: TextChannel | NewsChannel,
|
||||
channel: WebhookableChannel,
|
||||
): Promise<WebhookInfo | null> {
|
||||
// tslint:disable-next-line:no-console FIXME: Here for debugging purposes
|
||||
console.log(`getOrCreateWebhookForChannel(${channel.id})`);
|
||||
|
||||
// Database cache
|
||||
const fromDb = await pluginData.state.webhooks.findByChannelId(channel.id);
|
||||
if (fromDb) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue