Skip to content

Commit

Permalink
quest
Browse files Browse the repository at this point in the history
  • Loading branch information
Nftiger committed May 8, 2024
1 parent 4a26c43 commit 57d7a19
Showing 2 changed files with 45 additions and 0 deletions.
40 changes: 40 additions & 0 deletions events/all_ref_top.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import random
from vkbottle.bot import MessageEvent

import data
import keyboard
from bot import bot

# Обработка команды "🔝 Топ игроков"
async def message(event: MessageEvent):


top = await data.get_ref_count_top()
# Показать топ 5 игроков
# Если пользователь не в топе, показать его место в конце с сообщением "Вы находитесь на N месте"

user_in_top = False
for i, user in enumerate(top):
count = user[1]
user = await bot.api.users.get(user_ids=user[0])
user = user[0]
name = user.first_name + " " + user.last_name[0] + "."
bot_message += f"{i+1}. {name} - {count} приглашено\n"
if user.id == event.object.peer_id:
user_in_top = True
if i == 4:
break
if not user_in_top:
for i, user in enumerate(top):
if user[0] == event.object.peer_id:
count = user[1]
bot_message += f"\nВы находитесь на {i+1} месте. Приглашено: {count}.\n"
break
await bot.api.messages.send(
user_id=event.object.peer_id,
message=bot_message,
random_id=random.randint(0, 2 ** 64),
keyboard=keyboard.ref_race_keyboard()
)

await event.show_snackbar("🔝 Топ игроков")
5 changes: 5 additions & 0 deletions quests.json
Original file line number Diff line number Diff line change
@@ -34,6 +34,11 @@
"group_id": 219658005,
"reward": 100000
},
"8": {
"description": "Подписаться на Gorillza:\nhttps://vk.com/cryptogorillza",
"group_id": 221012805,
"reward": 100000
},
"1000": {
"description": "Подписаться на Новое Кадило:\nhttps://vk.com/newkadilo",
"group_id": 211786038,

0 comments on commit 57d7a19

Please sign in to comment.