from interactions import Client, Intents, listen from interactions.api.events import MessageCreate, ThreadCreate from interactions.client.utils import get from interactions.models.discord.channel import GuildForumPost import re from os.path import exists from messageresponder.mangadex import send_manga_response from messageresponder.thread_renamer import update_manga_thread from util.config import DB_PATH, DISCORD_TOKEN from util.db import setup_database import locale locale.setlocale(locale.LC_TIME, "") if not exists(DB_PATH): # Set up database r = setup_database() if not r: raise "Could not create database, check above for any errors!" bot = Client(intents=Intents.new(default=True, guilds=True, guild_messages=True, messages=True, message_content=True)) @listen() async def on_ready(): print("Ready") print(f"This bot is owned by {bot.owner}") @listen() async def on_message_create(event: MessageCreate): if event.message.author.bot: return # No bots if isinstance(event.message.channel, GuildForumPost) and event.message.channel.initial_post.id == event.message.id\ and event.message.channel.parent_channel.id == 1076231074927091784: # Manga Thread await update_manga_thread(event) return manga_matches = re.findall(r"<([^@]+?)>", event.message.content, re.MULTILINE) if len(manga_matches) > 0: await send_manga_response(event, manga_matches[0]) return bot.load_extension("commands.yuri") bot.load_extension("commands.link") bot.load_extension("commands.character_quiz") bot.start(DISCORD_TOKEN)