This repository has been archived on 2021-04-24. You can view files and clone it, but cannot push or open issues or pull requests.
Mikubot-2/miku/plugins/speedtest_cli.lua

21 lines
729 B
Lua
Raw Normal View History

2016-08-16 14:39:06 +02:00
local speedtest_cli = {}
function speedtest_cli:init(config)
speedtest_cli.triggers = utilities.triggers(self.info.username, config.cmd_pat):t('speedtest', true).table
end
function speedtest_cli:action(msg, config)
2016-08-24 17:18:17 +02:00
utilities.send_typing(msg.chat.id, 'typing')
2016-12-16 19:00:42 +01:00
local result = run_command('speedtest --share')
2016-08-16 14:39:06 +02:00
local url = result:match("Share results: (.*)")
print('URL: '..url)
local text = 'http://www.speedtest.net/my-result/'..url:match('http://www.speedtest.net/result/(.*).png')
2016-08-24 17:18:17 +02:00
utilities.send_typing(msg.chat.id, 'upload_photo')
if not url then
2016-08-24 17:18:17 +02:00
utilities.send_reply(msg, config.errors.connection)
2016-08-16 14:39:06 +02:00
return
end
utilities.send_photo(msg.chat.id, url, text, msg.message_id)
2016-08-16 14:39:06 +02:00
end
return speedtest_cli