Skip to content
This repository has been archived by the owner on Oct 28, 2020. It is now read-only.

Commit

Permalink
sends invite to direct message
Browse files Browse the repository at this point in the history
  • Loading branch information
sarisia committed Sep 30, 2020
1 parent ee45857 commit 749930f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion aria/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ func (b *bot) cmdLogin(m *discordgo.Message, _ []string) {
func (b *bot) cmdInvite(m *discordgo.Message, _ []string) {
b.sendAriaRequest(&request{
OP: "invite",
Postback: m.ChannelID,
Postback: m.Author.ID,
})
}

Expand Down
7 changes: 6 additions & 1 deletion aria/packets.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ func onInvite(b *bot, pb string, d *inviteData) {
return
}

uc, err := b.UserChannelCreate(pb)
if err != nil {
log.Printf("failed to create user channel: %v", err)
}

e := newEmbed()
e.Color = 0x57ffae
e.Title = "Welcome!"
Expand All @@ -117,7 +122,7 @@ func onInvite(b *bot, pb string, d *inviteData) {
},
}

if _, err := b.deleteAfterChannelMessageSendEmbed(msgTimeout, true, pb, e); err != nil {
if _, err := b.ChannelMessageSendEmbed(uc.ID, e); err != nil {
log.Printf("failed to send invite embed: %v\n", err)
return
}
Expand Down

0 comments on commit 749930f

Please sign in to comment.