Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Banhammer: add /mute command, issue #343 #345

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

riskey95
Copy link
Contributor

No description provided.

Copy link
Member

@yangm97 yangm97 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Besides review comments, there should be some (a lot) of merge conflicts to solve, but I'd be glad to merge it once everything is sorted out since it's a very requested feature.

@@ -199,10 +199,14 @@ function api.kickUser(chat_id, user_id)
end
end

function api.muteUser(chat_id, user_id)
function api.muteUser(chat_id, user_id, until_date)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function has been moved to utilities.lua

return markup
end

local function markup_mute(chat_id, user_id, time_value)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would've been better if you could reuse the keyboard for tempban instead of copy-pasting it's code.

@@ -138,26 +179,45 @@ function plugin.onTextMessage(msg, blocks)
end

function plugin.onCallbackQuery(msg, matches)
if not u.can(msg.chat.id, msg.from.id, 'can_restrict_members') then
if not u.is_allowed('hammer', msg.chat.id, msg.from) then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you replace the new permission check with the dummy one?

if not res then
motivation = motivation or i18n("I can't kick this user.\n"
motivation = i18n("I can't kick this user.\n"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could just use the new api_err.trans() function.

@yangm97 yangm97 changed the base branch from master to develop November 20, 2018 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants