forked from bwmarrin/discordgo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
message_test.go
41 lines (37 loc) · 891 Bytes
/
message_test.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
package discordgo
import (
"testing"
)
func TestContentWithMoreMentionsReplaced(t *testing.T) {
s := &Session{StateEnabled: true, State: NewState()}
user := &User{
ID: "user",
Username: "User Name",
}
s.StateEnabled = true
s.State.GuildAdd(&Guild{ID: "guild"})
s.State.RoleAdd("guild", &Role{
ID: "role",
Name: "Role Name",
Mentionable: true,
})
s.State.MemberAdd(&Member{
User: user,
Nick: "User Nick",
GuildID: "guild",
})
s.State.ChannelAdd(&Channel{
Name: "Channel Name",
GuildID: "guild",
ID: "channel",
})
m := &Message{
Content: "<&role> <@!user> <@user> <#channel>",
ChannelID: "channel",
MentionRoles: []string{"role"},
Mentions: []*User{user},
}
if result, _ := m.ContentWithMoreMentionsReplaced(s); result != "@Role Name @User Nick @User Name #Channel Name" {
t.Error(result)
}
}