-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetrules.py
More file actions
31 lines (29 loc) · 1.03 KB
/
setrules.py
File metadata and controls
31 lines (29 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env python3
# setrules.py
# Python 3.7
# Version 0.3 "Acrux"
#
# Created by Talebian & Francesco Masala
# Mozilla Public License
#
import json
from datetime import datetime
from utils import decorator
from sentry_sdk import capture_message
@decorator.admin.init
def setrules_handler(update, context):
new_rules = "{}".format(update.message.text[10:])
rules = {"rules": new_rules }
with open('commands/felinesec.rules.json', 'w') as rules_js:
json.dump(rules, rules_js)
update.message.reply_markdown("*Regole applicate!*")
# Logging
user = update.message.from_user
messagetime = datetime.strftime(datetime.today(), '%H:%M del %d/%m/%Y')
comando = "setrules"
capture_message("Un amministratore con ID {} ha appena "
.format(user['id']) +
"effettuato il comando /" + comando)
print('Admin: {} con ID: {} '.format(user['username'], user['id'])
+ "Ha appena eseguito il seguente comando: /" + comando +
" Alle ore " + messagetime)