TonyD365 commited on
Commit
f9f3cfb
·
verified ·
1 Parent(s): 05f3b66

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -7
app.py CHANGED
@@ -24,10 +24,10 @@ from material import (
24
  )
25
 
26
  # 初始化数据库管理器
27
- db_manager = MongoManager(os.getenv("MONGO_URL"), "tonyd")
28
 
29
  # 身份组权限列表
30
- mod = [1357078628969746462, 1357079285113819146, 1436537252317626449, 1357079707539214417, 1357079889160835183]
31
 
32
  # --- 1. FastAPI 保活 ---
33
  app = FastAPI()
@@ -114,10 +114,10 @@ class MyBot(discord.Client):
114
  print(f"✅ Slash commands synced")
115
 
116
  client = MyBot()
117
- client.db = db_manager
118
 
119
  # --- 5. 指令定义 ---
120
- @client.tree.command(name="announce", description="Post announcement")
121
  async def announce(interaction: discord.Interaction, channel: discord.TextChannel, role_ids: str = None):
122
  if not any(role.id in mod for role in interaction.user.roles):
123
  await interaction.response.send_message("❌ **Access Denied**", ephemeral=True)
@@ -138,14 +138,14 @@ async def announce_edit(interaction: discord.Interaction, channel: discord.TextC
138
  @client.tree.command(name="wismer_commands", description="Show all avaliable commands")
139
  async def wismer_commands(interaction: discord.Interaction):
140
  await interaction.response.send_message(
141
- '''**Avaliable Commands**:
142
  `/announce`: Post an announcement.
143
  `/announce_edit`: Edit an announcement.
144
  `/mats`: Show all materials.
145
  `/uploadmat`: Upload a material.
146
  `/approvemat`: Approve a unapproved material. Only Mod+ can use it.
147
  `/deletemat`: To delete or reject a material. Only Mod+ can use it.
148
- `/unappmats`: To show unapprove materials. Only Mod+ can use it.''',
149
  ephemeral=False
150
  )
151
 
@@ -253,7 +253,11 @@ async def unappmats(interaction: discord.Interaction, category: str):
253
  return await interaction.followup.send(f"✅ No pending items.")
254
  list_text = "\n".join([f"`#{m['_id']}` **{m['title']}**\n🔗 {m['url']}" for m in materials])
255
  embed = discord.Embed(title=f"⏳ {category} Pending", description=list_text, color=discord.Color.orange())
256
- await interaction.followup.send(embed=embed)
 
 
 
 
257
 
258
 
259
  # --- 6. 启动逻辑 ---
 
24
  )
25
 
26
  # 初始化数据库管理器
27
+ #db_manager = MongoManager(os.getenv("MONGO_URL"), "tonyd")
28
 
29
  # 身份组权限列表
30
+ #mod = [1357078628969746462, 1357079285113819146, 1436537252317626449, 1357079707539214417, 1357079889160835183]
31
 
32
  # --- 1. FastAPI 保活 ---
33
  app = FastAPI()
 
114
  print(f"✅ Slash commands synced")
115
 
116
  client = MyBot()
117
+ #client.db = db_manager
118
 
119
  # --- 5. 指令定义 ---
120
+ '''@client.tree.command(name="announce", description="Post announcement")
121
  async def announce(interaction: discord.Interaction, channel: discord.TextChannel, role_ids: str = None):
122
  if not any(role.id in mod for role in interaction.user.roles):
123
  await interaction.response.send_message("❌ **Access Denied**", ephemeral=True)
 
138
  @client.tree.command(name="wismer_commands", description="Show all avaliable commands")
139
  async def wismer_commands(interaction: discord.Interaction):
140
  await interaction.response.send_message(
141
+ ''**Avaliable Commands**:
142
  `/announce`: Post an announcement.
143
  `/announce_edit`: Edit an announcement.
144
  `/mats`: Show all materials.
145
  `/uploadmat`: Upload a material.
146
  `/approvemat`: Approve a unapproved material. Only Mod+ can use it.
147
  `/deletemat`: To delete or reject a material. Only Mod+ can use it.
148
+ `/unappmats`: To show unapprove materials. Only Mod+ can use it.',
149
  ephemeral=False
150
  )
151
 
 
253
  return await interaction.followup.send(f"✅ No pending items.")
254
  list_text = "\n".join([f"`#{m['_id']}` **{m['title']}**\n🔗 {m['url']}" for m in materials])
255
  embed = discord.Embed(title=f"⏳ {category} Pending", description=list_text, color=discord.Color.orange())
256
+ await interaction.followup.send(embed=embed)'''
257
+ @client.tree.command(name="hi")
258
+ async def hi(interaction: discord.Interaction):
259
+ await interaction.response.defer(ephemeral=False)
260
+ await interaction.followup.send("hi!")
261
 
262
 
263
  # --- 6. 启动逻辑 ---