Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion bot/seedbot.lua
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,8 @@ function create_config( )
"download_media",
"invite",
"all",
"leave_ban"
"leave_ban",
"block_user"
},
sudo_users = {110626080,103649648,111020322,0,tonumber(our_id)},--Sudo users
disabled_channels = {},
Expand Down
18 changes: 18 additions & 0 deletions plugins/block_user.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
local function run(msg, matches)
if matches[1] == "block" then
local user_id = "user#id"..matches[2]
block_user(user_id, ok_cb, false)
end
if matches[1] == "unblock" then
local user_id = "user#id"..matches[2]
unblock_user(user_id, ok_cb, false)
end
end

return {
patterns = {
"^[!/](block) (.*)$",
"^[!/](unblock) (.*)$"
},
run = run
}
49 changes: 22 additions & 27 deletions plugins/inpm.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,12 @@ local function chat_list(msg)
file:flush()
file:close()
return message

end


function run(msg, matches)
local function run(msg, matches)
if msg.to.type ~= 'chat' or is_sudo(msg) or is_admin(msg) and is_realm(msg) then
local data = load_data(_config.moderation.data)
if matches[1] == 'join' and data[tostring(matches[2])] then
if data[tostring(matches[2])]['settings']['public'] == 'no' then
if is_banned(msg.from.id, matches[2]) then
return 'You are banned.'
end
Expand All @@ -53,45 +50,43 @@ function run(msg, matches)
if data[tostring(matches[2])]['settings']['lock_member'] == 'yes' and not is_owner2(msg.from.id, matches[2]) then
return 'Group is private.'
end
local chat = "chat#id"..matches[2]
local user = "user#id"..msg.from.id
chat_add_user(chat, user, ok_cb, false)
else
return "Chat not found."
local chat_id = "chat#id"..matches[2]
local user_id = "user#id"..msg.from.id
chat_add_user(chat_id, user_id, ok_cb, false)
local group_name = data[tostring(matches[2])]['settings']['set_name']
return "Added you to chat:\n\n👥"..group_name.." (ID:"..matches[2]..")"
elseif matches[1] == 'join' and not data[tostring(matches[2])] then

return "Chat not found."
end
end
-- SERVICE MESSAGE IN GROUP
--[[if msg.action and msg.action.type then
local action = msg.action.type
local receiver = 'user#id'..msg.action.user.id
local group_name = string.gsub(msg.to.print_name, '_', ' ')
--Check if user from pm joins chat via bot
if action == "chat_add_user" and msg.action.to == matches[2] and msg.from.id == 0 then
print ("Added "..msg.action.user.id.." to chat "..msg.to.print_name.." (ID:"..msg.to.id..")")
savelog(msg.from.print_name.." PM", "Added "..msg.action.user.id.." to chat "..msg.to.print_name.." (ID:"..msg.to.id..")")
send_large_msg(receiver, "Added you to chat:\n\n"..group_name.." (ID:"..msg.to.id..")")
end
end]]
if matches[1] == 'chats'then
if is_admin(msg) and msg.to.type == 'chat' then
return chat_list(msg)
elseif msg.to.type ~= 'chat' then
return chat_list(msg)
end
end
if matches[1] == 'chatlist'then
if is_admin(msg) and msg.to.type == 'chat' then
chat_list(msg)
chat_list(msg)
send_document("chat#id"..msg.from.id, "./groups/lists/listed_groups.txt", ok_cb, false)
elseif msg.to.type ~= 'chat' then
chat_list(msg)
chat_list(msg)
send_document("user#id"..msg.from.id, "./groups/lists/listed_groups.txt", ok_cb, false)
end
end
end
end
end

end

return {
patterns = {
"^[/!](chats)$",
"^[/!](chatlist)$",
"^[/!](join) (.*)$",
"^[/!](kickme) (.*)$",
"^!!tgservice (chat_add_user)$"
},
run = run,
}
end