refactor!: rewrite bot core; add AI (Ollama, Gemini), DB, new commands
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
import {logError, oldSendMessage} from "../util/utils";
|
||||
import {Message} from "typescript-telegram-bot-api";
|
||||
import {ChatCommand} from "../base/chat-command";
|
||||
|
||||
export class Ping implements ChatCommand {
|
||||
regexp = /^\/ping/i;
|
||||
title = "/ping";
|
||||
description = "Ping between received and sent message";
|
||||
|
||||
async execute(msg: Message) {
|
||||
const then = new Date().getMilliseconds();
|
||||
await oldSendMessage(msg, "pong").catch(logError);
|
||||
const now = new Date().getMilliseconds();
|
||||
const diff = Math.abs(now - then);
|
||||
await oldSendMessage(msg, `ping: ${diff}ms`).catch(logError);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user