Add view command and update utils

This commit is contained in:
Dustin Pianalto
2021-02-23 23:29:19 -09:00
parent d80fe268d7
commit 270319c615
4 changed files with 116 additions and 16 deletions
+3 -3
View File
@@ -2,10 +2,10 @@ package discord_utils
import "github.com/dustinpianalto/disgoman"
func GetChannelName(ctx disgoman.Context, id string) (string, error) {
func GetChannelName(ctx disgoman.Context, id string) string {
channel, err := ctx.Session.Channel(id)
if err != nil {
return "", err
return ""
}
return channel.Name, nil
return channel.Name
}
+4 -4
View File
@@ -2,13 +2,13 @@ package discord_utils
import "github.com/dustinpianalto/disgoman"
func GetDisplayName(ctx disgoman.Context, id string) (string, error) {
func GetDisplayName(ctx disgoman.Context, id string) string {
member, err := ctx.Session.GuildMember(ctx.Guild.ID, id)
if err != nil {
return "", err
return ""
}
if member.Nick != "" {
return member.Nick, nil
return member.Nick
}
return member.User.Username, nil
return member.User.Username
}