forked from Pavel_Durov/python_bot
#4 wow, we beccomin secure!
This commit is contained in:
parent
deac88534a
commit
d6da239718
27
bot.py
27
bot.py
@ -2,10 +2,34 @@ import logging
|
|||||||
from aiogram import executor
|
from aiogram import executor
|
||||||
from create_bot import dp
|
from create_bot import dp
|
||||||
import handlers
|
import handlers
|
||||||
|
import json
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
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.basicConfig(level=logging.DEBUG)
|
||||||
|
logging.getLogger("aiogram").addFilter(filter_grammar_messages)
|
||||||
|
|
||||||
|
|
||||||
# pipisa.register_handlers_pipisa(dp)
|
# pipisa.register_handlers_pipisa(dp)
|
||||||
@ -13,7 +37,6 @@ logging.basicConfig(level=logging.DEBUG)
|
|||||||
# sendalarm.register_handlers_test(dp)
|
# sendalarm.register_handlers_test(dp)
|
||||||
# start_help.register_handlers_StartHelp(dp)
|
# start_help.register_handlers_StartHelp(dp)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
executor.start_polling(dp, skip_updates=True)
|
executor.start_polling(dp, skip_updates=True)
|
||||||
|
|
||||||
|
@ -27,6 +27,9 @@ async def up_dick(message: types.Message):
|
|||||||
dicks_collection = pipisa_db.collection('dicks')
|
dicks_collection = pipisa_db.collection('dicks')
|
||||||
|
|
||||||
|
|
||||||
|
#### TODO уплатить нолог с 100 см для самого нищего
|
||||||
|
|
||||||
|
|
||||||
# рандомайзер
|
# рандомайзер
|
||||||
numb = randint(-9,10)
|
numb = randint(-9,10)
|
||||||
dick_plus = (
|
dick_plus = (
|
||||||
|
Loading…
Reference in New Issue
Block a user