basic command system
This commit is contained in:
parent
c70359d412
commit
10ba1af405
10 changed files with 201 additions and 17 deletions
|
@ -1,9 +0,0 @@
|
|||
package events
|
||||
|
||||
import "github.com/bwmarrin/discordgo"
|
||||
|
||||
func MessageCreate(session *discordgo.Session, msg *discordgo.MessageCreate) {
|
||||
if (msg.Author.ID == session.State.User.ID) {
|
||||
return
|
||||
}
|
||||
}
|
31
events/messages.go
Normal file
31
events/messages.go
Normal file
|
@ -0,0 +1,31 @@
|
|||
package events
|
||||
|
||||
import (
|
||||
"github.com/Cynosphere/comcord/state"
|
||||
"github.com/bwmarrin/discordgo"
|
||||
)
|
||||
|
||||
func MessageCreate(session *discordgo.Session, msg *discordgo.MessageCreate) {
|
||||
if (msg.Author.ID == session.State.User.ID) {
|
||||
return
|
||||
}
|
||||
|
||||
channel, err := session.State.Channel(msg.ChannelID)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if state.IsInPrompt() {
|
||||
state.AddMessageToQueue(*msg.Message)
|
||||
} else {
|
||||
// TODO
|
||||
}
|
||||
|
||||
if channel.Type == discordgo.ChannelTypeDM || channel.Type == discordgo.ChannelTypeGroupDM {
|
||||
state.SetLastDM(msg.ChannelID)
|
||||
}
|
||||
}
|
||||
|
||||
func MessageUpdate(session *discordgo.Session, msg *discordgo.MessageUpdate) {
|
||||
|
||||
}
|
|
@ -9,5 +9,7 @@ import (
|
|||
|
||||
func Ready(session *discordgo.Session, event *discordgo.Ready) {
|
||||
fmt.Print("Logged in as: ")
|
||||
color.Yellow("%s (%s)", session.State.User.Username, session.State.User.ID)
|
||||
color.Set(color.FgYellow)
|
||||
fmt.Printf("%s (%s)\n", session.State.User.Username, session.State.User.ID)
|
||||
color.Unset()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue