minor code clearup and errorlogging additions
This commit is contained in:
@@ -15,38 +15,22 @@ if(TelegramBotToken = "" Or TelegramBotChatID =""){
|
||||
Message = TelegramBotToken or TelegramBotChatID is missing from %SettingsIniFilepath%. `nPlease input them and click the button again.
|
||||
msgbox, 4096, Error!, %Message%
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||
; Msgbox, 4096, Error!, TelegramBotToken or TelegramBotChatID is missing from %SettingsIniFilepath%. `nPlease input them and rerun the script.
|
||||
Return
|
||||
}
|
||||
|
||||
/*
|
||||
; If description is longer than 2k chars, then API will error out. goto section that will allow user to edit video description to shorten it for posting
|
||||
if(StrLen(SocialMediaDescription) > 2000 AND VideoDescriptionForVideosChannel = ""){
|
||||
goto, CreateDescriptionForVideosPosting
|
||||
}
|
||||
*/
|
||||
/*
|
||||
if(SocialMediaDescription = ""){
|
||||
CreateDescriptionForSocialMedia()
|
||||
}
|
||||
if(SocialMediaDescription > 1000){ ; Telegram has a 1024 char media caption capacity
|
||||
SocialMediaDescription := SubStr(SocialMediaDescription, 1, 500)
|
||||
}
|
||||
*/
|
||||
; @todo: split telegram message into multiple posts
|
||||
|
||||
|
||||
SubmitDescriptionForTelegramVideosChannel:
|
||||
TelegramVideoTitle := ASCIISTRReplace(VideoTitle)
|
||||
TelegramVideoTitle := "*" . TelegramVideoTitle . "*"
|
||||
|
||||
TelegramBodymessage := ASCIISTRReplace(VideoDescription)
|
||||
|
||||
|
||||
; Variables
|
||||
LineBreakChar = `%0A ; Used for API
|
||||
VideoLinks :=
|
||||
|
||||
|
||||
|
||||
; Create the Hyperlinks for each Platform
|
||||
; ------------------------------------------------
|
||||
; check the status of the Bitchute URL to see if it's done processing
|
||||
; shows "404 - Page not found" on page if not
|
||||
if(BitChuteURL){
|
||||
@@ -85,10 +69,6 @@ VideoLinks .= "[Rumble](" . RumbleURL . ") \| "
|
||||
if(DailyMotionURL != "")
|
||||
VideoLinks .= "[DailyMotion](" . DailyMotionURL . ") \| "
|
||||
|
||||
/*if(PodcastTranscriptURL != "")
|
||||
VideoLinks .= "[Video Transcript](" . PodcastTranscriptURL . ") \| "
|
||||
|
||||
*/
|
||||
if(PodcastNumber != "")
|
||||
VideoLinks .= "[FDRPodcasts](" . "https://fdrpodcasts.com/" . PodcastNumber . ") \| "
|
||||
|
||||
@@ -96,7 +76,6 @@ VideoLinks .= "[FDRPodcasts](" . "https://fdrpodcasts.com/" . PodcastNumber . ")
|
||||
TelegramMessage := TelegramVideoTitle . "`n" . TelegramBodymessage . "`n" . VideoLinks
|
||||
|
||||
|
||||
|
||||
StrLenOfMessageAndVideoLinks := StrLen(TelegramVideoTitle) + StrLen(TelegramBodymessage) + StrLen(VideoLinks)
|
||||
; DevModeMsgBox(StrLenOfMessageAndVideoLinks)
|
||||
|
||||
@@ -131,18 +110,21 @@ if(StrLenOfMessageAndVideoLinks < 4096){
|
||||
; Photo and Video Title go into SendPhoto
|
||||
TelegramVideoTitle := TelegramVideoTitle . "`n" . VideoLinks
|
||||
Status := SendTelegramPhoto(TelegramBotToken, TelegramBotChatID, VideoThumbFilepath, caption := TelegramVideoTitle ) ; you could add more options; compare the Telegram API docs
|
||||
|
||||
; Output returned data to ErrorLog File
|
||||
Message = API Response:`n%Status%
|
||||
SaveOrPostProgress(Message:=Message,PostType:=",ErrorLoggingTextFile")
|
||||
|
||||
; Video Description goes into TelegramMessage
|
||||
Status := SendTelegramMessage(TelegramBotToken, TelegramBotChatID, text := TelegramBodymessage)
|
||||
|
||||
; Output returned data to ErrorLog File
|
||||
Message = API Response:`n%Status%
|
||||
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
|
||||
; ------------------------------------------------
|
||||
TelegramVideoTitle := TelegramVideoTitle . "`n" . VideoLinks
|
||||
@@ -162,16 +144,9 @@ if(StrLenOfMessageAndVideoLinks < 4096){
|
||||
|
||||
Status := SendTelegramMessage(TelegramBotToken, TelegramBotChatID, text := Description)
|
||||
; Output returned data to ErrorLog File
|
||||
Message = API Response:`n%Status%
|
||||
Message = Telegram API Response:`n%Status%
|
||||
SaveOrPostProgress(Message:=Message,PostType:=",ErrorLoggingTextFile")
|
||||
|
||||
; Clipboard := Description
|
||||
; msgbox % Description
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
; SaveOrPostProgress(Message:="Video Links posted to #Videos Successfully.",PostType:="Tooltip,ErrorLoggingTextFile")
|
||||
@@ -179,10 +154,6 @@ if(StrLenOfMessageAndVideoLinks < 4096){
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||||
GuiControl,, PostToTelegramButton, Telegram - Posted Successfully
|
||||
|
||||
|
||||
; sleep, 2000
|
||||
|
||||
|
||||
ToolTip
|
||||
CurrentSite :=
|
||||
Return
|
||||
|
||||
Reference in New Issue
Block a user