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

54
bot.py Normal file
View File

@@ -0,0 +1,54 @@
from datetime import datetime
import os
from config import Global_Config
os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0'
from Twitter.downloader import download_loop as x_download_loop
from Pixiv.downloader import download_loop as pixiv_download_loop
#import asyncio
import nextcord
from runtimeBotData import RuntimeBotData
from nextcord.ext import tasks, commands
# asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
# loop = asyncio.new_event_loop()
# asyncio.set_event_loop(loop)
botData = RuntimeBotData()
#loop.run_until_complete(botData.initialize_data())
intents = nextcord.Intents.default()
intents.message_content = True
intents.guild_reactions = True
bot = commands.Bot(command_prefix=".", intents=intents)
botData.client = bot
bot.load_extension("commands", extras={"botData": botData})
@bot.event
async def on_ready():
if botData.initialized: return
await botData.initialize_data()
bot.add_view(botData.xView)
bot.add_view(botData.yView)
botData.initialized = True
print(f'{bot.user} has connected to nextcord!')
x_loop.start()
pixiv_loop.start()
@tasks.loop(minutes = 3 * 60)
async def x_loop():
print(datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
await x_download_loop(botData)
print("Finished: " + datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
@tasks.loop(minutes = 30)
async def pixiv_loop():
await pixiv_download_loop(botData)
if Global_Config["discord_token"] is None:
raise Exception("Discord bot token is required")
bot.run(Global_Config["discord_token"])