From b6e59588a236a71650d110bc3641ef6b18b919e1 Mon Sep 17 00:00:00 2001 From: 9pfs <9pfs@amcforum.wiki> Date: Mon, 6 Nov 2023 00:44:45 +0000 Subject: [PATCH] Add uptime command (#14) Because every bot needs an uptime command! Add uptime command https://git.amcforum.wiki/Firepup650/fire-ircbot/commit/077eed642715dbfa1710b8e4abff0ee3ddce07a3 Fix stupid mistake https://git.amcforum.wiki/Firepup650/fire-ircbot/commit/a66cfd848ab432ffebf47362a503fac383271ce7 Make fp happy https://git.amcforum.wiki/Firepup650/fire-ircbot/commit/48a503a3923aec251ea155c378423e97429d9196 Reviewed-on: https://git.amcforum.wiki/Firepup650/fire-ircbot/pulls/14 Reviewed-by: Firepup Sixfifty Co-authored-by: 9pfs <9pfs@amcforum.wiki> Co-committed-by: 9pfs <9pfs@amcforum.wiki> --- ircbot.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ircbot.py b/ircbot.py index 4bc3a92..a8d1ceb 100644 --- a/ircbot.py +++ b/ircbot.py @@ -9,6 +9,7 @@ from dotenv import load_dotenv from pythonlangutil.overload import Overload, signature from datetime import datetime as dt from logs import log +from subprocess import run, PIPE load_dotenv() @@ -360,6 +361,12 @@ def main(): f"{name}: pong", chan, ) + elif mfind(message, ["uptime"]): + uptime = run(["uptime","-p"], stdout=PIPE).stdout.decode().strip() + sendmsg( + f"Uptime: {uptime}", + chan, + ) elif mfind(message, ["amIAdmin"]): sendmsg( f"{name.lower()} in {adminnames} == {name.lower() in adminnames}",