This repository has been archived by the owner on Sep 3, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
msgAvatar.go
49 lines (39 loc) · 1.27 KB
/
msgAvatar.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package main
import (
"github.com/bwmarrin/discordgo"
)
func init() {
newCommand("avatar", 0, false, msgAvatar).setHelp("Args: [@user]\n\nReturns the given users avatar.\nIf no user ID is given, your own avatar is sent.\n\nExample:\n`!owo avatar @Strum355#2298`").add()
}
func msgAvatar(s *discordgo.Session, m *discordgo.MessageCreate, msglist []string) {
if len(msglist) == 1 {
getAvatar(m.Author.ID, m, s)
return
}
if len(m.Mentions) != 0 {
getAvatar(m.Mentions[0].ID, m, s)
return
}
s.ChannelMessageSend(m.ChannelID, "User not found :(")
}
func getAvatar(userID string, m *discordgo.MessageCreate, s *discordgo.Session) {
/* guild, err := guildDetails(m.ChannelID, "", s)
if err != nil {
s.ChannelMessageSend(m.ChannelID, "There was an error finding the user :( Please try again")
return
} */
// slow warmup or fast but limited to guild :( shame
// or maybe not??? will monitor
user, err := userDetails(userID, s)
if err != nil {
s.ChannelMessageSend(m.ChannelID, "There was an error finding the user :( Please try again")
return
}
s.ChannelMessageSendEmbed(m.ChannelID, &discordgo.MessageEmbed{
Description: user.Username + "'s Avatar",
Color: 0x000000,
Image: &discordgo.MessageEmbedImage{
URL: user.AvatarURL("2048"),
},
})
}