grim/wasdead

Proper URL is now used for stuff
draft
2019-03-20, Ruin
662c3c77eb5a
Parents a73b1126ee04
Children 9fc9bb98ff08
Proper URL is now used for stuff
  • +4 -4
    main.go
  • --- a/main.go Wed Mar 20 14:46:13 2019 -0700
    +++ b/main.go Wed Mar 20 15:03:18 2019 -0700
    @@ -112,7 +112,7 @@
    channel := getguild2channel(evt.GuildID)
    if channel != "" {
    - err := processPresenceUpdate(sess, channel, strings.TrimLeft(pURL.Path, "/"))
    + err := processPresenceUpdate(sess, channel, strings.TrimLeft(pURL.Path, "/"), evt.Game.URL)
    if err != nil {
    logError(err)
    @@ -157,7 +157,7 @@
    if channel != m.ChannelID {
    return
    }
    - err := processPresenceUpdate(s, channel, commandItems[1])
    + err := processPresenceUpdate(s, channel, commandItems[1], "https://twitch.com/"+commandItems[1])
    if err != nil {
    logError(err)
    @@ -179,7 +179,7 @@
    return err
    }
    -func processPresenceUpdate(s *discordgo.Session, channelid, twitchName string) error {
    +func processPresenceUpdate(s *discordgo.Session, channelid, twitchName, url string) error {
    resp, err := TwitchClient.GetUsers(&helix.UsersParams{
    Logins: []string{twitchName},
    })
    @@ -212,7 +212,7 @@
    URL: user.OfflineImageURL,
    },
    Author: &discordgo.MessageEmbedAuthor{
    - URL: "https://twitch.com/" + user.Login,
    + URL: url,
    Name: user.DisplayName + " is now live",
    },
    Thumbnail: &discordgo.MessageEmbedThumbnail{