fresh start

This commit is contained in:
2026-01-08 22:07:03 +01:00
commit 715be97289
30 changed files with 2302 additions and 0 deletions

26
helpers_adv.py Normal file
View File

@@ -0,0 +1,26 @@
#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