Page Menu
Home
Phabricator (Chris)
Search
Configure Global Search
Log In
Files
F135221
ping.lua
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
672 B
Referenced Files
None
Subscribers
None
ping.lua
View Options
--[[
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
Details
Attached
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)
Attached To
Mode
R69 mattata
Attached
Detach File
Event Timeline