@ -56,24 +56,19 @@ VideoLinks .= "[Odysee](" . OdyseeVideoURL . ") \| "
if(OdyseeAudioURL != "")
if(OdyseeAudioURL != "")
VideoLinks .= "[Odysee \(Audio\)](" . OdyseeAudioURL . ") \| "
VideoLinks .= "[Odysee \(Audio\)](" . OdyseeAudioURL . ") \| "
/*
if(OdyseeVideoURL != "")
VideoLinks .= "[Odysee](" . OdyseeVideoURL . ") \| "
if(OdyseeAudioURL != "")
VideoLinks .= "[Odysee Audio](" . OdyseeAudioURL . ") \| "
*/
if(RumbleURL != "")
if(RumbleURL != "")
VideoLinks .= "[Rumble](" . RumbleURL . ") \| "
VideoLinks .= "[Rumble](" . RumbleURL . ") \| "
/*
if(InStr(StreamanityURL, "https://streamanity.com/video/"))
VideoLinks .= "[Streamanity](" . StreamanityURL . ") \| "
*/
if(DailyMotionURL != "")
if(DailyMotionURL != "")
VideoLinks .= "[DailyMotion](" . DailyMotionURL . ") \| "
VideoLinks .= "[DailyMotion](" . DailyMotionURL . ") \| "
if(PodcastTranscriptURL != "")
VideoLinks .= "[Video Transcript](" . PodcastTranscriptURL . ") \| "
if(PodcastNumber != "")
VideoLinks .= "[FDRPodcasts](" . "https://fdrpodcasts.com/" . PodcastNumber . ") \| "
TelegramMessage := TelegramVideoTitle . "`n" . TelegramBodymessage . "`n" . VideoLinks
TelegramMessage := TelegramVideoTitle . "`n" . TelegramBodymessage . "`n" . VideoLinks
@ -83,86 +78,73 @@ StrLenOfMessageAndVideoLinks := StrLen(TelegramVideoTitle) + StrLen(TelegramBody
; DevModeMsgBox(StrLenOfMessageAndVideoLinks)
; DevModeMsgBox(StrLenOfMessageAndVideoLinks)
if(StrLenOfMessageAndVideoLinks > 1024){
; If Length of Title, Video Links and Message is less than 1024 characters:
; Telegram SendMessage is limited to 4096 characters
; ------------------------------------------------
if(StrLenOfMessageAndVideoLinks < 4096){ ; split into sendphoto and 1 sendmessage
if(StrLenOfMessageAndVideoLinks < 1024) {
; DevModeMsgBox("Less than 4096 chars")
Status := SendTelegramPhoto(TelegramBotToken, TelegramBotChatID, VideoThumbFilepath, caption := TelegramMessage ) ; you could add more options; compare the Telegram API docs
; Photo and Video Title go into SendPhoto
if(InStr(Status, "error_code")){
TelegramVideoTitle := TelegramVideoTitle . "`n" . VideoLinks
Message = Telegram Post Failed due to an API Issue. Error was saved to ErrorLogging file. Please send it to Yuriy.
Status := SendTelegramPhoto(TelegramBotToken, TelegramBotChatID, VideoThumbFilepath, caption := TelegramVideoTitle ) ; you could add more options; compare the Telegram API docs
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
; Video Description goes into TelegramMessage
; SaveOrPostProgress(Message:=Status,PostType:=",ErrorLoggingTextFile")
Status2 := SendTelegramMessage(TelegramBotToken, TelegramBotChatID, text := TelegramBodymessage)
Message = Telegram Error: %Status%
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
} ; split into 2 SendMessages
ToolTip
else if (StrLenOfMessageAndVideoLinks > 4096 AND StrLenOfMessageAndVideoLinks < 8192){ ; Split into 2 parts
Return
TelegramVideoTitle := TelegramVideoTitle . "`n" . VideoLinks
}
Status := SendTelegramPhoto(TelegramBotToken, TelegramBotChatID, VideoThumbFilepath, caption := TelegramVideoTitle ) ; you could add more options; compare the Telegram API docs
}
TelegramBodymessagePiece := SubStr(TelegramBodymessage, 1, 4096)
Status2 := SendTelegramMessage(TelegramBotToken, TelegramBotChatID, text := TelegramBodymessagePiece)
TelegramBodymessagePiece := SubStr(TelegramBodymessage, 4097, 8192)
; If Title, Links and Message are longer than 1024, but less than 4096, split into 2 pieces: sendphoto and sendmessage
Status3 := SendTelegramMessage(TelegramBotToken, TelegramBotChatID, text := TelegramBodymessagePiece)
; ------------------------------------------------
if(StrLenOfMessageAndVideoLinks < 4096){
} ; split into 3 sendMessages
; Photo and Video Title go into SendPhoto
else if (StrLenOfMessageAndVideoLinks > 8192 AND StrLenOfMessageAndVideoLinks < 12288){ ; Split into 3 parts
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
TelegramBodymessagePiece := SubStr(TelegramBodymessage, 1, 4096)
; Video Description goes into TelegramMessage
msgbox % StrLen(TelegramBodymessagePiece)
Status2 := SendTelegramMessage(TelegramBotToken, TelegramBotChatID, text := TelegramBodymessage)
Status2 := SendTelegramMessage(TelegramBotToken, TelegramBotChatID, text := TelegramBodymessagePiece)
TelegramBodymessagePiece := SubStr(TelegramBodymessage, 4097, 8192)
} else, {
msgbox % StrLen(TelegramBodymessagePiece)
; If Title, links and message are longer than 4096 chars, we need to split them into multiple messages
DevModeMsgBox(TelegramBodymessagePiece)
; ------------------------------------------------
Status3 := SendTelegramMessage(TelegramBotToken, TelegramBotChatID, text := TelegramBodymessagePiece)
TelegramVideoTitle := TelegramVideoTitle . "`n" . VideoLinks
Status := SendTelegramPhoto(TelegramBotToken, TelegramBotChatID, VideoThumbFilepath, caption := TelegramVideoTitle ) ; you could add more options; compare the Telegram API docs
; TelegramBodymessagePiece := SubStr(TelegramBodymessage, 8193, 12288)
; Status3 := SendTelegramMessage(TelegramBotToken, TelegramBotChatID, text := TelegramBodymessagePiece)
}
; 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.
VideoDescriptionChunks := SplitStringWithSentences(TelegramBodymessage, 4094)
} else, { ; if less than 1024 characters, send normally
Status := SendTelegramPhoto(TelegramBotToken, TelegramBotChatID, VideoThumbFilepath, caption := TelegramMessage ) ; you could add more options; compare the Telegram API docs
if(InStr(Status, "error_code")){
Message = Telegram Post Failed due to an API Issue. Error was saved to ErrorLogging file. Please send it to Yuriy.
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
; SaveOrPostProgress(Message:=Status,PostType:=",ErrorLoggingTextFile")
; go through array and post each chunk as new message
Message = Telegram Error: %Status%
Loop % VideoDescriptionChunks.Length(){
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
; ArrayItem := ARRAY[A_Index]
Description := VideoDescriptionChunks[A_Index]
ToolTip
Return
}
}
SendTelegramMessage(TelegramBotToken, TelegramBotChatID, text := Description)
; Msgbox % "SizeOfCaption: " SizeOfCaption
; Clipboard := Description
; SizeOfCaption := SizeOfCaption +
; msgbox % Description
; Message .= VideoLinks
; msgbox % StrLen(VideoLinks)
; Message := StrReplace(Message, "`n", LineBreakChar) ; replace all new line characters with the global charater
}
; msgbox % StrLen(Message)
; SaveOrPostProgress(Message:=Message,PostType:="ErrorLoggingTextFile,DiscordVideos")
}
; SaveOrPostProgress(Message:="Video Links posted to #Videos Successfully.",PostType:="Tooltip,ErrorLoggingTextFile")
; SaveOrPostProgress(Message:="Video Links posted to #Videos Successfully.",PostType:="Tooltip,ErrorLoggingTextFile")
Message = Video Links Posted to Telegram Successfully
Message = Video Links Posted to Telegram Successfully
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
GuiControl,, PostToTelegramButton, Telegram - Posted Successfully
GuiControl,, PostToTelegramButton, Telegram - Posted Successfully
; sleep, 2000
; sleep, 2000
ToolTip
ToolTip
CurrentSite :=
CurrentSite :=
Return
Return
; -------------------------------/Telegram-------------------------------
; -------------------------------/Telegram-------------------------------