diff options
author | Trumeet <yuuta@yuuta.moe> | 2022-10-22 18:13:54 -0700 |
---|---|---|
committer | Trumeet <yuuta@yuuta.moe> | 2022-10-22 18:13:54 -0700 |
commit | 59ed4b1857b9f4885a6e4d5bc8f3c3a548953b56 (patch) | |
tree | 3b16ad453383df91478c6defbf8fadfe0f227380 /stat.c | |
parent | 57bd18ef88e48c18abf156b2635675df56c4a67e (diff) | |
download | ksyxbot-59ed4b1857b9f4885a6e4d5bc8f3c3a548953b56.tar ksyxbot-59ed4b1857b9f4885a6e4d5bc8f3c3a548953b56.tar.gz ksyxbot-59ed4b1857b9f4885a6e4d5bc8f3c3a548953b56.tar.bz2 ksyxbot-59ed4b1857b9f4885a6e4d5bc8f3c3a548953b56.zip |
Add running time to /stat
Diffstat (limited to 'stat.c')
-rw-r--r-- | stat.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -6,6 +6,7 @@ #include "log.h" #include "tdutils.h" #include "db.h" +#include "botd.h" #include <stdlib.h> #include <string.h> @@ -41,7 +42,9 @@ void stat(struct TdMessage *msg) { if ((r = sqlite3_prepare_v2(db, "SELECT COUNT(t) FROM says;", -1, &stmt, NULL))) goto sql_err; if ((r = sqlite3_step(stmt)) != SQLITE_ROW) goto sql_err; size_t len = strlen(m); - snprintf(&m[len], 1024 - len, "\n\n共有 %d 句教授语录。", sqlite3_column_int(stmt, 0)); + snprintf(&m[len], 1024 - len, "\n\n共有 %d 句教授语录。\nBot 已运行 %ld 秒。", + sqlite3_column_int(stmt, 0), + time(NULL) - start_time); sqlite3_finalize(stmt); goto send; send: |