Skip to main content

delete_chat


name: block-chat-deletion description: chat deletion prevention ---# delete-chat

type DeleteChatCallback = ({ id: TID }) => void;
chat.on("delete-chat", ({ id:TID }) => {
console.log("chat", id, "was deleted");
});

Used to detect when a user deletes a chat. This event is necessary to perform actions such as logging the deletion, updating related UI components, or triggering custom analytics.

detect that user deleted chat

chat.on("delete-chat", ({ id:TID }) => {
console.log("chat", id, "was deleted");
});

Use this event to log the chat deletion or perform any clean-up activities. Handy for maintaining accurate records or triggering further actions upon chat deletion.

block-chat-deletion

type BlockChatDeletionCallback = ({ id: TID }) => boolean;
chat.intercept("delete-chat", ({ id:TID }) => {
return false;
});

Used to block the chat deletion process. Necessary in scenarios where chat deletion needs to be managed or conditioned upon certain criteria, such as user permissions or certain chat statuses.

how to block chat deletion

chat.intercept("delete-chat", ({ id: TID }) => {
return false;
});

Use this event to prevent a chat from being deleted based on custom logic or conditions. This is useful for preserving important conversations or enforcing application-specific policies.