mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-16 03:18:17 +00:00
Merge branch 'change-cache-members' of https://github.com/discordeno/discordeno into change-cache-members
This commit is contained in:
@@ -37,7 +37,7 @@ export async function handleChannelDelete(data: DiscordGatewayPayload) {
|
||||
if (
|
||||
[
|
||||
DiscordChannelTypes.GuildText,
|
||||
DiscordChannelTypes.Dm,
|
||||
DiscordChannelTypes.DM,
|
||||
DiscordChannelTypes.GroupDm,
|
||||
DiscordChannelTypes.GuildNews,
|
||||
].includes(payload.type)
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -16,7 +16,7 @@ export async function startTyping(channelId: bigint) {
|
||||
if (channel) {
|
||||
if (
|
||||
 */
|
||||
MEMBER_VERIFICATION_GATE_ENABLED = "MEMBER_VERIFICATION_GATE_ENABLED",
|
||||
MemberVerificationGateEnabled = "MEMBER_VERIFICATION_GATE_ENABLED",
|
||||
/** Guild can be previewed before joining via Membership Screening or the directory */
|
||||
PREVIEW_ENABLED = "PREVIEW_ENABLED",
|
||||
PreviewEnabled = "PREVIEW_ENABLED",
|
||||
}
|
||||
|
||||
export type GuildFeatures = DiscordGuildFeatures;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/** https://discord.com/developers/docs/resources/guild#guild-object-mfa-level */
|
||||
export enum DiscordMfaLevels {
|
||||
/** Guild has no MFA/2FA requirement for moderation actions */
|
||||
NONE,
|
||||
None,
|
||||
/** Guild has a 2FA requirement for moderation actions */
|
||||
ELEVATED,
|
||||
Elevated,
|
||||
}
|
||||
|
||||
export type MfaLevels = DiscordMfaLevels;
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/** https://discord.com/developers/docs/resources/guild#guild-object-premium-tier */
|
||||
export enum DiscordPremiumTiers {
|
||||
/** Guild has not unlocked any Server Boost perks */
|
||||
NONE,
|
||||
None,
|
||||
/** Guild has unlocked Server Boost level 1 perks */
|
||||
TIER_1,
|
||||
Tier1,
|
||||
/** Guild has unlocked Server Boost level 2 perks */
|
||||
TIER_2,
|
||||
Tier2,
|
||||
/** Guild has unlocked Server Boost level 3 perks */
|
||||
TIER_3,
|
||||
Tier3,
|
||||
}
|
||||
|
||||
export type PremiumTiers = DiscordPremiumTiers;
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
/** https://discord.com/developers/docs/resources/guild#guild-object-system-channel-flags */
|
||||
export enum DiscordSystemChannelFlags {
|
||||
/** Suppress member join notifications */
|
||||
SUPPRESS_JOIN_NOTIFICATIONS = 1 << 0,
|
||||
SuppressJoinNotifications = 1 << 0,
|
||||
/** Suppress server boost notifications */
|
||||
SUPPRESS_PREMIUM_SUBSCRIPTIONS = 1 << 1,
|
||||
SuppressPremiumSubscriptions = 1 << 1,
|
||||
/** Suppress server setup tips */
|
||||
SUPPRESS_GUILD_REMINDER_NOTIFICATIONS = 1 << 2,
|
||||
SuppressGuildReminderNotifications = 1 << 2,
|
||||
}
|
||||
|
||||
export type SystemChannelFlags = DiscordSystemChannelFlags;
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
/** https://discord.com/developers/docs/resources/guild#guild-object-verification-level */
|
||||
export enum DiscordVerificationLevels {
|
||||
/** Unrestricted */
|
||||
NONE,
|
||||
None,
|
||||
/** Must have verified email on account */
|
||||
LOW,
|
||||
Low,
|
||||
/** Must be registered on Discord for longer than 5 minutes */
|
||||
MEDIUM,
|
||||
Medium,
|
||||
/** Must be a member of the server for longer than 10 minutes */
|
||||
HIGH,
|
||||
High,
|
||||
/** Must have a verified phone number */
|
||||
VERY_HIGH,
|
||||
VeryHigh,
|
||||
}
|
||||
|
||||
export type VerificationLevels = DiscordVerificationLevels;
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
/** https://discord.com/developers/docs/interactions/slash-commands#applicationcommandoptiontype */
|
||||
export enum DiscordApplicationCommandOptionTypes {
|
||||
SUB_COMMAND = 1,
|
||||
SUB_COMMAND_GROUP,
|
||||
STRING,
|
||||
INTEGER,
|
||||
BOOLEAN,
|
||||
USER,
|
||||
CHANNEL,
|
||||
ROLE,
|
||||
MENTIONABLE,
|
||||
SubCommand = 1,
|
||||
SubCommandGroup,
|
||||
String,
|
||||
Integer,
|
||||
Boolean,
|
||||
User,
|
||||
Channel,
|
||||
Role,
|
||||
Mentionable,
|
||||
}
|
||||
|
||||
export type ApplicationCommandOptionTypes =
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/** https://discord.com/developers/docs/resources/invite#invite-object-target-user-types */
|
||||
export enum DiscordTargetTypes {
|
||||
STREAM = 1,
|
||||
EMBEDDED_APPLICATION,
|
||||
Stream = 1,
|
||||
EmbeddedApplication,
|
||||
}
|
||||
|
||||
export type TargetTypes = DiscordTargetTypes;
|
||||
|
||||
@@ -8,13 +8,11 @@ import { MessageComponents } from "./components/message_components.ts";
|
||||
export interface CreateMessage {
|
||||
/** The message contents (up to 2000 characters) */
|
||||
content?: string;
|
||||
/** A nonce that can be used for optimistic message sending */
|
||||
nonce?: number | string;
|
||||
/** true if this is a TTS message */
|
||||
tts?: boolean;
|
||||
/** Embedded `rich` content */
|
||||
embed?: Embed;
|
||||
/** Allowed mentions for a message */
|
||||
/** Allowed mentions for the message */
|
||||
allowedMentions?: AllowedMentions;
|
||||
/** Include to make your message a reply */
|
||||
messageReference?: MessageReference;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Embed } from "../embeds/embed.ts";
|
||||
import { FileContent } from "../misc/file_content.ts";
|
||||
import { AllowedMentions } from "./allowed_mentions.ts";
|
||||
import { Attachment } from "./attachment.ts";
|
||||
|
||||
@@ -10,6 +11,8 @@ export interface EditMessage {
|
||||
embed?: Embed | null;
|
||||
/** Edit the flags of the message (only `SUPRESS_EMBEDS` can currently be set/unset) */
|
||||
flags?: 4 | null;
|
||||
/** The contents of the file being sent/edited */
|
||||
file?: FileContent | FileContent[] | null;
|
||||
/** Allowed mentions for the message */
|
||||
allowedMentions?: AllowedMentions | null;
|
||||
/** Attached files to keep */
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/** https://discord.com/developers/docs/resources/channel#message-object-message-activity-types */
|
||||
export enum DiscordMessageActivityTypes {
|
||||
JOIN = 1,
|
||||
SPECTATE,
|
||||
LISTEN,
|
||||
JOIN_REQUEST,
|
||||
Join = 1,
|
||||
Spectate,
|
||||
Listen,
|
||||
JoinRequest,
|
||||
}
|
||||
|
||||
export type MessageActivityTypes = DiscordMessageActivityTypes;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/** https://discord.com/developers/docs/resources/channel#message-object-message-sticker-format-types */
|
||||
export enum DiscordMessageStickerFormatTypes {
|
||||
PNG = 1,
|
||||
APNG,
|
||||
LOTTIE,
|
||||
Png = 1,
|
||||
Apng,
|
||||
Lottie,
|
||||
}
|
||||
|
||||
export type MessageStickerFormatTypes = DiscordMessageStickerFormatTypes;
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
/** https://discord.com/developers/docs/topics/gateway#activity-object-activity-flags */
|
||||
export enum DiscordActivityFlags {
|
||||
INSTANCE = 1 << 0,
|
||||
JOIN = 1 << 1,
|
||||
SPECTATE = 1 << 2,
|
||||
JOIN_REQUEST = 1 << 3,
|
||||
SYNC = 1 << 4,
|
||||
PLAY = 1 << 5,
|
||||
Instance = 1 << 0,
|
||||
Join = 1 << 1,
|
||||
Spectate = 1 << 2,
|
||||
JoinRequest = 1 << 3,
|
||||
Sync = 1 << 4,
|
||||
Play = 1 << 5,
|
||||
}
|
||||
|
||||
export type ActivityFlags = DiscordActivityFlags;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/** https://discord.com/developers/docs/topics/teams#data-models-membership-state-enum */
|
||||
export enum DiscordTeamMembershipStates {
|
||||
INVITED = 1,
|
||||
ACCEPTED,
|
||||
Invited = 1,
|
||||
Accepted,
|
||||
}
|
||||
|
||||
export type TeamMembershipStates = DiscordTeamMembershipStates;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Embed } from "../embeds/embed.ts";
|
||||
import { AllowedMentions } from "../messages/allowed_mentions.ts";
|
||||
import { FileContent } from "../misc/file_content.ts";
|
||||
import { Attachment } from "../messages/attachment.ts";
|
||||
import { FileContent } from "../misc/file_content.ts";
|
||||
|
||||
/** https://discord.com/developers/docs/resources/webhook#edit-webhook-message-jsonform-params */
|
||||
export interface EditWebhookMessage {
|
||||
@@ -10,7 +10,7 @@ export interface EditWebhookMessage {
|
||||
/** Embedded `rich` content */
|
||||
embeds?: Embed[] | null;
|
||||
/** The contents of the file being sent/edited */
|
||||
file?: FileContent | FileContent[];
|
||||
file?: FileContent | FileContent[] | null;
|
||||
/** Allowed mentions for the message */
|
||||
allowedMentions?: AllowedMentions | null;
|
||||
/** Attached files to keep */
|
||||
|
||||
@@ -7,6 +7,8 @@ import { SnakeCasedPropertiesDeep } from "../util.ts";
|
||||
export interface ExecuteWebhook {
|
||||
/** Waits for server confirmation of message send before response, and returns the created message body (defaults to `false`; when `false` a message that is not saved does not return an error) */
|
||||
wait?: boolean;
|
||||
/** Send a message to the specified thread within a webhook's channel. The thread will automatically be unarchived. */
|
||||
threadId?: bigint;
|
||||
/** The message contents (up to 2000 characters) */
|
||||
content?: string;
|
||||
/** Override the default username of the webhook */
|
||||
|
||||
+4
-4
@@ -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);
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ Deno.test({
|
||||
permissionOverwrites: [
|
||||
{
|
||||
id: bigintToSnowflake(botId),
|
||||
type: DiscordOverwriteTypes.MEMBER,
|
||||
type: DiscordOverwriteTypes.Member,
|
||||
allow: ["VIEW_CHANNEL"],
|
||||
deny: [],
|
||||
},
|
||||
|
||||
@@ -141,7 +141,7 @@ Deno.test({
|
||||
permissionOverwrites: [
|
||||
{
|
||||
id: bigintToSnowflake(botId),
|
||||
type: DiscordOverwriteTypes.MEMBER,
|
||||
type: DiscordOverwriteTypes.Member,
|
||||
allow: ["VIEW_CHANNEL"],
|
||||
deny: [],
|
||||
},
|
||||
|
||||
@@ -160,7 +160,7 @@ Deno.test({
|
||||
permissionOverwrites: [
|
||||
{
|
||||
id: bigintToSnowflake(botId),
|
||||
type: DiscordOverwriteTypes.MEMBER,
|
||||
type: DiscordOverwriteTypes.Member,
|
||||
allow: ["VIEW_CHANNEL"],
|
||||
deny: [],
|
||||
},
|
||||
|
||||
@@ -56,7 +56,7 @@ Deno.test({
|
||||
permissionOverwrites: [
|
||||
{
|
||||
id: bigintToSnowflake(botId),
|
||||
type: DiscordOverwriteTypes.MEMBER,
|
||||
type: DiscordOverwriteTypes.Member,
|
||||
allow: ["VIEW_CHANNEL"],
|
||||
deny: [],
|
||||
},
|
||||
|
||||
@@ -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: [],
|
||||
},
|
||||
|
||||
@@ -18,7 +18,7 @@ Deno.test({
|
||||
permissionOverwrites: [
|
||||
{
|
||||
id: bigintToSnowflake(botId),
|
||||
type: DiscordOverwriteTypes.MEMBER,
|
||||
type: DiscordOverwriteTypes.Member,
|
||||
allow: ["VIEW_CHANNEL"],
|
||||
deny: [],
|
||||
},
|
||||
|
||||
+1
-1
@@ -114,7 +114,7 @@ Deno.test({
|
||||
const option = {
|
||||
name: "option1",
|
||||
description: "The description of the application command's option.",
|
||||
type: DiscordApplicationCommandOptionTypes.STRING,
|
||||
type: DiscordApplicationCommandOptionTypes.String,
|
||||
};
|
||||
// The maximum number of options an application command can "accomodate" is 25.
|
||||
const options: ApplicationCommandOption[] = Array(26).fill(option);
|
||||
|
||||
@@ -36,11 +36,10 @@ Deno.test({
|
||||
await startBot({
|
||||
token,
|
||||
intents: [
|
||||
"GUILD_MESSAGES",
|
||||
"GUILDS",
|
||||
"GUILD_EMOJIS",
|
||||
"GUILD_MESSAGE_REACTIONS",
|
||||
"GUILD_EMOJIS",
|
||||
"GuildMessages",
|
||||
"Guilds",
|
||||
"GuildEmojis",
|
||||
"GuildMessageReactions",
|
||||
],
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user