basic command system

This commit is contained in:
Cynthia Foxwell 2023-07-08 14:51:26 -06:00
parent c70359d412
commit 10ba1af405
10 changed files with 201 additions and 17 deletions

View file

@ -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
View 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) {
}

View file

@ -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()
}