mirror of
https://github.com/Bayselonarrend/OpenIntegrations.git
synced 2025-06-10 23:57:41 +02:00
Дополнение словаря и перевод
This commit is contained in:
parent
dd77b80f55
commit
d09d8db5fa
File diff suppressed because it is too large
Load Diff
@ -400,6 +400,9 @@ EndFunction
|
|||||||
// Send media group
|
// Send media group
|
||||||
// Sends a set of files to a chat or channel. Media types: audio, document, photo, video
|
// Sends a set of files to a chat or channel. Media types: audio, document, photo, video
|
||||||
//
|
//
|
||||||
|
// Note
|
||||||
|
// Map: Key - File, Value - media type
|
||||||
|
//
|
||||||
// Parameters:
|
// Parameters:
|
||||||
// Token - String - Bot token - token
|
// Token - String - Bot token - token
|
||||||
// ChatID - String, Number - Target chat ID or ChatID*TopicID - chat
|
// ChatID - String, Number - Target chat ID or ChatID*TopicID - chat
|
||||||
@ -431,19 +434,18 @@ Function SendMediaGroup(Val Token
|
|||||||
OPI_Tools.ReplaceSpecialCharacters(Text, Markup);
|
OPI_Tools.ReplaceSpecialCharacters(Text, Markup);
|
||||||
|
|
||||||
URL = "api.telegram.org/bot" + Token + "/sendMediaGroup";
|
URL = "api.telegram.org/bot" + Token + "/sendMediaGroup";
|
||||||
FileStructure = New Structure;
|
|
||||||
Media = New Array;
|
Media = New Array;
|
||||||
Parameters = New Structure;
|
Parameters = New Structure;
|
||||||
|
|
||||||
AddChatIdentifier(ChatID, Parameters);
|
AddChatIdentifier(ChatID, Parameters);
|
||||||
FormMediaArray(FileMapping, Text, FileStructure, Media);
|
ConvertFilesToMedia(FileMapping, Text, Media);
|
||||||
|
|
||||||
OPI_Tools.AddField("parse_mode" , Markup , String_ , Parameters);
|
OPI_Tools.AddField("parse_mode" , Markup , String_ , Parameters);
|
||||||
OPI_Tools.AddField("caption" , Text , String_ , Parameters);
|
OPI_Tools.AddField("caption" , Text , String_ , Parameters);
|
||||||
OPI_Tools.AddField("media" , Media , String_ , Parameters);
|
OPI_Tools.AddField("media" , Media , String_ , Parameters);
|
||||||
OPI_Tools.AddField("reply_markup", Keyboard, "FileString", Parameters);
|
OPI_Tools.AddField("reply_markup", Keyboard, "FileString", Parameters);
|
||||||
|
|
||||||
Response = OPI_Tools.PostMultipart(URL, Parameters, FileStructure, "mixed");
|
Response = OPI_Tools.PostMultipart(URL, Parameters, FileMapping, "mixed");
|
||||||
|
|
||||||
Return Response;
|
Return Response;
|
||||||
|
|
||||||
@ -1060,10 +1062,15 @@ Function SendFile(Val Token
|
|||||||
Method = "";
|
Method = "";
|
||||||
|
|
||||||
DetermineSendMethod(View, Method, Extension);
|
DetermineSendMethod(View, Method, Extension);
|
||||||
ConvertFileData(File, Extension, View);
|
|
||||||
OPI_Tools.ReplaceSpecialCharacters(Text, Markup);
|
OPI_Tools.ReplaceSpecialCharacters(Text, Markup);
|
||||||
|
|
||||||
FileName = ?(ValueIsFilled(FileName), View + "|" + FileName, View + Extension);
|
If Not ValueIsFilled(FileName) Then
|
||||||
|
FileName = ConvertFileData(File, View, "");
|
||||||
|
Else
|
||||||
|
OPI_TypeConversion.GetBinaryData(File);
|
||||||
|
EndIf;
|
||||||
|
|
||||||
|
FileName = View + "|" + FileName;
|
||||||
|
|
||||||
Parameters = New Structure;
|
Parameters = New Structure;
|
||||||
OPI_Tools.AddField("parse_mode" , Markup , "String" , Parameters);
|
OPI_Tools.AddField("parse_mode" , Markup , "String" , Parameters);
|
||||||
@ -1102,8 +1109,7 @@ Function ForumTopicManagement(Val Token
|
|||||||
Else
|
Else
|
||||||
Method = "/createForumTopic";
|
Method = "/createForumTopic";
|
||||||
EndIf;
|
EndIf;
|
||||||
|
|
||||||
OPI_Tools.RemoveEmptyCollectionFields(Parameters);
|
|
||||||
Response = OPI_Tools.Get("api.telegram.org/bot" + Token + Method, Parameters);
|
Response = OPI_Tools.Get("api.telegram.org/bot" + Token + Method, Parameters);
|
||||||
|
|
||||||
Return Response;
|
Return Response;
|
||||||
@ -1205,9 +1211,7 @@ Function CreateLongKeyboard(Val ButtonArray)
|
|||||||
|
|
||||||
EndFunction
|
EndFunction
|
||||||
|
|
||||||
Procedure FormMediaArray(Val FileMapping, Val Text, FileStructure, Media)
|
Procedure ConvertFilesToMedia(FileMapping, Text, Media)
|
||||||
|
|
||||||
Counter = 0;
|
|
||||||
|
|
||||||
OPI_TypeConversion.GetCollection(FileMapping);
|
OPI_TypeConversion.GetCollection(FileMapping);
|
||||||
OPI_TypeConversion.GetLine(Text);
|
OPI_TypeConversion.GetLine(Text);
|
||||||
@ -1216,44 +1220,36 @@ Procedure FormMediaArray(Val FileMapping, Val Text, FileStructure, Media)
|
|||||||
Raise("Failed to Retrieve Information from JSON media!");
|
Raise("Failed to Retrieve Information from JSON media!");
|
||||||
Return;
|
Return;
|
||||||
EndIf;
|
EndIf;
|
||||||
|
|
||||||
For Each CurrentFile In FileMapping Do
|
TempMap = New Map;
|
||||||
|
Counter = 0;
|
||||||
If Not TypeOf(CurrentFile.Key) = Type("BinaryData") Then
|
|
||||||
|
For Each CurrentFile In FileMapping Do
|
||||||
Binary = CurrentFile.Key;
|
|
||||||
OPI_TypeConversion.GetBinaryData(Binary);
|
CurrentData = CurrentFile.Key;
|
||||||
|
TypeOfMedia = CurrentFile.Value;
|
||||||
ThisFile = New File(CurrentFile.Key);
|
Extension = "";
|
||||||
MediaName = CurrentFile.Value
|
|
||||||
+ String(Counter)
|
MediaName = ConvertFileData(CurrentData, TypeOfMedia, Counter);
|
||||||
+ ?(CurrentFile.Value = "document", ThisFile.Extension, "");
|
|
||||||
|
TempMap.Insert(MediaName + "|" + MediaName, CurrentData);
|
||||||
FullMediaName = StrReplace(MediaName, ".", "___");
|
|
||||||
|
MediaStructure = New Structure;
|
||||||
Else
|
MediaStructure.Insert("type" , TypeOfMedia);
|
||||||
Binary = CurrentFile.Key;
|
MediaStructure.Insert("media", "attach://" + MediaName);
|
||||||
MediaName = CurrentFile.Value + String(Counter);
|
|
||||||
FullMediaName = MediaName;
|
If Counter = 0 Then
|
||||||
EndIf;
|
MediaStructure.Insert("caption", Text);
|
||||||
|
EndIf;
|
||||||
FileStructure.Insert(FullMediaName, Binary);
|
|
||||||
|
Media.Add(MediaStructure);
|
||||||
MediaStructure = New Structure;
|
|
||||||
MediaStructure.Insert("type" , CurrentFile.Value);
|
Counter = Counter + 1;
|
||||||
MediaStructure.Insert("media", "attach://" + MediaName);
|
|
||||||
|
EndDo;
|
||||||
If Counter = 0 Then
|
|
||||||
MediaStructure.Insert("caption", Text);
|
|
||||||
EndIf;
|
|
||||||
|
|
||||||
Media.Add(MediaStructure);
|
|
||||||
|
|
||||||
Counter = Counter + 1;
|
|
||||||
|
|
||||||
EndDo;
|
|
||||||
|
|
||||||
Media = OPI_Tools.JSONString(Media);
|
Media = OPI_Tools.JSONString(Media);
|
||||||
|
FileMapping = TempMap;
|
||||||
|
|
||||||
EndProcedure
|
EndProcedure
|
||||||
|
|
||||||
@ -1294,18 +1290,25 @@ Procedure DetermineSendMethod(Val View, Method, Extension)
|
|||||||
|
|
||||||
EndProcedure
|
EndProcedure
|
||||||
|
|
||||||
Procedure ConvertFileData(File, Extension, View)
|
Function ConvertFileData(File, View, Counter)
|
||||||
|
|
||||||
If Not TypeOf(File) = Type("BinaryData") Then
|
FileName = "";
|
||||||
|
|
||||||
|
If TypeOf(File) = Type("String") And View = "document" Then
|
||||||
|
|
||||||
CurrentFile = New File(File);
|
CurrentFile = New File(File);
|
||||||
Extension = ?(View = "document", CurrentFile.Extension, Extension);
|
FileName = CurrentFile.Name;
|
||||||
OPI_TypeConversion.GetBinaryData(File);
|
|
||||||
|
|
||||||
EndIf;
|
EndIf;
|
||||||
|
|
||||||
Extension = StrReplace(Extension, ".", "___");
|
|
||||||
|
|
||||||
EndProcedure
|
If Not ValueIsFilled(FileName) Then
|
||||||
|
FileName = View + String(Counter);
|
||||||
|
EndIf;
|
||||||
|
|
||||||
|
OPI_TypeConversion.GetBinaryData(File);
|
||||||
|
|
||||||
|
Return FileName;
|
||||||
|
|
||||||
|
EndFunction
|
||||||
|
|
||||||
#EndRegion
|
#EndRegion
|
||||||
|
@ -1,21 +1,21 @@
|
|||||||
<package-def>
|
<package-def>
|
||||||
<module name="OPI_Cryptography" file="tools/Modules/internal/Modules/OPI_Cryptography.os"/>
|
|
||||||
<module name="OPI_Tools" file="tools/Modules/internal/Modules/OPI_Tools.os"/>
|
|
||||||
<module name="OPI_GoogleDrive" file="core/Modules/OPI_GoogleDrive.os"/>
|
|
||||||
<module name="OPI_Twitter" file="core/Modules/OPI_Twitter.os"/>
|
|
||||||
<module name="OPI_YandexID" file="core/Modules/OPI_YandexID.os"/>
|
|
||||||
<module name="OPI_Dropbox" file="core/Modules/OPI_Dropbox.os"/>
|
|
||||||
<module name="OPI_GoogleWorkspace" file="core/Modules/OPI_GoogleWorkspace.os"/>
|
|
||||||
<module name="OPI_Bitrix24" file="core/Modules/OPI_Bitrix24.os"/>
|
|
||||||
<module name="OPI_Viber" file="core/Modules/OPI_Viber.os"/>
|
|
||||||
<module name="OPI_GoogleCalendar" file="core/Modules/OPI_GoogleCalendar.os"/>
|
|
||||||
<module name="OPI_Telegram" file="core/Modules/OPI_Telegram.os"/>
|
|
||||||
<module name="OPI_Airtable" file="core/Modules/OPI_Airtable.os"/>
|
<module name="OPI_Airtable" file="core/Modules/OPI_Airtable.os"/>
|
||||||
<module name="OPI_Slack" file="core/Modules/OPI_Slack.os"/>
|
<module name="OPI_Bitrix24" file="core/Modules/OPI_Bitrix24.os"/>
|
||||||
<module name="OPI_Notion" file="core/Modules/OPI_Notion.os"/>
|
<module name="OPI_Dropbox" file="core/Modules/OPI_Dropbox.os"/>
|
||||||
|
<module name="OPI_GoogleCalendar" file="core/Modules/OPI_GoogleCalendar.os"/>
|
||||||
|
<module name="OPI_GoogleDrive" file="core/Modules/OPI_GoogleDrive.os"/>
|
||||||
<module name="OPI_GoogleSheets" file="core/Modules/OPI_GoogleSheets.os"/>
|
<module name="OPI_GoogleSheets" file="core/Modules/OPI_GoogleSheets.os"/>
|
||||||
<module name="OPI_YandexDisk" file="core/Modules/OPI_YandexDisk.os"/>
|
<module name="OPI_GoogleWorkspace" file="core/Modules/OPI_GoogleWorkspace.os"/>
|
||||||
<module name="OPI_TypeConversion" file="tools/Modules/OPI_TypeConversion.os"/>
|
<module name="OPI_Notion" file="core/Modules/OPI_Notion.os"/>
|
||||||
|
<module name="OPI_Slack" file="core/Modules/OPI_Slack.os"/>
|
||||||
|
<module name="OPI_Telegram" file="core/Modules/OPI_Telegram.os"/>
|
||||||
|
<module name="OPI_Twitter" file="core/Modules/OPI_Twitter.os"/>
|
||||||
|
<module name="OPI_Viber" file="core/Modules/OPI_Viber.os"/>
|
||||||
<module name="OPI_VK" file="core/Modules/OPI_VK.os"/>
|
<module name="OPI_VK" file="core/Modules/OPI_VK.os"/>
|
||||||
|
<module name="OPI_YandexDisk" file="core/Modules/OPI_YandexDisk.os"/>
|
||||||
|
<module name="OPI_YandexID" file="core/Modules/OPI_YandexID.os"/>
|
||||||
|
<module name="OPI_Tools" file="tools/Modules/internal/Modules/OPI_Tools.os"/>
|
||||||
|
<module name="OPI_Cryptography" file="tools/Modules/internal/Modules/OPI_Cryptography.os"/>
|
||||||
<module name="OPI_TestDataRetrieval" file="tools/Modules/OPI_TestDataRetrieval.os"/>
|
<module name="OPI_TestDataRetrieval" file="tools/Modules/OPI_TestDataRetrieval.os"/>
|
||||||
|
<module name="OPI_TypeConversion" file="tools/Modules/OPI_TypeConversion.os"/>
|
||||||
</package-def>
|
</package-def>
|
||||||
|
@ -185,6 +185,7 @@ Procedure TelegramAPI_SendMediaGroup() Export
|
|||||||
OPI_TestDataRetrieval.ParameterToCollection("String" , TestParameters);
|
OPI_TestDataRetrieval.ParameterToCollection("String" , TestParameters);
|
||||||
OPI_TestDataRetrieval.ParameterToCollection("Picture" , TestParameters);
|
OPI_TestDataRetrieval.ParameterToCollection("Picture" , TestParameters);
|
||||||
OPI_TestDataRetrieval.ParameterToCollection("Video" , TestParameters);
|
OPI_TestDataRetrieval.ParameterToCollection("Video" , TestParameters);
|
||||||
|
OPI_TestDataRetrieval.ParameterToCollection("Document" , TestParameters);
|
||||||
|
|
||||||
Telegram_SendMediaGroup(TestParameters);
|
Telegram_SendMediaGroup(TestParameters);
|
||||||
|
|
||||||
@ -4143,10 +4144,27 @@ Procedure Telegram_SendMediaGroup(FunctionParameters)
|
|||||||
|
|
||||||
OPI_TestDataRetrieval.WriteLog(Result, "SendMediaGroup", "Telegram");
|
OPI_TestDataRetrieval.WriteLog(Result, "SendMediaGroup", "Telegram");
|
||||||
|
|
||||||
Check_TelegramMediaGroup(Result);
|
Check_TelegramMediaGroup(Result);
|
||||||
|
|
||||||
|
DocumentURL = FunctionParameters["Document"];
|
||||||
|
DocumentPath = GetTempFileName("docx");
|
||||||
|
ChannelID = FunctionParameters["Telegram_ChannelID"];
|
||||||
|
|
||||||
|
CopyFile(DocumentURL, DocumentPath);
|
||||||
|
|
||||||
|
MediaGroup = New Map;
|
||||||
|
MediaGroup.Insert(DocumentURL , "document");
|
||||||
|
MediaGroup.Insert(DocumentPath, "document");
|
||||||
|
|
||||||
|
Result = OPI_Telegram.SendMediaGroup(Token, ChannelID, Text, MediaGroup);
|
||||||
|
|
||||||
|
OPI_TestDataRetrieval.WriteLog(Result, "SendMediaGroup (docs)", "Telegram");
|
||||||
|
|
||||||
|
Check_TelegramMediaGroup(Result);
|
||||||
|
|
||||||
DeleteFiles(VideoPath);
|
DeleteFiles(VideoPath);
|
||||||
DeleteFiles(ImagePath);
|
DeleteFiles(ImagePath);
|
||||||
|
DeleteFiles(DocumentPath);
|
||||||
|
|
||||||
OPI_Tools.Pause(5);
|
OPI_Tools.Pause(5);
|
||||||
|
|
||||||
|
@ -400,6 +400,9 @@ EndFunction
|
|||||||
// Send media group
|
// Send media group
|
||||||
// Sends a set of files to a chat or channel. Media types: audio, document, photo, video
|
// Sends a set of files to a chat or channel. Media types: audio, document, photo, video
|
||||||
//
|
//
|
||||||
|
// Note
|
||||||
|
// Map: Key - File, Value - media type
|
||||||
|
//
|
||||||
// Parameters:
|
// Parameters:
|
||||||
// Token - String - Bot token - token
|
// Token - String - Bot token - token
|
||||||
// ChatID - String, Number - Target chat ID or ChatID*TopicID - chat
|
// ChatID - String, Number - Target chat ID or ChatID*TopicID - chat
|
||||||
@ -431,19 +434,18 @@ Function SendMediaGroup(Val Token
|
|||||||
OPI_Tools.ReplaceSpecialCharacters(Text, Markup);
|
OPI_Tools.ReplaceSpecialCharacters(Text, Markup);
|
||||||
|
|
||||||
URL = "api.telegram.org/bot" + Token + "/sendMediaGroup";
|
URL = "api.telegram.org/bot" + Token + "/sendMediaGroup";
|
||||||
FileStructure = New Structure;
|
|
||||||
Media = New Array;
|
Media = New Array;
|
||||||
Parameters = New Structure;
|
Parameters = New Structure;
|
||||||
|
|
||||||
AddChatIdentifier(ChatID, Parameters);
|
AddChatIdentifier(ChatID, Parameters);
|
||||||
FormMediaArray(FileMapping, Text, FileStructure, Media);
|
ConvertFilesToMedia(FileMapping, Text, Media);
|
||||||
|
|
||||||
OPI_Tools.AddField("parse_mode" , Markup , String_ , Parameters);
|
OPI_Tools.AddField("parse_mode" , Markup , String_ , Parameters);
|
||||||
OPI_Tools.AddField("caption" , Text , String_ , Parameters);
|
OPI_Tools.AddField("caption" , Text , String_ , Parameters);
|
||||||
OPI_Tools.AddField("media" , Media , String_ , Parameters);
|
OPI_Tools.AddField("media" , Media , String_ , Parameters);
|
||||||
OPI_Tools.AddField("reply_markup", Keyboard, "FileString", Parameters);
|
OPI_Tools.AddField("reply_markup", Keyboard, "FileString", Parameters);
|
||||||
|
|
||||||
Response = OPI_Tools.PostMultipart(URL, Parameters, FileStructure, "mixed");
|
Response = OPI_Tools.PostMultipart(URL, Parameters, FileMapping, "mixed");
|
||||||
|
|
||||||
Return Response;
|
Return Response;
|
||||||
|
|
||||||
@ -1060,10 +1062,15 @@ Function SendFile(Val Token
|
|||||||
Method = "";
|
Method = "";
|
||||||
|
|
||||||
DetermineSendMethod(View, Method, Extension);
|
DetermineSendMethod(View, Method, Extension);
|
||||||
ConvertFileData(File, Extension, View);
|
|
||||||
OPI_Tools.ReplaceSpecialCharacters(Text, Markup);
|
OPI_Tools.ReplaceSpecialCharacters(Text, Markup);
|
||||||
|
|
||||||
FileName = ?(ValueIsFilled(FileName), View + "|" + FileName, View + Extension);
|
If Not ValueIsFilled(FileName) Then
|
||||||
|
FileName = ConvertFileData(File, View, "");
|
||||||
|
Else
|
||||||
|
OPI_TypeConversion.GetBinaryData(File);
|
||||||
|
EndIf;
|
||||||
|
|
||||||
|
FileName = View + "|" + FileName;
|
||||||
|
|
||||||
Parameters = New Structure;
|
Parameters = New Structure;
|
||||||
OPI_Tools.AddField("parse_mode" , Markup , "String" , Parameters);
|
OPI_Tools.AddField("parse_mode" , Markup , "String" , Parameters);
|
||||||
@ -1102,8 +1109,7 @@ Function ForumTopicManagement(Val Token
|
|||||||
Else
|
Else
|
||||||
Method = "/createForumTopic";
|
Method = "/createForumTopic";
|
||||||
EndIf;
|
EndIf;
|
||||||
|
|
||||||
OPI_Tools.RemoveEmptyCollectionFields(Parameters);
|
|
||||||
Response = OPI_Tools.Get("api.telegram.org/bot" + Token + Method, Parameters);
|
Response = OPI_Tools.Get("api.telegram.org/bot" + Token + Method, Parameters);
|
||||||
|
|
||||||
Return Response;
|
Return Response;
|
||||||
@ -1205,9 +1211,7 @@ Function CreateLongKeyboard(Val ButtonArray)
|
|||||||
|
|
||||||
EndFunction
|
EndFunction
|
||||||
|
|
||||||
Procedure FormMediaArray(Val FileMapping, Val Text, FileStructure, Media)
|
Procedure ConvertFilesToMedia(FileMapping, Text, Media)
|
||||||
|
|
||||||
Counter = 0;
|
|
||||||
|
|
||||||
OPI_TypeConversion.GetCollection(FileMapping);
|
OPI_TypeConversion.GetCollection(FileMapping);
|
||||||
OPI_TypeConversion.GetLine(Text);
|
OPI_TypeConversion.GetLine(Text);
|
||||||
@ -1216,44 +1220,36 @@ Procedure FormMediaArray(Val FileMapping, Val Text, FileStructure, Media)
|
|||||||
// !OInt RaiseException("Failed to get information from json media!");
|
// !OInt RaiseException("Failed to get information from json media!");
|
||||||
Return;
|
Return;
|
||||||
EndIf;
|
EndIf;
|
||||||
|
|
||||||
For Each CurrentFile In FileMapping Do
|
TempMap = New Map;
|
||||||
|
Counter = 0;
|
||||||
If Not TypeOf(CurrentFile.Key) = Type("BinaryData") Then
|
|
||||||
|
For Each CurrentFile In FileMapping Do
|
||||||
Binary = CurrentFile.Key;
|
|
||||||
OPI_TypeConversion.GetBinaryData(Binary);
|
CurrentData = CurrentFile.Key;
|
||||||
|
TypeOfMedia = CurrentFile.Value;
|
||||||
ThisFile = New File(CurrentFile.Key);
|
Extension = "";
|
||||||
MediaName = CurrentFile.Value
|
|
||||||
+ String(Counter)
|
MediaName = ConvertFileData(CurrentData, TypeOfMedia, Counter);
|
||||||
+ ?(CurrentFile.Value = "document", ThisFile.Extension, "");
|
|
||||||
|
TempMap.Insert(MediaName + "|" + MediaName, CurrentData);
|
||||||
FullMediaName = StrReplace(MediaName, ".", "___");
|
|
||||||
|
MediaStructure = New Structure;
|
||||||
Else
|
MediaStructure.Insert("type" , TypeOfMedia);
|
||||||
Binary = CurrentFile.Key;
|
MediaStructure.Insert("media", "attach://" + MediaName);
|
||||||
MediaName = CurrentFile.Value + String(Counter);
|
|
||||||
FullMediaName = MediaName;
|
If Counter = 0 Then
|
||||||
EndIf;
|
MediaStructure.Insert("caption", Text);
|
||||||
|
EndIf;
|
||||||
FileStructure.Insert(FullMediaName, Binary);
|
|
||||||
|
Media.Add(MediaStructure);
|
||||||
MediaStructure = New Structure;
|
|
||||||
MediaStructure.Insert("type" , CurrentFile.Value);
|
Counter = Counter + 1;
|
||||||
MediaStructure.Insert("media", "attach://" + MediaName);
|
|
||||||
|
EndDo;
|
||||||
If Counter = 0 Then
|
|
||||||
MediaStructure.Insert("caption", Text);
|
|
||||||
EndIf;
|
|
||||||
|
|
||||||
Media.Add(MediaStructure);
|
|
||||||
|
|
||||||
Counter = Counter + 1;
|
|
||||||
|
|
||||||
EndDo;
|
|
||||||
|
|
||||||
Media = OPI_Tools.JSONString(Media);
|
Media = OPI_Tools.JSONString(Media);
|
||||||
|
FileMapping = TempMap;
|
||||||
|
|
||||||
EndProcedure
|
EndProcedure
|
||||||
|
|
||||||
@ -1294,18 +1290,25 @@ Procedure DetermineSendMethod(Val View, Method, Extension)
|
|||||||
|
|
||||||
EndProcedure
|
EndProcedure
|
||||||
|
|
||||||
Procedure ConvertFileData(File, Extension, View)
|
Function ConvertFileData(File, View, Counter)
|
||||||
|
|
||||||
If Not TypeOf(File) = Type("BinaryData") Then
|
FileName = "";
|
||||||
|
|
||||||
|
If TypeOf(File) = Type("String") And View = "document" Then
|
||||||
|
|
||||||
CurrentFile = New File(File);
|
CurrentFile = New File(File);
|
||||||
Extension = ?(View = "document", CurrentFile.Extension, Extension);
|
FileName = CurrentFile.Name;
|
||||||
OPI_TypeConversion.GetBinaryData(File);
|
|
||||||
|
|
||||||
EndIf;
|
EndIf;
|
||||||
|
|
||||||
Extension = StrReplace(Extension, ".", "___");
|
|
||||||
|
|
||||||
EndProcedure
|
If Not ValueIsFilled(FileName) Then
|
||||||
|
FileName = View + String(Counter);
|
||||||
|
EndIf;
|
||||||
|
|
||||||
|
OPI_TypeConversion.GetBinaryData(File);
|
||||||
|
|
||||||
|
Return FileName;
|
||||||
|
|
||||||
|
EndFunction
|
||||||
|
|
||||||
#EndRegion
|
#EndRegion
|
||||||
|
@ -185,6 +185,7 @@ Procedure TelegramAPI_SendMediaGroup() Export
|
|||||||
OPI_TestDataRetrieval.ParameterToCollection("String" , TestParameters);
|
OPI_TestDataRetrieval.ParameterToCollection("String" , TestParameters);
|
||||||
OPI_TestDataRetrieval.ParameterToCollection("Picture" , TestParameters);
|
OPI_TestDataRetrieval.ParameterToCollection("Picture" , TestParameters);
|
||||||
OPI_TestDataRetrieval.ParameterToCollection("Video" , TestParameters);
|
OPI_TestDataRetrieval.ParameterToCollection("Video" , TestParameters);
|
||||||
|
OPI_TestDataRetrieval.ParameterToCollection("Document" , TestParameters);
|
||||||
|
|
||||||
Telegram_SendMediaGroup(TestParameters);
|
Telegram_SendMediaGroup(TestParameters);
|
||||||
|
|
||||||
@ -4143,10 +4144,27 @@ Procedure Telegram_SendMediaGroup(FunctionParameters)
|
|||||||
|
|
||||||
// !OInt OPI_TestDataRetrieval.WriteLog(Result, "SendMediaGroup", "Telegram");
|
// !OInt OPI_TestDataRetrieval.WriteLog(Result, "SendMediaGroup", "Telegram");
|
||||||
|
|
||||||
Check_TelegramMediaGroup(Result);
|
Check_TelegramMediaGroup(Result);
|
||||||
|
|
||||||
|
DocumentURL = FunctionParameters["Document"];
|
||||||
|
DocumentPath = GetTempFileName("docx");
|
||||||
|
ChannelID = FunctionParameters["Telegram_ChannelID"];
|
||||||
|
|
||||||
|
FileCopy(DocumentURL, DocumentPath);
|
||||||
|
|
||||||
|
MediaGroup = New Map;
|
||||||
|
MediaGroup.Insert(DocumentURL , "document");
|
||||||
|
MediaGroup.Insert(DocumentPath, "document");
|
||||||
|
|
||||||
|
Result = OPI_Telegram.SendMediaGroup(Token, ChannelID, Text, MediaGroup);
|
||||||
|
|
||||||
|
// !OInt OPI_TestDataRetrieval.WriteLog(Result, "SendMediaGroup (docs)", "Telegram");
|
||||||
|
|
||||||
|
Check_TelegramMediaGroup(Result);
|
||||||
|
|
||||||
DeleteFiles(VideoPath);
|
DeleteFiles(VideoPath);
|
||||||
DeleteFiles(ImagePath);
|
DeleteFiles(ImagePath);
|
||||||
|
DeleteFiles(DocumentPath);
|
||||||
|
|
||||||
OPI_Tools.Pause(5);
|
OPI_Tools.Pause(5);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user