Page MenuHomePhabricator (Chris)

ping.lua
No OneTemporary

Authored By
Unknown
Size
672 B
Referenced Files
None
Subscribers
None

ping.lua

--[[
mattata v2.0 - Ping Plugin
]]
local plugin = {}
plugin.name = 'ping'
plugin.category = 'utility'
plugin.description = 'Check bot responsiveness'
plugin.commands = { 'ping', 'pong' }
plugin.help = '/ping - PONG!'
function plugin.on_message(api, message, ctx)
local socket = require('socket')
local latency = math.floor((socket.gettime() - (message.date or socket.gettime())) * 1000)
if message.command == 'pong' then
return api.send_message(message.chat.id, 'You really have to go the extra mile, don\'t you?')
end
return api.send_message(message.chat.id, string.format('Pong! <code>%dms</code>', latency), 'html')
end
return plugin

File Metadata

Mime Type
text/plain
Expires
Thu, Jun 25, 8:40 PM (3 d, 12 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
73040
Default Alt Text
ping.lua (672 B)

Event Timeline