From aed4df32f9ee9ab36381d8a4ff9ecfb10f6d94fd Mon Sep 17 00:00:00 2001 From: Pavel_Duron Date: Thu, 1 Dec 2022 19:12:16 +1000 Subject: [PATCH] add new column chat id --- bot.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/bot.py b/bot.py index 50186c3..cc3f836 100644 --- a/bot.py +++ b/bot.py @@ -20,6 +20,9 @@ logging.basicConfig(level=logging.DEBUG) bot = Bot(token=API_TOKEN, parse_mode="HTML") dp = Dispatcher(bot) +@dp.message_handler(commands=["chat"]) +async def send_chat(message: types.Message): + await message.answer(f'{message.chat.id}') @dp.message_handler(commands=["time"]) @@ -75,7 +78,7 @@ async def ident(message: types.Message): if abs(diff) <= 0: - await bot.send_message(message.chat.id, f'@{message.from_user.username},🚫 Π²Ρ‹ ΡƒΠΆΠ΅ ΠΊΡ€ΡƒΡ‚ΠΈΠ»ΠΈ пипису, Π΅Π΅ Ρ€Π°Π·ΠΌΠ΅Ρ€ {b.dick_size} см! ') + await bot.send_message(message.chat.id, f'@{message.from_user.url},🚫 Π²Ρ‹ ΡƒΠΆΠ΅ ΠΊΡ€ΡƒΡ‚ΠΈΠ»ΠΈ пипису, Π΅Π΅ Ρ€Π°Π·ΠΌΠ΅Ρ€ {b.dick_size} см! ') session.close_all() print(diff) print(type(diff)) @@ -89,7 +92,8 @@ async def ident(message: types.Message): session.close_all() else: - int_table = user(user_id = message.from_user.id, user_fullname = message.from_user.full_name, dick_size = numb, datetimes = datetime.datetime.now()) + int_table = user(user_id = message.from_user.id, user_fullname = message.from_user.full_name, dick_size = numb, datetimes = datetime.datetime.now(),\ +chat_id = message.chat.id) session.add(int_table) session.commit() await bot.send_message(message.chat.id, f'@{message.from_user.username}, ваш писюн {size_change}\n\ @@ -117,7 +121,7 @@ async def send_time(message: types.Message): session = Session() Base = declarative_base() - top = session.query(user.user_fullname, user.dick_size).order_by(user.dick_size.desc()).limit(10).all() + top = session.query(user.user_fullname, user.dick_size).order_by(user.dick_size.desc()).filter(user.chat_id == user.chat_id).limit(10).all() delimiter = ': ' await bot.send_message(message.chat.id, f'πŸ†Π’ΠΎΠΏ 10 Π±ΡƒΠ±Ρ‹Π»Π΄πŸ†\n\n\