Skip to content
This repository has been archived by the owner on Nov 18, 2024. It is now read-only.

Commit

Permalink
adds status message in discord
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian Winkler committed Nov 2, 2016
1 parent 41c7ad7 commit b1ac3ed
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,12 @@ var (
RegexpUrlImgurGifv *regexp.Regexp
RegexpUrlImgurAlbum *regexp.Regexp
RegexpUrlGoogleDrive *regexp.Regexp
ImagesDownloaded int
dg *discordgo.Session
)

const (
VERSION string = "1.8.2"
VERSION string = "1.9"
RELEASE_URL string = "https://github.com/Seklfreak/discord-image-downloader-go/releases/latest"
IMGUR_CLIENT_ID string = "a39473314df3f59"
)
Expand Down Expand Up @@ -125,7 +127,6 @@ func main() {
return
}

var dg *discordgo.Session
if cfg.Section("auth").HasKey("token") {
dg, err = discordgo.New(cfg.Section("auth").Key("token").String())
} else {
Expand Down Expand Up @@ -452,4 +453,10 @@ func downloadFromUrl(dUrl string, filename string, path string) {
}

fmt.Printf("[%s] Downloaded url: %s to %s\n", time.Now().Format(time.Stamp), dUrl, completePath)
updateDiscordStatus()
}

func updateDiscordStatus() {
ImagesDownloaded++
dg.UpdateStatus(0, fmt.Sprintf("%d pictures downloaded", ImagesDownloaded))
}

0 comments on commit b1ac3ed

Please sign in to comment.