@ -85,60 +85,65 @@ TelegramMessage := TelegramVideoTitle . "`n" . TelegramBodymessage . "`n" . Vide
StrLenOfMessageAndVideoLinks := StrLen(TelegramVideoTitle) + StrLen(TelegramBodymessage) + StrLen(VideoLinks)
StrLenOfMessageAndVideoLinks := StrLen(TelegramVideoTitle) + StrLen(TelegramBodymessage) + StrLen(VideoLinks)
; DevModeMsgBox(StrLenOfMessageAndVideoLinks)
; If Length of Title, Video Links and Message is less than 1024 characters:
; If Length of Title, Video Links and Message is less than 1024 characters:
; ------------------------------------------------
; ------------------------------------------------
if(StrLenOfMessageAndVideoLinks < 1024) {
if(StrLenOfMessageAndVideoLinks < 1024) {
Status := SendTelegramPhoto(TelegramBotToken, TelegramBotChatID, VideoThumbFilepath, caption := TelegramMessage ) ; you could add more options; compare the Telegram API docs
Message = Sending Post as One Message
SaveOrPostProgress(Message,PostType:="Tooltip,ErrorLoggingTextFile")
; Output returned data to ErrorLog File
Message = API Response:`n%Status%
SaveOrPostProgress(Message:=Message,PostType:=",ErrorLoggingTextFile")
Status := SendTelegramPhoto(TelegramBotToken, TelegramBotChatID, VideoThumbFilepath, caption := TelegramMessage ) ; you could add more options; compare the Telegram API docs
if(InStr(Status, "error_code")){
if(InStr(Status, "error_code")){
Message = Telegram Post Failed Due To An Api Issue. Please See Errorlog For More Info.
Message = Telegram Post Failed Due To An Api Issue. Please See Errorlog For More Info.
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
Message = Telegram API Error:`n %Status%
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
ToolTip
Return
}
}
Message = API Response:`n%Status% ; Output returned data to ErrorLog File
SaveOrPostProgress(Message:=Message,PostType:=",ErrorLoggingTextFile")
}
}
; If Title, Links and Message are longer than 1024, but less than 4096, split into 2 pieces: sendphoto and sendmessage
; If Title, Links and Message are longer than 1024, but less than 4096, split into 2 pieces: sendphoto and sendmessage
; ------------------------------------------------
; ------------------------------------------------
if(StrLenOfMessageAndVideoLinks < 4096){
if(StrLenOfMessageAndVideoLinks < 4096){
Message = Sending Post as Two Messages
SaveOrPostProgress(Message,PostType:="Tooltip,ErrorLoggingTextFile")
; Photo and Video Title go into SendPhoto
; Photo and Video Title go into SendPhoto
TelegramVideoTitle := TelegramVideoTitle . "`n" . VideoLinks
TelegramVideoTitle := TelegramVideoTitle . "`n" . VideoLinks
Status := SendTelegramPhoto(TelegramBotToken, TelegramBotChatID, VideoThumbFilepath, caption := TelegramVideoTitle ) ; you could add more options; compare the Telegram API docs
Status := SendTelegramPhoto(TelegramBotToken, TelegramBotChatID, VideoThumbFilepath, caption := TelegramVideoTitle ) ; you could add more options; compare the Telegram API docs
if(InStr(Status, "error_code")){
; Output returned data to ErrorLog File
Message = Telegram Post Failed Due To An Api Issue. Please See Errorlog For More Info.
Message = API Response:`n%Status%
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
}
Message = API Response:`n%Status% ; Output returned data to ErrorLog File
SaveOrPostProgress(Message:=Message,PostType:=",ErrorLoggingTextFile")
SaveOrPostProgress(Message:=Message,PostType:=",ErrorLoggingTextFile")
; Video Description goes into TelegramMessage
; Video Description goes into TelegramMessage
Status := SendTelegramMessage(TelegramBotToken, TelegramBotChatID, text := TelegramBodymessage)
Status := SendTelegramMessage(TelegramBotToken, TelegramBotChatID, text := TelegramBodymessage)
if(InStr(Status, "error_code")){
; Output returned data to ErrorLog File
Message = Telegram Post Failed Due To An Api Issue. Please See Errorlog For More Info.
Message = API Response:`n%Status%
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
}
Message = API Response:`n%Status% ; Output returned data to ErrorLog File
SaveOrPostProgress(Message:=Message,PostType:=",ErrorLoggingTextFile")
SaveOrPostProgress(Message:=Message,PostType:=",ErrorLoggingTextFile")
}
}
else, {
else, {
; If Title, links and message are longer than 4096 chars, we need to split them into multiple messages
; If Title, links and message are longer than 4096 chars, we need to split them into multiple messages
; ------------------------------------------------
; ------------------------------------------------
Message = Sending Post as Multiple Messages
SaveOrPostProgress(Message,PostType:="Tooltip,ErrorLoggingTextFile")
TelegramVideoTitle := TelegramVideoTitle . "`n" . VideoLinks
TelegramVideoTitle := TelegramVideoTitle . "`n" . VideoLinks
Status := SendTelegramPhoto(TelegramBotToken, TelegramBotChatID, VideoThumbFilepath, caption := TelegramVideoTitle ) ; you could add more options; compare the Telegram API docs
Status := SendTelegramPhoto(TelegramBotToken, TelegramBotChatID, VideoThumbFilepath, caption := TelegramVideoTitle ) ; you could add more options; compare the Telegram API docs
if(InStr(Status, "error_code")){
Message = Telegram Post Failed Due To An Api Issue. Please See Errorlog For More Info.
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
}
Message = API Response:`n%Status% ; Output returned data to ErrorLog File
Message = API Response:`n%Status% ; Output returned data to ErrorLog File
SaveOrPostProgress(Message:=Message,PostType:=",ErrorLoggingTextFile")
SaveOrPostProgress(Message:=Message,PostType:=",ErrorLoggingTextFile")
; Split the Description into 4096 character chunks while preserving sentences
; Split the Description into 4096 character chunks while preserving sentences
; Used 4095 because a ". " has to be put in at the end of the chunk.
; Used 4095 because a ". " has to be put in at the end of the chunk.
VideoDescriptionChunks := SplitStringWithSentences(TelegramBodymessage, 4094)
VideoDescriptionChunks := SplitStringWithSentences(TelegramBodymessage, 4094)
@ -151,8 +156,11 @@ else, {
Status := SendTelegramMessage(TelegramBotToken, TelegramBotChatID, text := Description)
Status := SendTelegramMessage(TelegramBotToken, TelegramBotChatID, text := Description)
; Output returned data to ErrorLog File
if(InStr(Status, "error_code")){
Message = Telegram API Response:`n%Status%
Message = Telegram Post Failed Due To An Api Issue. Please See Errorlog For More Info.
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
}
Message = API Response:`n%Status% ; Output returned data to ErrorLog File
SaveOrPostProgress(Message:=Message,PostType:=",ErrorLoggingTextFile")
SaveOrPostProgress(Message:=Message,PostType:=",ErrorLoggingTextFile")
}
}
}
}