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,8 +1,8 @@
|
|||
import { GuildChannel, GuildMember } from "discord.js";
|
||||
import { GuildMember, GuildTextBasedChannel } from "discord.js";
|
||||
import { getMissingChannelPermissions } from "./getMissingChannelPermissions";
|
||||
import { readChannelPermissions } from "./readChannelPermissions";
|
||||
|
||||
export function canReadChannel(channel: GuildChannel, member: GuildMember) {
|
||||
export function canReadChannel(channel: GuildTextBasedChannel, member: GuildMember) {
|
||||
// Not missing permissions required to read the channel = can read channel
|
||||
return !getMissingChannelPermissions(member, channel, readChannelPermissions);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { GuildChannel, GuildMember, ThreadChannel } from "discord.js";
|
||||
import { GuildMember, GuildTextBasedChannel } from "discord.js";
|
||||
import { getMissingPermissions } from "./getMissingPermissions";
|
||||
|
||||
/**
|
||||
|
@ -7,7 +7,7 @@ import { getMissingPermissions } from "./getMissingPermissions";
|
|||
*/
|
||||
export function getMissingChannelPermissions(
|
||||
member: GuildMember,
|
||||
channel: GuildChannel | ThreadChannel,
|
||||
channel: GuildTextBasedChannel,
|
||||
requiredPermissions: number | bigint,
|
||||
): bigint {
|
||||
const memberChannelPermissions = channel.permissionsFor(member.id);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { Snowflake, TextChannel } from "discord.js";
|
||||
import { GuildTextBasedChannel, Snowflake, TextChannel } from "discord.js";
|
||||
import { GuildPluginData } from "knub";
|
||||
import { getChannelIdFromMessageId } from "../data/getChannelIdFromMessageId";
|
||||
import { isSnowflake } from "../utils";
|
||||
|
@ -7,7 +7,7 @@ const channelAndMessageIdRegex = /^(\d+)[\-\/](\d+)$/;
|
|||
const messageLinkRegex = /^https:\/\/(?:\w+\.)?discord(?:app)?\.com\/channels\/\d+\/(\d+)\/(\d+)$/i;
|
||||
|
||||
export interface MessageTarget {
|
||||
channel: TextChannel;
|
||||
channel: GuildTextBasedChannel;
|
||||
messageId: string;
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,7 @@ export async function resolveMessageTarget(pluginData: GuildPluginData<any>, val
|
|||
}
|
||||
|
||||
const channel = pluginData.guild.channels.resolve(result.channelId as Snowflake);
|
||||
if (!channel || !(channel instanceof TextChannel)) {
|
||||
if (!channel?.isText()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue