remove panics
This commit is contained in:
Vendored
-4
@@ -19,8 +19,6 @@ func GetEnvVariables() Env {
|
|||||||
AppID: tempest.StringToSnowflake(os.Getenv("HAL_APP_ID")),
|
AppID: tempest.StringToSnowflake(os.Getenv("HAL_APP_ID")),
|
||||||
PublicKey: os.Getenv("HAL_PUBLIC_KEY"),
|
PublicKey: os.Getenv("HAL_PUBLIC_KEY"),
|
||||||
Token: os.Getenv("HAL_TOKEN"),
|
Token: os.Getenv("HAL_TOKEN"),
|
||||||
Port: os.Getenv("PORT"),
|
|
||||||
Addr: os.Getenv("ADDR"),
|
|
||||||
ServerIDs: serverIDs,
|
ServerIDs: serverIDs,
|
||||||
OpenaiHalToken: os.Getenv("OPENAI_HAL"),
|
OpenaiHalToken: os.Getenv("OPENAI_HAL"),
|
||||||
}
|
}
|
||||||
@@ -30,8 +28,6 @@ type Env struct {
|
|||||||
AppID tempest.Snowflake
|
AppID tempest.Snowflake
|
||||||
PublicKey string
|
PublicKey string
|
||||||
Token string
|
Token string
|
||||||
Port string
|
|
||||||
Addr string
|
|
||||||
ServerIDs []tempest.Snowflake
|
ServerIDs []tempest.Snowflake
|
||||||
OpenaiHalToken string
|
OpenaiHalToken string
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,8 @@ func (h Handler) OnMessageCreated(s *discordgo.Session, m *discordgo.MessageCrea
|
|||||||
fmt.Sprintf("X_X: %s", err.Error()),
|
fmt.Sprintf("X_X: %s", err.Error()),
|
||||||
)
|
)
|
||||||
|
|
||||||
log.Panicf("failed to query open ai with the following prompt [%s]. Error: %s", m.Content, err.Error())
|
log.Printf("\nfailed to query open ai with the following prompt [%s]. Error: %s", m.Content, err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(res.Choices) > 0 {
|
if len(res.Choices) > 0 {
|
||||||
@@ -76,7 +77,7 @@ func cleanMessage(p string) string {
|
|||||||
|
|
||||||
func sendResponse(s *discordgo.Session, channelID string, response string) {
|
func sendResponse(s *discordgo.Session, channelID string, response string) {
|
||||||
if _, err := s.ChannelMessageSend(channelID, response); err != nil {
|
if _, err := s.ChannelMessageSend(channelID, response); err != nil {
|
||||||
log.Panicf("failed to send the response [%s] to the discord channel [%s]", response, err.Error())
|
log.Printf("\nfailed to send the response [%s] to the discord channel [%s]", response, err.Error())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user