From f1e1900a069f0e4cf36803a4fd1f6f42692497ec Mon Sep 17 00:00:00 2001 From: Akamaru Date: Mon, 1 Aug 2016 21:12:33 +0200 Subject: [PATCH] =?UTF-8?q?#traffic=20Befehl=20hinzugef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/sh.lua | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/plugins/sh.lua b/plugins/sh.lua index b88f776..3e299fa 100644 --- a/plugins/sh.lua +++ b/plugins/sh.lua @@ -39,7 +39,6 @@ local function run(msg, matches) if string.match(msg.text, '^#[Ss][Cc][Rr][Ee][Ee][Nn]$') then text = run_bash("scrot 'scrot.png' -e 'mv $f ~/Mikubot/tmp/'") send_photo(get_receiver(msg), "tmp/scrot.png", ok_cb, false) - return 'Screenshot wird gesendet!' end -- Requires fswebcam (sudo apt-get install fswebcam) @@ -53,6 +52,12 @@ local function run(msg, matches) text = 'Es gibt '..string.match(cmd, '(%d+) aktualisiert')..' Updates' return text end + + -- Requires vnstat & vnstati (sudo apt-get install vnstat vnstati) + if string.match(msg.text, '^#[Tt][Rr][Aa][Ff][Ff][Ii][Cc]$') then + text = run_bash("vnstati -m -vs -i enp2s0 -o tmp/vnstat.png") + send_photo(get_receiver(msg), "tmp/vnstat.png", ok_cb, false) + end end @@ -63,7 +68,8 @@ return { "^#[Uu][Pp][Tt][Ii][Mm][Ee]$", "^#[Ss][Cc][Rr][Ee][Ee][Nn]$", "^#[Cc][Hh][Ee][Cc][Kk]$", - "^#[Ww][Ee][Bb][Cc][Aa][Mm]$" + "^#[Ww][Ee][Bb][Cc][Aa][Mm]$", + "^#[Tt][Rr][Aa][Ff][Ff][Ii][Cc]$" }, run = run, privileged = true