static startInternetTrafficCountBot_Data startInternetTrafficCountBot_data; static Lock startInternetTrafficCountBot_lock = lock(); concept startInternetTrafficCountBot_Data { long downloaded, uploaded; } static void startInternetTrafficCountBot() { S bot = "Internet Traffic Counter."; if (!hasBot(bot)) { startInternetTrafficCountBot_answer(""); // load makeBot(bot, f startInternetTrafficCountBot_answer); } } static S startInternetTrafficCountBot_answer(S s) { lock startInternetTrafficCountBot_lock; if (startInternetTrafficCountBot_data == null) startInternetTrafficCountBot_data = uniq(new Concepts(#1009802).persist(), startInternetTrafficCountBot_Data); startInternetTrafficCountBot_Data data = startInternetTrafficCountBot_data; new Matches m; if "register downloaded bytes *" { data.downloaded += parseInt($1); data.change(); ret "OK, total: " + data.downloaded + "/" + data.uploaded; } if "register uploaded bytes *" { data.uploaded += parseInt($1); data.change(); ret "OK, total: " + data.downloaded + "/" + data.uploaded; } if "get traffic stats|traffic stats" ret "Total bytes downloaded/uploaded: " + data.downloaded + "/" + data.uploaded; null; }
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1009802 |
Snippet name: | startInternetTrafficCountBot |
Eternal ID of this version: | #1009802/8 |
Text MD5: | a6e450ecd430004cc992d815566954f4 |
Author: | stefan |
Category: | javax / talking robots |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-11-13 23:51:04 |
Source code size: | 1287 bytes / 39 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 514 / 775 |
Version history: | 7 change(s) |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) #1009802 - startInternetTrafficCountBot #1009926 - startVMLister |