Skip to content

filter

const filter: object

Defined in: sdks/agent/src/core/filter.ts:58

Message and conversation tests for agent middleware.

fromSelf: (message, client) => boolean

Check whether the client sent the message.

Message

Client

boolean

hasContent: (message) => message is DecodedMessageWithContent<unknown>

Check whether the content type is known and has decoded custom content.

Message

message is DecodedMessageWithContent<unknown>

isDM: (conversation) => conversation is Dm

Check whether the conversation is a direct message.

Group | Dm

conversation is Dm

isGroup: (conversation) => conversation is Group

Check whether the conversation is a group.

Group | Dm

conversation is Group

isGroupAdminAsync: (conversation, message) => Promise<boolean>

Await this check before granting group admin access.

Group | Dm

Message

Promise<boolean>

isGroupSuperAdminAsync: (conversation, message) => Promise<boolean>

Await this check before granting group super admin access.

Group | Dm

Message

Promise<boolean>

usesCodec: <T>(message, codecClass) => message is DecodedMessageWithContent<ReturnType<T["decode"]>>

Check the codec authority, type name, and major version.

T extends AnyContentCodec

Message

() => T

message is DecodedMessageWithContent<ReturnType<T["decode"]>>