Page Menu
Home
Phabricator (Chris)
Search
Configure Global Search
Log In
Files
F630441
wordfilter.mattata
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
wordfilter.mattata
View Options
--[[
Copyright 2020 Matthew Hesketh <matthew@matthewhesketh.com>
This code is licensed under the MIT. See LICENSE for details.
]]
local wordfilter = {}
local mattata = require('mattata')
local redis = dofile('libs/redis.lua')
function wordfilter:init()
wordfilter.commands = mattata.commands(self.info.username):command('wordfilter').table
wordfilter.help = '/wordfilter - View a list of words which have been added to the chat\'s word filter.'
end
function wordfilter:on_message(message, configuration, language)
if message.chat.type ~= 'supergroup'
then
return mattata.send_reply(
message,
language['errors']['supergroup']
)
elseif not mattata.is_group_admin(
message.chat.id,
message.from.id
)
then
return mattata.send_reply(
message,
language['errors']['admin']
)
end
local words = redis:smembers('word_filter:' .. message.chat.id)
if #words < 1
then
return mattata.send_reply(
message,
'There are no words filtered in this chat. To add words to the filter, use /filter <word(s)>.'
)
end
return mattata.send_message(
message.chat.id,
'Filtered words: ' .. table.concat(words, ', ')
)
end
return wordfilter
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 15, 9:29 AM (1 d, 21 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
137751
Default Alt Text
wordfilter.mattata (1 KB)
Attached To
Mode
R69 mattata
Attached
Detach File
Event Timeline