This commit is contained in:
emmatveev 2024-05-18 10:22:47 +03:00
parent a7498523b3
commit 0df4950b8e

18
main.py
View File

@ -63,7 +63,7 @@ def show_rating(message: Message):
@bot.message_handler(commands=['point'])
def show_rating(message: Message):
def point(message: Message):
if not message.reply_to_message:
bot.reply_to(message, 'Чтобы начислить Ебаллы, нужно прописать команду ответом на чье-то сообщение')
return
@ -75,6 +75,22 @@ def show_rating(message: Message):
bot.reply_to(message.reply_to_message, 'Тебе начислили Ебалл!')
@bot.message_handler(commands=['pointers'])
def pointers(message: Message):
rating = list(mongo.counter_collection.find({"chat_id": message.chat.id}).sort("points", -1))
if not rating:
bot.send_message(message.chat.id, "Ебаллы пока никому не начислялись")
return
text = "Рейтинг Ебальников:\n"
rating_arr = list(enumerate(rating))
total = 0
for _, value in rating_arr:
total += value['points']
for index, value in rating_arr:
text += f"{index + 1}. @{value['username']} - {value['points']}\n"
bot.send_message(message.chat.id, text)
@bot.message_handler()
def do_action(message: Message):
if message.reply_to_message: