discordo/util.go
ayntgl 2400226ee1
Store selected message index (+1) instead of *discordgo.Message struct (#71)
* Store selected message index (+1) instead of *discordgo.Message struct

* Fix typo; Repling -> Replying
2021-10-15 22:26:48 +04:00

26 lines
481 B
Go

package main
import (
"strings"
"github.com/ayntgl/discordgo"
)
func generateChannelRepr(c *discordgo.Channel) string {
var repr string
if c.Name != "" {
repr = "#" + c.Name
} else if len(c.Recipients) == 1 {
rp := c.Recipients[0]
repr = rp.Username + "#" + rp.Discriminator
} else {
rps := make([]string, len(c.Recipients))
for i, r := range c.Recipients {
rps[i] = r.Username + "#" + r.Discriminator
}
repr = strings.Join(rps, ", ")
}
return repr
}