diff --git a/src/utils/handlers/chatHistoryHandler.ts b/src/utils/handlers/chatHistoryHandler.ts index 186e342..40e2405 100644 --- a/src/utils/handlers/chatHistoryHandler.ts +++ b/src/utils/handlers/chatHistoryHandler.ts @@ -64,7 +64,7 @@ export async function clearChannelInfo(filename: string, channel: TextChannel, u * @param user the user's name * @param messages their messages */ -export async function openChannelInfo(filename: string, channel: TextChannel | ThreadChannel, user: string, messages: UserMessage[] = []): Promise { +export async function openChannelInfo(this: any, filename: string, channel: TextChannel | ThreadChannel, user: string, messages: UserMessage[] = []): Promise { const fullFileName = `data/${filename}-${user}.json` if (fs.existsSync(fullFileName)) { fs.readFile(fullFileName, 'utf8', (error, data) => { @@ -95,7 +95,7 @@ export async function openChannelInfo(filename: string, channel: TextChannel | T // only creating it, no need to add anything fs.writeFileSync(fullFileName, JSON.stringify(object, null, 2)) - console.log(`[Util: openChannelInfo] Created '${fullFileName}' in working directory`) + console.log(`[Util: ${this.name}] Created '${fullFileName}' in working directory`) } } diff --git a/src/utils/handlers/configHandler.ts b/src/utils/handlers/configHandler.ts index b347c74..cf78730 100644 --- a/src/utils/handlers/configHandler.ts +++ b/src/utils/handlers/configHandler.ts @@ -10,7 +10,7 @@ import path from 'path' * @param value new value to assign */ // add type of change (server, user) -export function openConfig(filename: string, key: string, value: any) { +export function openConfig(this: any, filename: string, key: string, value: any) { const fullFileName = `data/${filename}` // check if the file exists, if not then make the config file @@ -41,7 +41,7 @@ export function openConfig(filename: string, key: string, value: any) { fs.mkdirSync(directory, { recursive: true }) fs.writeFileSync(`data/${filename}`, JSON.stringify(object, null, 2)) - console.log(`[Util: openConfig] Created '${filename}' in working directory`) + console.log(`[Util: ${this.name}] Created '${filename}' in working directory`) } } diff --git a/src/utils/messageNormal.ts b/src/utils/messageNormal.ts index a438e41..5659ccc 100644 --- a/src/utils/messageNormal.ts +++ b/src/utils/messageNormal.ts @@ -11,6 +11,7 @@ import { AbortableAsyncIterator } from 'ollama/src/utils.js' * @param msgHist message history between user and model */ export async function normalMessage( + this: any, message: Message, ollama: Ollama, model: string, @@ -73,7 +74,7 @@ export async function normalMessage( sentMessage.edit(result) } } catch (error: any) { - console.log(`[Util: messageNormal] Error creating message: ${error.message}`) + console.log(`[Util: ${this.name}] Error creating message: ${error.message}`) if (error.message.includes('try pulling it first')) sentMessage.edit(`**Response generation failed.**\n\nReason: You do not have the ${model} downloaded. Ask an admin to pull it using the \`pull-model\` command.`) else