Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/classes/Channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions src/hydration/channel.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { ReactiveMap } from "@solid-primitives/map";

Check warning on line 1 in src/hydration/channel.ts

View workflow job for this annotation

GitHub Actions / build

'ReactiveMap' is defined but never used. Allowed unused vars must match /^_/u
import { ReactiveSet } from "@solid-primitives/set";
import type { Channel as APIChannel } from "stoat-api";

import type { Client } from "../Client.js";
import { File } from "../classes/File.js";
import { VoiceParticipant } from "../classes/VoiceParticipant.js";

Check warning on line 7 in src/hydration/channel.ts

View workflow job for this annotation

GitHub Actions / build

'VoiceParticipant' is defined but never used. Allowed unused vars must match /^_/u
import type { Merge } from "../lib/merge.js";

import type { Hydrate } from "./index.js";
Expand All @@ -29,6 +29,7 @@
defaultPermissions?: { a: bigint; d: bigint };
rolePermissions?: Record<string, { a: bigint; d: bigint }>;
nsfw: boolean;
slowmode: number;

lastMessageId?: string;

Expand All @@ -46,6 +47,7 @@
default_permissions: "defaultPermissions",
role_permissions: "rolePermissions",
last_message_id: "lastMessageId",
slowmode: "slowmode",
},
functions: {
id: (channel) => channel._id,
Expand Down Expand Up @@ -76,6 +78,7 @@
),
nsfw: (channel) => channel.nsfw || false,
lastMessageId: (channel) => channel.last_message_id!,
slowmode: (channel) => channel.slowmode ?? 0,
voice: (channel) =>
!!channel.voice ||
channel.channel_type === "DirectMessage" ||
Expand Down
2 changes: 2 additions & 0 deletions src/permissions/definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading