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

View File

@@ -0,0 +1,41 @@
from __future__ import annotations
from Database.x_classes import AccountRating, DownloadMode, ErrorID
from tweety.exceptions_ import UserNotFound, UserProtected
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from runtimeBotData import RuntimeBotData
class TwitterContainer():
id : int
name : str
rating : str
discord_channel_id : int = 0
discord_thread_id : int = 0
download_mode : int = 0
def __init__(self, name : str, rating = AccountRating.NSFW, discord_channel_id = 0, discord_thread_id = 0, download_mode = DownloadMode.NO_DOWNLOAD, id = 0, **kwargs):
self.id = id
self.name = name
self.rating = rating.upper()
self.discord_channel_id = discord_channel_id
self.discord_thread_id = discord_thread_id
self.download_mode = download_mode
async def UpdateMediaPosts(self, botData : RuntimeBotData):
all_posts = botData.db.get_all_post_ids(self.id)
newest_post = 1 if len(all_posts) == 0 else max(all_posts)
posts = []
try:
async for tweet in botData.twApi.get_tweets(user_name = self.name, bottom_id = newest_post, all_posts = all_posts):
posts.append(tweet)
except (UserProtected, UserNotFound) as ex:
print("User dead: ", self.name, ex)
return ErrorID.ACCOUNT_DEAD, []
except Exception as ex:
print("Error in ", self.name, ex)
return ErrorID.ACCOUNT_SKIP, []
return ErrorID.SUCCESS, posts