reworked discord message formatting, code cleanup

pull/49/head
Yuriy 5 months ago
parent b98ae5e190
commit 4beb83caa6

@ -618,19 +618,6 @@ Return
*/ */
CreateDescriptionForSocialMedia(){
SplitText = Free Documentaries:
SocialMediaDescription := StrSplit(VideoDescription, SplitText)
SocialMediaDescription := SocialMediaDescription[1]
if(strlen(SocialMediaDescription) > 1400){
SocialMediaDescription := SubStr(SocialMediaDescription, 1, 1400)
SocialMediaDescription .= "..."
}
Return
}
; -------------------------------Upload Video Functionality------------------------------- ; -------------------------------Upload Video Functionality-------------------------------
StartScript: StartScript:
WinGetPos, XPosition, YPosition, , , A WinGetPos, XPosition, YPosition, , , A

@ -1 +1 @@
Subproject commit a3d89a989282e2c852b72b7e6d02a1a88ee53ee4 Subproject commit 6bf72336d0af0aa57064fc40c267677bb27577f3

@ -432,7 +432,7 @@ Gui, Add, Button, x%MarginSize% w%ResultsEditAndCopyButtonWidth% h%SecondaryButt
; Error Log Column ; Error Log Column
; ------------------------------------------------ ; ------------------------------------------------
Gui, Font, s%GuiFontSize% Gui, Font, s%GuiFontSize%
Gui, Add, Button, x+%MarginSize% y%MarginSize% w%ErrorLogEditBoxWidth% h%ButtonHeights% y%MarginSize%, Error Log Gui, Add, Button, x+%MarginSize% y%MarginSize% w%ErrorLogEditBoxWidth% h%ButtonHeights% y%MarginSize% gOpenErrorLog, Error Log (Click to Open Detailed Log)
Gui, Add, Edit,x%ErrorLogEditBoxXPos% h%ErrorLogEditBoxHeight% w%ErrorLogEditBoxWidth% y+10, %ErrorLogVar% Gui, Add, Edit,x%ErrorLogEditBoxXPos% h%ErrorLogEditBoxHeight% w%ErrorLogEditBoxWidth% y+10, %ErrorLogVar%
gui, font, Normal gui, font, Normal

@ -13,22 +13,10 @@ if(DiscordVideosWebhookURL = ""){
Msgbox, Unable to Grab DiscordVideosWebhookURL from %SettingsIniFilepath%.`nPlease input the URL and then try again. Msgbox, Unable to Grab DiscordVideosWebhookURL from %SettingsIniFilepath%.`nPlease input the URL and then try again.
Return Return
} }
; https://stackoverflow.com/questions/63160401/how-to-create-hyperlink-in-discord-in-an-embed-in-general
/*
; 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()
}
SubmitDescriptionForDiscordVideosChannel: Message :=
Message := "**" . VideoTitle . "**" . "`n" . SocialMediaDescription . "`n"
; https://stackoverflow.com/questions/63160401/how-to-create-hyperlink-in-discord-in-an-embed-in-general
if(BitChuteURL != "") if(BitChuteURL != "")
Message .= "[BitChute](<" . BitChuteURL . ">) \| " Message .= "[BitChute](<" . BitChuteURL . ">) \| "
@ -55,6 +43,20 @@ if(PodcastNumber != "")
Message .= "[FDRPodcasts](<" . "https://fdrpodcasts.com/" . PodcastNumber . ">) \| " Message .= "[FDRPodcasts](<" . "https://fdrpodcasts.com/" . PodcastNumber . ">) \| "
; StrLenOfDiscordMessage :=
; trim the video description if Title + Body + Links is longer than 2000 chars
if((StrLen(VideoTitle) + StrLen(VideoDescription) + StrLen(Message)) > 2000){
DiscordAPICharsLeft := 2000 - StrLen(VideoTitle) - StrLen(Message) - 15
DiscordVideoDescription := SubStr(VideoDescription, 1, DiscordAPICharsLeft) . "..."
}
else,
DiscordVideoDescription := VideoDescription
Message := "**" . VideoTitle . "**" . "`n" . DiscordVideoDescription . "`n" . Message
Status := UploadImageToDiscord(DiscordVideosWebhookURL, Message, VideoThumbFilepath) Status := UploadImageToDiscord(DiscordVideosWebhookURL, Message, VideoThumbFilepath)
Message = API Response:`n%Status% Message = API Response:`n%Status%
SaveOrPostProgress(Message:=Message,PostType:="ErrorLoggingTextFile") SaveOrPostProgress(Message:=Message,PostType:="ErrorLoggingTextFile")

@ -1,3 +1,3 @@
[Video-Uploader] [Video-Uploader]
Version=3.37 Version=3.39
Name=Freedomain Video Uploader Name=Freedomain Video Uploader

Loading…
Cancel
Save