f
This commit is contained in:
@@ -10,17 +10,19 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func OnMessageCreated(s *discordgo.Session, m *discordgo.MessageCreate) {
|
func OnMessageCreated(s *discordgo.Session, m *discordgo.MessageCreate) {
|
||||||
fmt.Printf("\nmessage received: [%s]", m.Message.Content)
|
fmt.Printf("\nmessage received 1: [%s]", m.Message.Content)
|
||||||
|
|
||||||
if m.Author.ID == s.State.User.ID {
|
if m.Author.ID == s.State.User.ID {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if containUser(m.Mentions, s.State.User.ID) {
|
if containUser(m.Mentions, s.State.User.ID) {
|
||||||
fmt.Printf("\nmessage received: [%s]", m.Message.Content)
|
fmt.Printf("\nmessage received 2: [%s]", m.Message.Content)
|
||||||
|
|
||||||
aiclient := openai.NewClient(env.GetEnvVariables().OpenaiHalToken)
|
aiclient := openai.NewClient(env.GetEnvVariables().OpenaiHalToken)
|
||||||
|
|
||||||
|
fmt.Printf("\nAfter openai client: %+v", aiclient)
|
||||||
|
|
||||||
res, err := aiclient.Completions(m.Content)
|
res, err := aiclient.Completions(m.Content)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Panicf("failed to query open ai with the following prompt [%s]. Error: %s", m.Content, err.Error())
|
log.Panicf("failed to query open ai with the following prompt [%s]. Error: %s", m.Content, err.Error())
|
||||||
|
|||||||
Reference in New Issue
Block a user