fixes
This commit is contained in:
+20
-2
@@ -2,6 +2,7 @@ package commands
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
helpers "ion606_bot/Bot/Helpers"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/bwmarrin/discordgo"
|
"github.com/bwmarrin/discordgo"
|
||||||
@@ -176,16 +177,33 @@ func HandleAction(s *discordgo.Session, i *discordgo.InteractionCreate) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Determine the sender mention.
|
// Determine the sender mention.
|
||||||
senderID := i.User.ID
|
senderID := ""
|
||||||
if i.Member != nil {
|
if i.Member != nil {
|
||||||
senderID = i.Member.User.ID
|
senderID = i.Member.User.ID
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if i.User != nil && senderID == "" {
|
||||||
|
senderID = i.User.ID
|
||||||
|
}
|
||||||
|
|
||||||
|
if senderID == "" {
|
||||||
|
helpers.HandleError(s, i, fmt.Errorf("failed to get sender ID"))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
senderMention := fmt.Sprintf("<@%s>", senderID)
|
senderMention := fmt.Sprintf("<@%s>", senderID)
|
||||||
|
|
||||||
|
// Determine bot's ID
|
||||||
|
var botID string
|
||||||
|
if s.State != nil && s.State.User != nil {
|
||||||
|
botID = s.State.User.ID
|
||||||
|
} else {
|
||||||
|
botID = i.AppID
|
||||||
|
}
|
||||||
|
|
||||||
// Check for special cases.
|
// Check for special cases.
|
||||||
responseMessage := fmt.Sprintf("%s %s %s %s", senderMention, actionSelected, receiverMention, symbol)
|
responseMessage := fmt.Sprintf("%s %s %s %s", senderMention, actionSelected, receiverMention, symbol)
|
||||||
if receiverID != "" {
|
if receiverID != "" {
|
||||||
botID := s.State.User.ID
|
|
||||||
if receiverID == senderID {
|
if receiverID == senderID {
|
||||||
// Special message for acting on yourself.
|
// Special message for acting on yourself.
|
||||||
if special, ok := specialMessages[actionSelected]["self"]; ok {
|
if special, ok := specialMessages[actionSelected]["self"]; ok {
|
||||||
|
|||||||
Reference in New Issue
Block a user