tempmute.help='/tempmute [user] <length> - Temporarily mutes a user in the current chat for the given length. The length should be in the format 1y2mo3w4d5h6m7s. Some natural language is supported too. Temp-mutes must be a minimum of 60 seconds in length. This command can only be used by moderators and administrators of a supergroup.'
returnmattata.send_reply(message,'You must specify a length when using this command! This should be in the format 1y2mo3w4d5h6m7s. Some natural language is supported too. temp-mute must be a minimum of 60 seconds in length.')
elseifnotuserthen
returnmattata.send_reply(message,'You must specify a user to temp-mute. This can be done by mention, reply or ID.')
end
until_date=os.time()+until_date
localuser_object=mattata.get_user(user)-- resolve the username/ID to a user object
returnmattata.send_reply(message,'It appears I don\'t have the required permissions required in order to temp-mute that user. Please amend this and try again!')
end
localsuccess=mattata.restrict_chat_member(message.chat.id,user_object.id,until_date,false,false,false,false,false,false,false,false)-- attempt to temp-mute the user in the group
ifnotsuccessthen
returnmattata.send_reply(message,'I couldn\'t temp-mute that user! Please ensure I have the required permissions and try again!')