You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
video-uploader/Modules/Post-To-Discord.ahk

74 lines
2.5 KiB
Plaintext

PostToDiscord:
;------------------------------------------------
CurrentSocialMediaPosting := "Discord"
Message = Posting Video Links to Discord
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
IniRead, DiscordVideosWebhookURL, %SettingsIniFilepath%, General, DiscordVideosWebhookURL, %A_Space%
if(DiscordVideosWebhookURL = ""){
Message = Unable to Grab DiscordVideosWebhookURL from %SettingsIniFilepath%.`nPlease input the URL and then try again.
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
Msgbox, Unable to Grab DiscordVideosWebhookURL from %SettingsIniFilepath%.`nPlease input the URL and then try again.
Return
}
; https://stackoverflow.com/questions/63160401/how-to-create-hyperlink-in-discord-in-an-embed-in-general
Message :=
if(BitChuteURL != "")
Message .= "[BitChute](<" . BitChuteURL . ">) \| "
if(BrighteonURL != "")
Message .= "[Brighteon](<" . BrighteonURL . ">) \| "
if(OdyseeVideoURL != "")
Message .= "[Odysee](<" . OdyseeVideoURL . ">) \| "
if(OdyseeAudioURL != "")
Message .= "[Odysee (Audio)](<" . OdyseeAudioURL . ">) \| "
if(RumbleURL != "")
Message .= "[Rumble](<" . RumbleURL . ">) \| "
if(DailyMotionURL != "")
Message .= "[DailyMotion](<" . DailyMotionURL . ">) \| "
if(PodcastTranscriptURL != "")
Message .= "[Video Transcript](<" . PodcastTranscriptURL . ">) \| "
if(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" . Message . "`n" . DiscordVideoDescription
Status := UploadImageToDiscord(DiscordVideosWebhookURL, Message, VideoThumbFilepath)
Message = API Response:`n%Status%
SaveOrPostProgress(Message:=Message,PostType:="ErrorLoggingTextFile")
SaveOrPostProgress(Message:="Video Links posted to #Videos Successfully.",PostType:="Tooltip,ErrorLoggingTextFile")
GuiControl,, PostToDiscordButton, Discord - Posted Successfully
sleep, 2000
ToolTip
; Msgbox,,Success,Video Links posted to #Videos Successfully.
; ToolTip
Return
; -------------------------------/Discord-------------------------------