Bot config and channel init

This commit is contained in:
BreadTube 2025-09-23 04:50:23 +09:00 committed by Corentin
commit 72edbe6599
7 changed files with 499 additions and 109 deletions

18
bot.py
View file

@ -1,29 +1,13 @@
from pathlib import Path
import sys
from breadtube_bot.manager import DiscordManager
from breadtube_bot.objects import TextChannel
def main():
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)
_categories, text_channel = manager.list_channels()
breadtube_channel: TextChannel | None = None
for channel in text_channel:
if channel.name == 'breadtube-bot':
breadtube_channel = channel
break
if breadtube_channel is None:
print('Cannot find beadtube-bot channel')
sys.exit(1)
messages = manager.list_text_channel_messages(breadtube_channel)
for message in messages:
print(message)
manager.delete_message(message)
print(manager.rate_limit)
if __name__ == '__main__':