breadtube-bot/bot.py
2025-10-04 16:51:08 +09:00

30 lines
884 B
Python

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)
if __name__ == '__main__':
main()