libs.commands.ranking.entry

libs/commands/ranking/entry.py

 1"""
 2libs/commands/ranking/entry.py
 3"""
 4
 5from typing import TYPE_CHECKING
 6
 7import libs.global_value as g
 8from libs.bootstrap.section import SubCommands
 9from libs.commands.ranking import ranking, rating
10from libs.types import CommandType
11from libs.utils import dictutil
12
13if TYPE_CHECKING:
14    from integrations.protocols import MessageParserProtocol
15
16
17class RankingConfig(SubCommands):
18    """rankingセクション処理"""
19
20    def __init__(self) -> None:
21        self.default_commandword: str = "麻雀ランキング"
22        self.section: str = str(CommandType.RANKING)
23        self.default_reset()
24
25
26def main(m: "MessageParserProtocol") -> None:
27    """
28    ランキング生成処理エントリーポイント
29
30    Args:
31        m (MessageParserProtocol): メッセージデータ
32
33    """
34    g.params = dictutil.placeholder(g.cfg.ranking, m)
35
36    if g.params.rating:  # レーティング
37        m.status.command_type = CommandType.RATING
38        rating.aggregation(m)
39    else:  # ランキング
40        m.status.command_type = CommandType.RANKING
41        ranking.aggregation(m)
class RankingConfig(libs.bootstrap.section.SubCommands):
18class RankingConfig(SubCommands):
19    """rankingセクション処理"""
20
21    def __init__(self) -> None:
22        self.default_commandword: str = "麻雀ランキング"
23        self.section: str = str(CommandType.RANKING)
24        self.default_reset()

rankingセクション処理

default_commandword: str

コマンドワードデフォルト値

section: str

セクション名

def main(m: integrations.protocols.MessageParserProtocol) -> None:
27def main(m: "MessageParserProtocol") -> None:
28    """
29    ランキング生成処理エントリーポイント
30
31    Args:
32        m (MessageParserProtocol): メッセージデータ
33
34    """
35    g.params = dictutil.placeholder(g.cfg.ranking, m)
36
37    if g.params.rating:  # レーティング
38        m.status.command_type = CommandType.RATING
39        rating.aggregation(m)
40    else:  # ランキング
41        m.status.command_type = CommandType.RANKING
42        ranking.aggregation(m)

ランキング生成処理エントリーポイント

Arguments:
  • m (MessageParserProtocol): メッセージデータ