
Чт авг 31, 2023 8:09 pm Чт авг 31, 2023 8:09 pm
last error message: Read timeout expired
// -----------------------------------------------------------------------------------
// ver 2.0 / May 25, 2023, (c) Alexey Pikurov, [email protected]
// -----------------------------------------------------------------------------------
function OnPrivateMessage(iCID, iUIN, iUINTo, iMsgType: integer; sMsg: string): boolean;
var
sID, sOutMsg, sNameFrom: string;
begin
result := true;
if not mIsUINOnline(iUINTo) then
begin
// get sender's Telegram ID
sID := mIntegrationTelegramGetUserIDByUIN(iUINTo);
// no errors
if sID[1] <> '-' then
begin
// get MyChat sender's display name
sNameFrom := mGetUserFullNameByPreset(iUIN, 0);
// file or image?
if (iMsgType = 44) or (iMsgType = 45) then
sOutMsg := mExtractExternalWebLinkFromMessage(sMsg, iMsgType)
else
// convert MyChat message to plaint text
sOutMsg := mConvertMsgToPlainText(sMsg, iMsgType);
// add WEB support link and user display name to message
sOutMsg := '<a href="' +
mGetServerExternalAddress(0) +
'/support/?uin=' +
IntToStr(iUIN) +
'&silent">' +
sNameFrom +
'</a>:' +
CRLF +
CRLF +
sOutMsg;
// send message to Telegram
mIntegrationTelegramSendMessage(sID, sOutMsg, 5000);
end;
end;
end;
begin
end.
// -----------------------------------------------------------------------------------
// ver 2.1 / Feb 1, 2021, (c) Alexey Pikurov, [email protected]
// -----------------------------------------------------------------------------------
function OnRequestByREST(sBody, sParams, sHeaders, sURL, sIPv4, sIPv6: string; iType: integer): string;
var
sFirstName, sLastName, sNickName, sTelegramID, sText, sData: string;
iResult, x, iUIN, iUINFrom: integer;
begin
sFirstName := '';
sLastName := '';
sNickName := '';
sTelegramID := '';
sText := '';
// get request data
JSONGetString(sBody, 'message.from.id', sTelegramID);
JSONGetString(sBody, 'message.from.first_name', sFirstName);
JSONGetString(sBody, 'message.from.last_name', sLastName);
JSONGetString(sBody, 'message.from.username', sNickName);
JSONGetString(sBody, 'message.text', sText);
// if user is connecting to the Telegram bot for the first time
if LowerCase(sText) = '/start' then mIntegrationTelegramAddUser(sTelegramID, sFirstName, sLastName, sNickName)
else begin // maybe user send reply message to the bot
iResult := JSONGetString(sBody, 'message.reply_to_message.entities[0].url', sData);
if iResult = 0 then begin
// get receiver's UIN
x := pos('?uin=', sData) + 5;
iUIN := StrToIntDef(copy(sData, x, pos('&', sData) - x), -1);
// get sender's UIN by user Telegram ID
iUINFrom := mIntegrationTelegramGetMyChatUINByTelegramID(sTelegramID);
// if sender and receiver are exists
if (iUIN <> -1) and (iUINFrom > 0) then begin
if Length(sText) > 0 then begin
// multi-line text
sData := '[Telegram] ' + ReplaceString(sText, #10, CRLF, true, false);
// send private message into MyChat
mSendPrivateMessage(iUINFrom, iUIN, sData, 1);
end else begin
JSONSetInteger(sBody, 'UINFrom', iUINFrom);
JSONSetInteger(sBody, 'UINTo', iUIN);
mNodeCommand('GetTelegramAttach', sBody);
end
end;
end;
end;
result := '{}';
end;
begin
end.
Исправлено , скоро будет свежая сборка, сможете о[…]
Пофиксили , в новых версиях всё будет правильно.
Текущие версии MyChat Client умеют переключаться м[…]
MyChat Client [*] (09.05.2025) (win32) прави[…]
Пожалуйста. Прямой линк есть на странице загрузки […]
Он у вас и так есть, возьмите ту дату, когда была […]
Проекты в которых настроен доступ к "своим з[…]
Здравствуйте. Да. Справка, пошаговое руководство[…]
Окей, на скриншоте, что вы показываете — версия 20[…]
Добавили специальную проверку на сервер, если не с[…]
Ну мы не относимся к разряду всемогущих и всезнающ[…]
Всё ок, делайте тему, разберемся. Логи с клиентов […]