This commit is contained in:
2021-03-04 03:33:54 +03:00
parent 368382f63c
commit 5ac17d713f
67 changed files with 1824 additions and 119 deletions
+22
View File
@@ -0,0 +1,22 @@
import {Command} from "./base/command";
import {MessageContext, setStartTime, startTime} from "../base/base";
import {sendMessage} from "../base/net";
export class Ping implements Command {
regexp = /^\/ping/i
title: '/ping'
description: 'задержа между получаемым сообщением и отправленным'
async execute(context: MessageContext) {
await sendMessage(context, 'pong').then(async () => {
const nowMillis = new Date().getMilliseconds()
const change = Math.abs(nowMillis - startTime)
await sendMessage(context, `ping: ${change} ms`).then(() => {
setStartTime(0)
})
})
}
}