remove panics
This commit is contained in:
Vendored
-4
@@ -19,8 +19,6 @@ func GetEnvVariables() Env {
|
||||
AppID: tempest.StringToSnowflake(os.Getenv("HAL_APP_ID")),
|
||||
PublicKey: os.Getenv("HAL_PUBLIC_KEY"),
|
||||
Token: os.Getenv("HAL_TOKEN"),
|
||||
Port: os.Getenv("PORT"),
|
||||
Addr: os.Getenv("ADDR"),
|
||||
ServerIDs: serverIDs,
|
||||
OpenaiHalToken: os.Getenv("OPENAI_HAL"),
|
||||
}
|
||||
@@ -30,8 +28,6 @@ type Env struct {
|
||||
AppID tempest.Snowflake
|
||||
PublicKey string
|
||||
Token string
|
||||
Port string
|
||||
Addr string
|
||||
ServerIDs []tempest.Snowflake
|
||||
OpenaiHalToken string
|
||||
}
|
||||
|
||||
@@ -41,7 +41,8 @@ func (h Handler) OnMessageCreated(s *discordgo.Session, m *discordgo.MessageCrea
|
||||
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 {
|
||||
@@ -76,7 +77,7 @@ func cleanMessage(p string) string {
|
||||
|
||||
func sendResponse(s *discordgo.Session, channelID string, response string) {
|
||||
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