Esempio n. 1
0
    def __init__(self, bot: SeasonalBot) -> None:
        """
        Assign safe default values on init.

        At this point, we don't have information about currently available branding.
        Most of these attributes will be overwritten once the daemon connects, or once
        the `refresh` command is used.
        """
        self.bot = bot
        self.current_season = get_current_season()

        self.banner = None
        self.avatar = None

        self.available_icons = []
        self.remaining_icons = []

        self.days_since_cycle = itertools.cycle([None])

        self.config_file = make_persistent(
            Path("bot", "resources", "evergreen", "branding.json"))
        should_run = self._read_config()["daemon_active"]

        if should_run:
            self.daemon = self.bot.loop.create_task(self._daemon_func())
        else:
            self.daemon = None
Esempio n. 2
0
    def __init__(self, bot: commands.Bot):
        self.bot = bot
        self.json_file = make_persistent(
            Path("bot", "resources", "halloween", "candy_collection.json"))

        with self.json_file.open() as fp:
            candy_data = json.load(fp)

        self.candy_records = candy_data.get("records", dict())

        # Message ID where bot added the candies/skulls
        self.candy_messages = set()
        self.skull_messages = set()
Esempio n. 3
0
 def __init__(self, bot: commands.Bot):
     self.bot = bot
     self.link_json = make_persistent(Path("bot", "resources", "halloween", "github_links.json"))
     self.linked_accounts = self.load_linked_users()