a736f786c2
- add /openai (/chatgpt) chat command using OpenAI Responses API (streaming + incremental edits) - add /openAIListModels, /openAIGetModel, /openAISetModel - introduce base Command class and migrate non-chat commands to it - wire OpenAI client + env vars (OPENAI_API_KEY, OPENAI_MODEL) - bump deps (@google/genai, systeminformation, @types/node) and add openai
20 lines
769 B
TypeScript
20 lines
769 B
TypeScript
import {Command} from "../base/command";
|
|
import {Message} from "typescript-telegram-bot-api";
|
|
import {Requirements} from "../base/requirements";
|
|
import {Requirement} from "../base/requirement";
|
|
import {logError, replyToMessage} from "../util/utils";
|
|
|
|
export class Debug extends Command {
|
|
title = "/debug";
|
|
description = "Returns msg (or reply) as json";
|
|
|
|
requirements = Requirements.Build(Requirement.BOT_ADMIN);
|
|
|
|
async execute(msg: Message): Promise<void> {
|
|
const msgToDebug = msg.reply_to_message ? msg.reply_to_message : msg;
|
|
|
|
const json = JSON.stringify(msgToDebug, null, 2);
|
|
const text = `\`\`\`json\n${json}\n\`\`\``;
|
|
await replyToMessage({message: msg, text: text, parse_mode: "Markdown"}).catch(logError);
|
|
}
|
|
} |