@towns-protocol/react-sdk
Version:
React Hooks for Towns Protocol SDK
31 lines • 1.34 kB
TypeScript
import { Channel } from '@towns-protocol/sdk';
import { type ActionConfig } from './internals/useAction';
/**
* Hook to send a message to a stream. Can be used to send a message to a channel or a dm/group dm.
* @param streamId - The id of the stream to send the message to.
* @param config - Configuration options for the action.
* @returns The sendMessage action and the status of the action.
*/
export declare const useSendMessage: (streamId: string, config?: ActionConfig<Channel["sendMessage"]>) => {
data: {
eventId: string;
} | undefined;
error: Error | undefined;
isPending: boolean;
isSuccess: boolean;
isError: boolean;
/** Sends a message to the stream.
* @param message - The message to send.
* @param options - Additional options for the message.
* @returns The event id of the message.
*/
sendMessage: (message: string, options?: {
threadId?: string;
replyId?: string;
mentions?: import("@towns-protocol/proto").PlainMessage<import("@towns-protocol/proto").ChannelMessage_Post_Mention>[];
attachments?: import("@towns-protocol/proto").PlainMessage<import("@towns-protocol/proto").ChannelMessage_Post_Attachment>[];
} | undefined) => Promise<{
eventId: string;
}>;
};
//# sourceMappingURL=useSendMessage.d.ts.map