Skip to content
This repository was archived by the owner on Oct 14, 2018. It is now read-only.

Commit f7df5b5

Browse files
committed
Prepare banhammer plugin for supergorups. No channel_kick_user
1 parent ffec87e commit f7df5b5

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

plugins/banhammer.lua

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ local function pre_process(msg)
6565
end
6666

6767
-- BANNED USER TALKING
68-
if msg.to.type == 'chat' then
68+
if msg.to.type == 'chat' or msg.to.type == 'channel' then
6969
local user_id = msg.from.id
7070
local chat_id = msg.to.id
7171
local banned = is_banned(user_id, chat_id)
@@ -89,7 +89,7 @@ local function pre_process(msg)
8989

9090
if not allowed then
9191
print('User '..msg.from.id..' not whitelisted')
92-
if msg.to.type == 'chat' then
92+
if msg.to.type == 'chat' or msg.to.type == 'channel' then
9393
allowed = is_chat_whitelisted(msg.to.id)
9494
if not allowed then
9595
print ('Chat '..msg.to.id..' not whitelisted')
@@ -123,7 +123,7 @@ local function run(msg, matches)
123123
local user_id = matches[3]
124124
local chat_id = msg.to.id
125125

126-
if msg.to.type == 'chat' then
126+
if msg.to.type == 'chat' or msg.to.type == 'channel' then
127127
if matches[2] == 'user' then
128128
ban_user(user_id, chat_id)
129129
return 'User '..user_id..' banned'
@@ -139,7 +139,7 @@ local function run(msg, matches)
139139
end
140140

141141
if matches[1] == 'kick' then
142-
if msg.to.type == 'chat' then
142+
if msg.to.type == 'chat' or msg.to.type == 'channel' then
143143
kick_user(matches[2], msg.to.id)
144144
else
145145
return 'This isn\'t a chat group'
@@ -166,7 +166,7 @@ local function run(msg, matches)
166166
end
167167

168168
if matches[2] == 'chat' then
169-
if msg.to.type ~= 'chat' then
169+
if msg.to.type ~= 'chat' and msg.to.type ~= 'channel' then
170170
return 'This isn\'t a chat group'
171171
end
172172
local hash = 'whitelist:chat#id'..msg.to.id
@@ -181,7 +181,7 @@ local function run(msg, matches)
181181
end
182182

183183
if matches[2] == 'delete' and matches[3] == 'chat' then
184-
if msg.to.type ~= 'chat' then
184+
if msg.to.type ~= 'chat' and msg.to.type ~= 'channel' then
185185
return 'This isn\'t a chat group'
186186
end
187187
local hash = 'whitelist:chat#id'..msg.to.id

0 commit comments

Comments
 (0)