1
0
Fork 0
mirror of https://github.com/diamondburned/arikawa.git synced 2024-09-27 04:38:49 +00:00

API: Added test for EditMessage

This commit is contained in:
diamondburned (Forefront) 2020-05-12 17:09:32 -07:00
parent 9f1f7547b9
commit cc4e8c0966

View file

@ -85,7 +85,7 @@ func TestReactions(t *testing.T) {
client := NewClient("Bot " + cfg.BotToken) client := NewClient("Bot " + cfg.BotToken)
msg := fmt.Sprint("This is a message sent at ", time.Now()) msg := fmt.Sprintf("This is a message sent at %v.", time.Now())
// Send a new message. // Send a new message.
m, err := client.SendMessage(cfg.ChannelID, msg, nil) m, err := client.SendMessage(cfg.ChannelID, msg, nil)
@ -93,9 +93,18 @@ func TestReactions(t *testing.T) {
t.Fatal("Failed to send message:", err) t.Fatal("Failed to send message:", err)
} }
now := time.Now()
for _, emojiString := range emojisToSend { for _, emojiString := range emojisToSend {
if err := client.React(cfg.ChannelID, m.ID, emojiString); err != nil { if err := client.React(cfg.ChannelID, m.ID, emojiString); err != nil {
t.Fatal("Failed to send emoji "+emojiString+":", err) t.Fatal("Failed to send emoji "+emojiString+":", err)
} }
} }
msg += " Total time taken to send all reactions: " + time.Now().Sub(now)
m, err = client.EditMessage(cfg.ChannelID, m.ID, msg, nil)
if err != nil {
t.Fatal("Failed to edit message:", err)
}
} }