-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathresults.py
66 lines (49 loc) · 1.76 KB
/
results.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
from __future__ import annotations
from typing import TYPE_CHECKING, List
from telegram import InlineQueryResultArticle
from telegram import InlineQueryResultCachedSticker as Sticker
from telegram import InputTextMessageContent
from card import YELLOW_CARD
if TYPE_CHECKING:
from telegram import InlineQueryResult
from game import Game
from player import Player
def add_purple_cards(results: List[InlineQueryResult], game: Game):
"""Add purple cards"""
for card in game.purple_deck.cards[-2:]:
results.append(
Sticker("purple" + str(card), sticker_file_id=card.sticker["file_id"])
)
def add_cards(results: List[InlineQueryResult], player: Player):
"""Add player's cards"""
content = "選ㄌ一張 " + YELLOW_CARD
for card in player.cards:
results.append(
Sticker(
str(card),
sticker_file_id=card.sticker["file_id"],
input_message_content=InputTextMessageContent(content),
)
)
def add_no_game(results: List[InlineQueryResult]):
"""Add text result if user is not playing"""
results.append(
InlineQueryResultArticle(
"nogame",
title="你沒在玩ㄡ",
input_message_content=InputTextMessageContent("趕快加入遊戲好ㄇ"),
)
)
def add_not_started(results: List[InlineQueryResult]):
"""Add text result if the game has not yet started"""
results.append(
InlineQueryResultArticle(
"nogame",
title="還沒開始ㄡ",
input_message_content=InputTextMessageContent("趕快按開始ㄅ"),
)
)
def add_gameinfo(game, results):
"""Add option to show game info"""
# TODO: show 每個人獲得幾張黃牌
pass