filter
constfilter:object
Defined in: sdks/js/agent-sdk/src/core/filter.ts:69
Type guards used by Agent middleware to classify messages and conversations.
Type Declaration
Section titled “Type Declaration”fromSelf
Section titled “fromSelf”fromSelf: <
ContentTypes>(message,client) =>boolean
Return true when a message was sent by the supplied client.
Type Parameters
Section titled “Type Parameters”ContentTypes
Section titled “ContentTypes”ContentTypes
Parameters
Section titled “Parameters”message
Section titled “message”DecodedMessage<ContentTypes>
client
Section titled “client”Client<ContentTypes>
Returns
Section titled “Returns”boolean
hasContent
Section titled “hasContent”hasContent: <
ContentTypes>(message) =>message is DecodedMessageWithContent<ContentTypes>
Return true when a message contains decoded content.
Type Parameters
Section titled “Type Parameters”ContentTypes
Section titled “ContentTypes”ContentTypes
Parameters
Section titled “Parameters”message
Section titled “message”DecodedMessage<ContentTypes>
Returns
Section titled “Returns”message is DecodedMessageWithContent<ContentTypes>
isDM: (
conversation) =>conversation is Dm<unknown>
Return true when a conversation is a direct message.
Parameters
Section titled “Parameters”conversation
Section titled “conversation”Returns
Section titled “Returns”conversation is Dm<unknown>
isGroup
Section titled “isGroup”isGroup: (
conversation) =>conversation is Group<unknown>
Return true when a conversation is a group.
Parameters
Section titled “Parameters”conversation
Section titled “conversation”Returns
Section titled “Returns”conversation is Group<unknown>
isGroupAdmin
Section titled “isGroupAdmin”isGroupAdmin: (
conversation,message) =>boolean
Return true when the message sender is a group admin.
Parameters
Section titled “Parameters”conversation
Section titled “conversation”message
Section titled “message”Returns
Section titled “Returns”boolean
isGroupSuperAdmin
Section titled “isGroupSuperAdmin”isGroupSuperAdmin: (
conversation,message) =>boolean
Return true when the message sender is a group super admin.
Parameters
Section titled “Parameters”conversation
Section titled “conversation”message
Section titled “message”Returns
Section titled “Returns”boolean
usesCodec
Section titled “usesCodec”usesCodec: <
T>(message,codecClass) =>message is DecodedMessageWithContent<ReturnType<T["decode"]>>
Return true when a message uses the supplied codec.
Type Parameters
Section titled “Type Parameters”T extends ContentCodec
Parameters
Section titled “Parameters”message
Section titled “message”codecClass
Section titled “codecClass”() => T
Returns
Section titled “Returns”message is DecodedMessageWithContent<ReturnType<T["decode"]>>

