aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/hydroroll/plugins/plugin_luck/__init__.py
blob: 7967a0b3f331ef427e17ebc813e576b6bb1d19c6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import re
import time
import random

from plugins.plugin_base import CommandPluginBase

from .config import Config


class Luck(CommandPluginBase[None, Config]):
    Config = Config

    def __post_init__(self):
        self.re_pattern = re.compile(r".*", flags=re.I)

    async def handle(self) -> None:
        random.seed(
            time.strftime("%Y%j", time.localtime()) + self.format_str("{user_id}")
        )
        lucy = random.randint(self.config.min_int, self.config.max_int)
        await self.event.reply(self.format_str(self.config.message_str, str(lucy)))