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