more logs
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package handlers
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"hal/env"
|
||||
"hal/openai"
|
||||
"log"
|
||||
@@ -9,13 +10,15 @@ import (
|
||||
)
|
||||
|
||||
func OnMessageCreated(s *discordgo.Session, m *discordgo.MessageCreate) {
|
||||
log.Printf("new message posted: [%s], par [%s]", m.Content, m.Author.Username)
|
||||
log.Printf("new message posted: [%s], par [%s], authorID [%s], state user id [%s]", m.Content, m.Author.Username, m.Author.ID, s.State.User.ID)
|
||||
|
||||
log.Printf("author [%+v], state user [%+v]", m.Author, s.State.User)
|
||||
if m.Author.ID == s.State.User.ID {
|
||||
return
|
||||
}
|
||||
|
||||
if containUser(m.Mentions, s.State.User.ID) {
|
||||
fmt.Println("going through openai stuff")
|
||||
aiclient := openai.NewClient(env.GetEnvVariables().OpenaiHalToken)
|
||||
|
||||
res, err := aiclient.ChatCompletions(m.Content)
|
||||
@@ -36,6 +39,7 @@ func OnMessageCreated(s *discordgo.Session, m *discordgo.MessageCreate) {
|
||||
|
||||
func containUser(users []*discordgo.User, userID string) bool {
|
||||
for _, u := range users {
|
||||
fmt.Println("## mentions ##", u.ID, u.Username, "-----", userID)
|
||||
if u.ID == userID {
|
||||
return true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user