Page Menu
Home
Phabricator (Chris)
Search
Configure Global Search
Log In
Files
F622504
leavefed.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
leavefed.lua
View Options
--[[
mattata v2.0 - Federation: leavefed
Removes the current chat from its federation. Requires group admin.
]]
local
tools
=
require
(
'telegram-bot-lua.tools'
)
local
plugin
=
{}
plugin
.
name
=
'leavefed'
plugin
.
category
=
'admin'
plugin
.
description
=
'Remove this chat from its federation.'
plugin
.
commands
=
{
'leavefed'
}
plugin
.
help
=
'/leavefed - Remove this chat from its current federation.'
plugin
.
group_only
=
true
plugin
.
admin_only
=
true
function
plugin
.
on_message
(
api
,
message
,
ctx
)
local
chat_id
=
message
.
chat
.
id
local
existing
=
ctx
.
db
.
call
(
'sp_get_chat_federation_joined'
,
{
chat_id
})
if
not
existing
or
#
existing
==
0
then
return
api
.
send_message
(
chat_id
,
'This chat is not part of any federation.'
,
{
parse_mode
=
'html'
}
)
end
local
fed
=
existing
[
1
]
ctx
.
db
.
call
(
'sp_leave_federation'
,
{
fed
.
id
,
chat_id
})
return
api
.
send_message
(
chat_id
,
string.format
(
'This chat has left the federation <b>%s</b>.'
,
tools
.
escape_html
(
fed
.
name
)
),
{
parse_mode
=
'html'
}
)
end
return
plugin
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 14, 8:15 PM (11 h, 23 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
126163
Default Alt Text
leavefed.lua (1 KB)
Attached To
Mode
R69 mattata
Attached
Detach File
Event Timeline