fix changes

This commit is contained in:
ITOH
2021-05-04 21:05:43 +02:00
parent d87d66649e
commit aefd5c75f5
16 changed files with 24 additions and 25 deletions

View File

@@ -37,7 +37,7 @@ export async function handleChannelDelete(data: DiscordGatewayPayload) {
if (
[
DiscordChannelTypes.GuildText,
DiscordChannelTypes.Dm,
DiscordChannelTypes.DM,
DiscordChannelTypes.GroupDm,
DiscordChannelTypes.GuildNews,
].includes(payload.type)

View File

@@ -14,7 +14,7 @@ export async function cloneChannel(channelId: bigint, reason?: string) {
//Check for DM channel
if (
channelToClone.type === DiscordChannelTypes.Dm ||
channelToClone.type === DiscordChannelTypes.DM ||
channelToClone.type === DiscordChannelTypes.GroupDm
) {
throw new Error(Errors.CHANNEL_NOT_IN_GUILD);

View File

@@ -16,7 +16,7 @@ export async function startTyping(channelId: bigint) {
if (channel) {
if (
![
DiscordChannelTypes.Dm,
DiscordChannelTypes.DM,
DiscordChannelTypes.GuildNews,
DiscordChannelTypes.GuildText,
DiscordChannelTypes.GuildNewsThread,

View File

@@ -24,7 +24,7 @@ export function fetchMembers(
// You can request 1 member without the intent
if (
(!options?.limit || options.limit > 1) &&
!(ws.identifyPayload.intents & DiscordGatewayIntents.GUILD_MEMBERS)
!(ws.identifyPayload.intents & DiscordGatewayIntents.GuildMembers)
) {
throw new Error(Errors.MISSING_INTENT_GUILD_MEMBERS);
}

View File

@@ -24,7 +24,7 @@ export async function getMembers(
guildId: bigint,
options?: ListGuildMembers & { addToCache?: boolean },
) {
if (!(ws.identifyPayload.intents && DiscordGatewayIntents.GUILD_MEMBERS)) {
if (!(ws.identifyPayload.intents && DiscordGatewayIntents.GuildMembers)) {
throw new Error(Errors.MISSING_INTENT_GUILD_MEMBERS);
}

View File

@@ -26,7 +26,7 @@ export async function sendMessage(
if (channel) {
if (
![
DiscordChannelTypes.Dm,
DiscordChannelTypes.DM,
DiscordChannelTypes.GuildNews,
DiscordChannelTypes.GuildText,
DiscordChannelTypes.GuildPublicThread,

View File

@@ -92,10 +92,10 @@ const baseGuild: Partial<DiscordenoGuild> = {
return cache.members.get(this.ownerId!);
},
get partnered() {
return Boolean(this.features?.includes(DiscordGuildFeatures.PARTNERED));
return Boolean(this.features?.includes(DiscordGuildFeatures.Partnered));
},
get verified() {
return Boolean(this.features?.includes(DiscordGuildFeatures.VERIFIED));
return Boolean(this.features?.includes(DiscordGuildFeatures.Verified));
},
bannerURL(size, format) {
return guildBannerURL(this.id!, this.banner!, size, format);

View File

@@ -3,7 +3,7 @@ export enum DiscordChannelTypes {
/** A text channel within a server */
GuildText,
/** A direct message between users */
Dm,
DM,
/** A voice channel within a server */
GuildVoice,
/** A direct message between multiple users */

View File

@@ -130,11 +130,11 @@ function validateSlashOptionChoices(
}
if (
(optionType === DiscordApplicationCommandOptionTypes.STRING &&
(optionType === DiscordApplicationCommandOptionTypes.String &&
(typeof choice.value !== "string" ||
choice.value.length < 1 ||
choice.value.length > 100)) ||
(optionType === DiscordApplicationCommandOptionTypes.INTEGER &&
(optionType === DiscordApplicationCommandOptionTypes.Integer &&
typeof choice.value !== "number")
) {
throw new Error(Errors.INVALID_SLASH_OPTIONS_CHOICES);
@@ -152,8 +152,8 @@ function validateSlashOptions(options: ApplicationCommandOption[]) {
if (
option.choices?.length &&
(option.choices.length > 25 ||
(option.type !== DiscordApplicationCommandOptionTypes.STRING &&
option.type !== DiscordApplicationCommandOptionTypes.INTEGER))
(option.type !== DiscordApplicationCommandOptionTypes.String &&
option.type !== DiscordApplicationCommandOptionTypes.Integer))
) {
throw new Error(Errors.INVALID_SLASH_OPTIONS_CHOICES);
}

View File

@@ -53,7 +53,7 @@ Deno.test({
permissionOverwrites: [
{
id: bigintToSnowflake(botId),
type: DiscordOverwriteTypes.MEMBER,
type: DiscordOverwriteTypes.Member,
allow: ["VIEW_CHANNEL"],
deny: [],
},

View File

@@ -141,7 +141,7 @@ Deno.test({
permissionOverwrites: [
{
id: bigintToSnowflake(botId),
type: DiscordOverwriteTypes.MEMBER,
type: DiscordOverwriteTypes.Member,
allow: ["VIEW_CHANNEL"],
deny: [],
},

View File

@@ -160,7 +160,7 @@ Deno.test({
permissionOverwrites: [
{
id: bigintToSnowflake(botId),
type: DiscordOverwriteTypes.MEMBER,
type: DiscordOverwriteTypes.Member,
allow: ["VIEW_CHANNEL"],
deny: [],
},

View File

@@ -56,7 +56,7 @@ Deno.test({
permissionOverwrites: [
{
id: bigintToSnowflake(botId),
type: DiscordOverwriteTypes.MEMBER,
type: DiscordOverwriteTypes.Member,
allow: ["VIEW_CHANNEL"],
deny: [],
},

View File

@@ -35,7 +35,7 @@ async function ifItFailsBlameWolf(options: CreateGuildChannel) {
}
await editChannelOverwrite(channel.guildId, channel.id, botId, {
type: DiscordOverwriteTypes.MEMBER,
type: DiscordOverwriteTypes.Member,
allow: ["VIEW_CHANNEL", "ADD_REACTIONS"],
deny: [],
});
@@ -71,7 +71,7 @@ Deno.test({
permissionOverwrites: [
{
id: bigintToSnowflake(botId),
type: DiscordOverwriteTypes.MEMBER,
type: DiscordOverwriteTypes.Member,
allow: ["VIEW_CHANNEL"],
deny: [],
},

View File

@@ -18,7 +18,7 @@ Deno.test({
permissionOverwrites: [
{
id: bigintToSnowflake(botId),
type: DiscordOverwriteTypes.MEMBER,
type: DiscordOverwriteTypes.Member,
allow: ["VIEW_CHANNEL"],
deny: [],
},

View File

@@ -36,11 +36,10 @@ Deno.test({
await startBot({
token,
intents: [
"GUILD_MESSAGES",
"GUILDS",
"GUILD_EMOJIS",
"GUILD_MESSAGE_REACTIONS",
"GUILD_EMOJIS",
"GuildMessages",
"Guilds",
"GuildEmojis",
"GuildMessageReactions",
],
});