37 lines
672 B
Go
37 lines
672 B
Go
|
package commands
|
||
|
|
||
|
import (
|
||
|
"PermissionGacha/modules/config"
|
||
|
|
||
|
"github.com/bwmarrin/discordgo"
|
||
|
)
|
||
|
|
||
|
func handleAdminCommand(s *discordgo.Session, args []string, m *discordgo.MessageCreate) error {
|
||
|
if len(args) < 2 {
|
||
|
return nil
|
||
|
}
|
||
|
found := false
|
||
|
for _, v := range config.Admins {
|
||
|
if v == m.Author.ID {
|
||
|
found = true
|
||
|
break
|
||
|
}
|
||
|
}
|
||
|
if !found {
|
||
|
s.ChannelMessageSend(m.ChannelID, "**UNAUTHORIZED >** You cannot use this command!")
|
||
|
return nil
|
||
|
}
|
||
|
switch args[1] {
|
||
|
case "echo":
|
||
|
if len(args) < 5 {
|
||
|
return nil
|
||
|
}
|
||
|
msg, err := s.ChannelMessage(args[2], args[3])
|
||
|
if err != nil {
|
||
|
return err
|
||
|
}
|
||
|
s.ChannelMessageSend(args[4], msg.Content)
|
||
|
}
|
||
|
return nil
|
||
|
}
|