#helpers that require other helpers from __future__ import annotations from typing import TYPE_CHECKING from Database.x_classes import AccountRating, DownloadMode, x_accounts from Discord import discordHelper if TYPE_CHECKING: from runtimeBotData import RuntimeBotData async def create_x_account(handle, botData : RuntimeBotData, new_account_rating = AccountRating.NSFW, download_mode = DownloadMode.NO_DOWNLOAD): id = await botData.twApi.app.get_user_id(handle) try: thread = None channel = await discordHelper.get_channel_from_handle(botData.client.guilds[0], handle) except: thread = await discordHelper.get_thread_from_handle(botData.client.guilds[0], handle) channel = None artist = x_accounts(id= id, rating= new_account_rating, name= handle, discord_channel_id= 0 if channel is None else channel.id, discord_thread_id= 0 if thread is None else thread.id, download_mode= download_mode) if not botData.db.x_add_account(artist): raise Exception("Failed to add to database") return artist