EngiBot now pretends to type when downloading a video

This commit is contained in:
Logan G 2022-07-20 17:45:35 -06:00
parent 186d3b3069
commit b18f850114
Signed by: logan
GPG key ID: E328528C921E7A7A

View file

@ -66,6 +66,7 @@ func messageCreate(session *discordgo.Session, message *discordgo.MessageCreate)
choice, err := getLargestFormat(result, 8*1024*1024)
log.Printf("Choice: %s | Size: %fM\n", choice.FormatID, choice.FilesizeApprox/1024/1024)
if err == nil {
session.ChannelTyping(message.ChannelID)
downloadResult, err := result.Download(context.Background(), choice.FormatID)
if err != nil {
log.Println(err)
@ -116,6 +117,7 @@ func messageCreate(session *discordgo.Session, message *discordgo.MessageCreate)
choice, err := getLargestYTFormat(result, 8*1024*1024)
log.Printf("Choice: %s | Size: %fM\n", choice.FormatID, choice.FilesizeApprox/1024/1024)
if err == nil {
session.ChannelTyping(message.ChannelID)
downloadResult, err := result.Download(context.Background(), choice.FormatID)
if err != nil {
@ -148,6 +150,7 @@ func messageCreate(session *discordgo.Session, message *discordgo.MessageCreate)
log.Println(err)
continue
} else {
session.ChannelTyping(message.ChannelID)
downloadResult, err := result.Download(context.Background(), result.Formats()[0].FormatID) // Insta only has one possible format to download :(
if err != nil {
log.Println(err)