From f2efdebc90aef4450835cd889918c65a04e6d0db Mon Sep 17 00:00:00 2001 From: Nikhil Nawgiri Date: Sun, 25 Aug 2024 03:40:54 +0200 Subject: [PATCH] Refactor --- src/main.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/main.ts b/src/main.ts index ced3705..8a50a3c 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,21 +1,21 @@ -import { config } from "../config.js"; +import { + MatrixClient, + SimpleFsStorageProvider, + RustSdkCryptoStorageProvider, + AutojoinRoomsMixin +} from "matrix-bot-sdk"; -const sdk = require("matrix-bot-sdk"); +import { config } from "../config.ts"; +import { callOpenAiAPI } from "./openai.js"; const { homeserverUrl, accessToken, storageLocation, cryptoFolderLocation, + openaiApiKey, } = config; -const { - MatrixClient, - SimpleFsStorageProvider, - RustSdkCryptoStorageProvider, - AutojoinRoomsMixin -} = sdk; - // In order to make sure the bot doesn't lose its state between restarts, we'll give it a place to cache // any information it needs to. You can implement your own storage provider if you like, but a JSON file // will work fine for this example.