Page Menu
Home
Phabricator (Chris)
Search
Configure Global Search
Log In
Files
F621482
allowedlinks.lua
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
allowedlinks.lua
View Options
--[[
mattata v2.0 - Allowed Links Plugin
]]
local
plugin
=
{}
plugin
.
name
=
'allowedlinks'
plugin
.
category
=
'admin'
plugin
.
description
=
'List allowed links in the group'
plugin
.
commands
=
{
'allowedlinks'
}
plugin
.
help
=
'/allowedlinks - Lists all links that are allowed in this group when anti-link is enabled.'
plugin
.
group_only
=
true
plugin
.
admin_only
=
true
function
plugin
.
on_message
(
api
,
message
,
ctx
)
local
tools
=
require
(
'telegram-bot-lua.tools'
)
local
result
=
ctx
.
db
.
call
(
'sp_get_allowed_links'
,
{
message
.
chat
.
id
})
if
not
result
or
#
result
==
0
then
return
api
.
send_message
(
message
.
chat
.
id
,
'No links are allowlisted. Use /allowlink <link> to add one.'
)
end
local
output
=
'<b>Allowed links:</b>
\n\n
'
for
i
,
row
in
ipairs
(
result
)
do
output
=
output
..
string.format
(
'%d. <code>%s</code>
\n
'
,
i
,
tools
.
escape_html
(
row
.
link
))
end
output
=
output
..
string.format
(
'
\n
<i>Total: %d link(s)</i>
\n
Use /allowlink <link> to add more.'
,
#
result
)
api
.
send_message
(
message
.
chat
.
id
,
output
,
'html'
)
end
return
plugin
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 14, 7:10 PM (2 h, 23 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
136372
Default Alt Text
allowedlinks.lua (1 KB)
Attached To
Mode
R69 mattata
Attached
Detach File
Event Timeline