2022-10-18 19:17:36 +10:00
|
|
|
import logging
|
2024-01-21 22:33:15 +10:00
|
|
|
from aiogram import executor, Bot, Dispatcher
|
2022-12-10 02:02:59 +10:00
|
|
|
from create_bot import dp
|
2022-12-16 22:16:21 +10:00
|
|
|
import handlers
|
2024-01-21 21:35:52 +10:00
|
|
|
import json
|
2024-01-21 22:33:15 +10:00
|
|
|
from global_conf import CONFIG
|
2022-12-13 16:34:55 +10:00
|
|
|
|
|
|
|
|
2022-12-10 02:15:32 +10:00
|
|
|
|
2024-01-21 21:35:52 +10:00
|
|
|
def remake_field_generator(d, field='text'):
|
|
|
|
for k, v in d.items():
|
|
|
|
if k == field:
|
|
|
|
d[k] = '<blank!>'
|
|
|
|
yield v
|
|
|
|
elif isinstance(v, list):
|
|
|
|
for k2 in v:
|
|
|
|
for id_val in remake_field_generator(k2):
|
|
|
|
yield id_val
|
|
|
|
elif isinstance(v, dict):
|
|
|
|
for id_val in remake_field_generator(v):
|
|
|
|
yield id_val
|
|
|
|
|
|
|
|
def filter_grammar_messages(record):
|
|
|
|
if record.args and (not None in record.args):
|
|
|
|
j = json.loads(record.args[2])
|
|
|
|
for _ in remake_field_generator(j):
|
|
|
|
pass
|
|
|
|
record.args = (record.args[0], record.args[1], json.dumps(j))
|
|
|
|
return True
|
|
|
|
|
|
|
|
logging.basicConfig(level=logging.DEBUG)
|
|
|
|
logging.getLogger("aiogram").addFilter(filter_grammar_messages)
|
|
|
|
|
2022-12-13 16:34:55 +10:00
|
|
|
|
2022-12-13 17:51:47 +10:00
|
|
|
# pipisa.register_handlers_pipisa(dp)
|
|
|
|
# time_new_year.register_handlers_time(dp)
|
|
|
|
# sendalarm.register_handlers_test(dp)
|
|
|
|
# start_help.register_handlers_StartHelp(dp)
|
2022-10-30 20:49:19 +10:00
|
|
|
|
2022-10-18 19:17:36 +10:00
|
|
|
if __name__ == '__main__':
|
2024-01-21 22:33:15 +10:00
|
|
|
#print(CONFIG)
|
|
|
|
|
2022-10-18 19:17:36 +10:00
|
|
|
executor.start_polling(dp, skip_updates=True)
|
2022-12-04 15:45:15 +10:00
|
|
|
|
2022-12-13 16:34:55 +10:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|