Bots: Support opening URLs from bot responses

This commit is contained in:
Alexander Zinchuk 2021-08-27 21:08:39 +03:00
parent 3f540296e7
commit d76c948b06

View File

@ -243,7 +243,7 @@ async function searchInlineBot({
chatId, chatId,
query, query,
offset, offset,
} : { }: {
username: string; username: string;
inlineBotData: InlineBotSettings; inlineBotData: InlineBotSettings;
chatId: number; chatId: number;
@ -313,15 +313,18 @@ async function answerCallbackButton(chat: ApiChat, messageId: number, data: stri
data, data,
}); });
if (!result || !result.message) { if (!result) {
return; return;
} }
const { message, alert: isError } = result; const { showDialog, showNotification, toggleSafeLinkModal } = getDispatch();
const { message, alert: isError, url } = result;
if (isError) { if (isError) {
getDispatch().showDialog({ data: { message } }); showDialog({ data: { message: message || 'Error' } });
} else { } else if (message) {
getDispatch().showNotification({ message }); showNotification({ message });
} else if (url) {
toggleSafeLinkModal({ url });
} }
} }