Config scan from bot channel implementation

This commit is contained in:
BreadTube 2025-09-23 22:48:35 +09:00 committed by Corentin
commit 157e8c1b17
6 changed files with 453 additions and 34 deletions

20
bot.py
View file

@ -1,13 +1,27 @@
from argparse import ArgumentParser
import logging
from pathlib import Path
from breadtube_bot.manager import DiscordManager
def main():
parser = ArgumentParser('BreadTube-bot')
parser.add_argument('--guild', type=int, default=1306964577812086824, help='Guild id to manage')
parser.add_argument('--debug', action='store_true', default=False, help='Run in debug mode (for logs)')
arguments = parser.parse_args()
debug_mode: bool = arguments.debug
guild_id: int = arguments.guild
del arguments
bot_token = Path('data/discord_bot_token.txt').read_text(encoding='utf-8').strip()
guild_id = 1306964577812086824
manager = DiscordManager(bot_token=bot_token, guild_id=guild_id)
print(manager.rate_limit)
manager = DiscordManager(
bot_token=bot_token, guild_id=guild_id, log_level=logging.DEBUG if debug_mode else logging.INFO)
try:
manager.run()
except KeyboardInterrupt:
print('\r ') # noqa: T201
if __name__ == '__main__':