Skip to content

Commit 576c125

Browse files
authored
Merge pull request #36 from morenod/0.6.X
0.6.2
2 parents 26089ff + 9f18b35 commit 576c125

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

punsbot.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
allowed_chars_puns = string.ascii_letters + " " + string.digits + "áéíóúàèìòùäëïöü"
1818
allowed_chars_triggers = allowed_chars_puns + "^$.*+?(){}\\[]<>=-"
19-
version = "0.6.1"
19+
version = "0.6.2"
2020
required_validations = 5
2121

2222
if 'TOKEN' not in os.environ:
@@ -298,13 +298,17 @@ def silence(message):
298298
bot.reply_to(message, 'Missing time to silence or invalid syntax: \"/punsilence "time in minutes"')
299299
return
300300
if int(quote) > 60 or not quote.isdigit():
301-
bot.reply_to(message, 'Disabling PunsBot for more than one hour is not funny 😢')
301+
bot.reply_to(message, 'Disabling PunsBot for more than an hour is not funny 😢')
302302
return
303303
chatoptions = load_chat_options(message.chat.id)
304304
if chatoptions['silence'] is None or int(chatoptions['silence']) <= int(time.time()):
305305
chatoptions['silence'] = 60 * int(quote) + int(time.time())
306306
else:
307-
chatoptions['silence'] = 60 * int(quote) + int(chatoptions['silence'])
307+
if int(chatoptions['silence']) + 60 * int(quote) - int(time.time()) >= 3600:
308+
bot.reply_to(message, 'Disabling PunsBot for more than an hour is not funny 😢')
309+
return
310+
else:
311+
chatoptions['silence'] = 60 * int(quote) + int(chatoptions['silence'])
308312
set_chat_options(chatoptions)
309313
bot.reply_to(message, 'PunsBot will be muted until ' + time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(chatoptions['silence'])))
310314

0 commit comments

Comments
 (0)