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