feat: hydrate slowmode into channels and add the new permission (#151)

* feat: implement slowmode functionality with cooldown display

Signed-off-by: ispik <ispik@ispik.dev>

* refactor: format

Signed-off-by: ispik <ispik@ispik.dev>

* refactor: remove unnecessary function

Signed-off-by: ispik <ispik@ispik.dev>

---------

Signed-off-by: ispik <ispik@ispik.dev>
This commit is contained in:
İspik
2026-05-11 03:14:53 +03:00
committed by GitHub
parent 1c97bc2d5a
commit 46b20bd7f7
3 changed files with 12 additions and 0 deletions
+7
View File
@@ -798,6 +798,13 @@ export class Channel {
);
}
/**
* Get slowmode value for the channel
*/
get slowmode(): number {
return this.#collection.getUnderlyingObject(this.id).slowmode ?? 0;
}
/**
* Join a call
* @param node Target node
+3
View File
@@ -29,6 +29,7 @@ export type HydratedChannel = {
defaultPermissions?: { a: bigint; d: bigint };
rolePermissions?: Record<string, { a: bigint; d: bigint }>;
nsfw: boolean;
slowmode: number;
lastMessageId?: string;
@@ -46,6 +47,7 @@ export const channelHydration: Hydrate<Merge<APIChannel>, HydratedChannel> = {
default_permissions: "defaultPermissions",
role_permissions: "rolePermissions",
last_message_id: "lastMessageId",
slowmode: "slowmode",
},
functions: {
id: (channel) => channel._id,
@@ -76,6 +78,7 @@ export const channelHydration: Hydrate<Merge<APIChannel>, HydratedChannel> = {
),
nsfw: (channel) => channel.nsfw || false,
lastMessageId: (channel) => channel.last_message_id!,
slowmode: (channel) => channel.slowmode ?? 0,
voice: (channel) =>
!!channel.voice ||
channel.channel_type === "DirectMessage" ||
+2
View File
@@ -67,6 +67,8 @@ export const Permission = {
Masquerade: 2n ** 28n,
/// React to messages with emoji
React: 2n ** 29n,
/// Bypass slowmode
BypassSlowmode: 2n ** 39n,
// * Voice permissions
/// Connect to a voice channel