Update: same catch method for redis

This commit is contained in:
Kevin Dang
2025-06-17 07:06:41 -07:00
parent 9a2744f646
commit 1b7c927a3a

View File

@@ -33,15 +33,16 @@ const messageHistory: Queue<UserMessage> = new Queue<UserMessage>
registerEvents(client, Events, messageHistory, ollama, Keys.defaultModel) registerEvents(client, Events, messageHistory, ollama, Keys.defaultModel)
// Try to connect to redis // Try to connect to redis
try {
await redis.connect() await redis.connect()
.then(response => {
console.log('[Redis] Successfully Connected') console.log('[Redis] Successfully Connected')
} catch(error) { })
.catch(error => {
console.error('[Redis] Connection Error. See error below:\n', error) console.error('[Redis] Connection Error. See error below:\n', error)
console.warn('[Redis] Failed to connect to Redis Database, using local system') console.warn('[Redis] Failed to connect to Redis Database, using local system')
// TODO: create boolean flag that will probably be used in messageCreate.ts if redis database is down // TODO: create boolean flag that will probably be used in messageCreate.ts if redis database is down
// When implementing this boolean flag, move connection to database BEFORE the registerEvents method // When implementing this boolean flag, move connection to database BEFORE the registerEvents method
} })
// Try to log in the client // Try to log in the client
await client.login(Keys.clientToken) await client.login(Keys.clientToken)