remove unuse file and modify home debt app

This commit is contained in:
2025-06-26 16:51:54 +07:00
parent c31cff8749
commit 464bb18b3c
10 changed files with 84 additions and 362 deletions
+39 -14
View File
@@ -2,6 +2,7 @@ import os
import discord
from discord.ext import commands
from dotenv import load_dotenv
from repositories import HomeDebtRepository, CurrencyRepository
# Load environment variables
load_dotenv()
@@ -16,22 +17,46 @@ intents.guilds = True
bot = commands.Bot(command_prefix='!', intents=intents)
# Initialize repositories
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
from datetime import datetime
CHANNEL_HOME_DEBT_ID = int(os.getenv('CHANNEL_HOME_DEBT_ID', 0))
CHANNEL_NOI_TU_ID = int(os.getenv('CHANNEL_NOI_TU_ID', 0))
user_cooldowns: Dict[int, datetime] = {}
active_voice_users: Set[int] = set()
# Constants
CHAT_EXP_POINTS = 1
VOICE_EXP_POINTS_PER_MINUTE = 2
CHAT_COOLDOWN = 60 # seconds
@bot.tree.command(name='help', description='Show help')
async def help(interaction: discord.Interaction):
"""Command để hiển thị danh sách các lệnh"""
channel = interaction.channel
# Dictionary chứa thông tin help cho từng channel
help_commands = {
CHANNEL_HOME_DEBT_ID: [
"!hdadd <số tiền>",
"!hdcheck",
"!hdtra <số tiền>",
"!hdvay <số tiền>"
],
CHANNEL_NOI_TU_ID: [
"!start",
"!end"
]
}
# Kiểm tra xem channel có trong danh sách không
if channel.id in help_commands:
embed = discord.Embed(
title="Help",
description="Đây là danh sách các lệnh bạn có thể sử dụng:",
color=discord.Color.blue()
)
commands_list = "\n".join(help_commands[channel.id])
embed.add_field(name="", value=commands_list, inline=False)
await interaction.response.send_message(embed=embed, ephemeral=False)
else:
await interaction.response.send_message(
"Không có lệnh help cho channel này!",
ephemeral=True
)