adding nối từ game

This commit is contained in:
2025-06-23 17:01:31 +07:00
parent 300807e26a
commit 537be0c4ab
15 changed files with 752 additions and 32 deletions
+2 -1
View File
@@ -16,12 +16,13 @@ intents.guilds = True
bot = commands.Bot(command_prefix='!', intents=intents)
# Initialize repositories
from repositories import ServerRepository, ChannelRepository, ChannelAppRepository, HomeDebtRepository
from repositories import ServerRepository, ChannelRepository, ChannelAppRepository, HomeDebtRepository, CurrencyRepository
server_repo = ServerRepository()
channel_repo = ChannelRepository()
channel_app_repo = ChannelAppRepository()
home_debt_repo = HomeDebtRepository()
currency_repo = CurrencyRepository()
# Store user cooldowns
from typing import Dict, Set
+5 -14
View File
@@ -1,21 +1,12 @@
import discord
from core.bot import bot
from core.tasks import sync_commands
# from core.tasks import sync_commands
# Using for sync commands to all guilds
@bot.event
async def on_ready():
print(f'{bot.user} đã tham gia vào server!')
await sync_commands.start()
print("Đã đồng bộ lệnh!")
# @bot.event
# async def on_ready():
# guild_id = 536422615649091595
# guild_obj = discord.Object(id=guild_id)
# try:
# synced = await bot.tree.sync(guild=guild_obj)
# print(f"🔁 Synced {len(synced)} command(s) to guild {guild_id}")
# except Exception as e:
# print(f"❌ Failed to sync commands to guild {guild_id}: {e}")
# await sync_commands.start()
TEST_GUILD_ID = discord.Object(id=536422615649091595)
await bot.tree.sync(guild=TEST_GUILD_ID)
print("Đã đồng bộ lệnh!")
+1 -6
View File
@@ -14,9 +14,4 @@ from core.bot import bot
# new_exp = current_exp + VOICE_EXP_POINTS_PER_MINUTE
# await user_repo.update_exp(user_id, new_exp)
# await user_repo.update_voice_time(user_id, current_time.isoformat())
# print(f"Thêm {VOICE_EXP_POINTS_PER_MINUTE} điểm kinh nghiệm cho user {user_id} cho thời gian voice")
@tasks.loop(minutes=1)
async def sync_commands():
await bot.tree.sync()
print("Đã đồng bộ lệnh!")
# print(f"Thêm {VOICE_EXP_POINTS_PER_MINUTE} điểm kinh nghiệm cho user {user_id} cho thời gian voice")