forked from chanbakjsd/TerraOceanPlugin
41 lines
989 B
Go
41 lines
989 B
Go
|
package main
|
||
|
|
||
|
import (
|
||
|
"strings"
|
||
|
|
||
|
"github.com/bwmarrin/discordgo"
|
||
|
)
|
||
|
|
||
|
//adminID is my Discord user ID (chanbakjsd#7968).
|
||
|
const adminID = "218983355746746369"
|
||
|
|
||
|
func sendAs(s *discordgo.Session, m *discordgo.MessageCreate, command []string) {
|
||
|
if m.Author.ID != adminID {
|
||
|
return
|
||
|
}
|
||
|
if len(command) < 3 {
|
||
|
return
|
||
|
}
|
||
|
message := strings.SplitN(m.Content, " ", 3)
|
||
|
msg, err := s.ChannelMessageSend(message[1], message[2])
|
||
|
if err != nil {
|
||
|
s.ChannelMessageSend(m.ChannelID, err.Error())
|
||
|
}
|
||
|
s.ChannelMessageSend(m.ChannelID, "The message has been sent. Discord ID: "+msg.ID)
|
||
|
}
|
||
|
|
||
|
func editAs(s *discordgo.Session, m *discordgo.MessageCreate, command []string) {
|
||
|
if m.Author.ID != adminID {
|
||
|
return
|
||
|
}
|
||
|
if len(command) < 4 {
|
||
|
return
|
||
|
}
|
||
|
message := strings.SplitN(m.Content, " ", 4)
|
||
|
_, err := s.ChannelMessageEdit(message[1], message[2], message[3])
|
||
|
if err != nil {
|
||
|
s.ChannelMessageSend(m.ChannelID, err.Error())
|
||
|
}
|
||
|
s.ChannelMessageSend(m.ChannelID, "The message has been edited.")
|
||
|
}
|