Spaces:
Paused
Paused
add
Browse files- bot_main.py +12 -13
bot_main.py
CHANGED
|
@@ -51,21 +51,20 @@ def get_pick_embed(player):
|
|
| 51 |
|
| 52 |
return embed
|
| 53 |
@bot.hybrid_command(description="抽路線指令, 用法: !pick 語音聊天室名稱 人名1 人名3 ...")
|
| 54 |
-
async def pick(ctx, channel_name,other_user=""):
|
| 55 |
# 搜尋指定名稱的語音頻道
|
| 56 |
voice_channel = discord.utils.get(ctx.guild.voice_channels, name=channel_name)
|
| 57 |
-
|
| 58 |
-
# 獲取頻道中的成員
|
| 59 |
members = voice_channel.members
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
await ctx.send(
|
| 70 |
|
| 71 |
bot.run(os.getenv('BOT_TOKENS'))
|
|
|
|
| 51 |
|
| 52 |
return embed
|
| 53 |
@bot.hybrid_command(description="抽路線指令, 用法: !pick 語音聊天室名稱 人名1 人名3 ...")
|
| 54 |
+
async def pick(ctx, channel_name="",other_user=""):
|
| 55 |
# 搜尋指定名稱的語音頻道
|
| 56 |
voice_channel = discord.utils.get(ctx.guild.voice_channels, name=channel_name)
|
| 57 |
+
try:
|
|
|
|
| 58 |
members = voice_channel.members
|
| 59 |
+
member_names = [member.name for member in members]
|
| 60 |
+
except:
|
| 61 |
+
member_names = []
|
| 62 |
+
if(other_user != ""):
|
| 63 |
+
member_names.extend(other_user.split(" "))
|
| 64 |
+
if(len(member_names) == 0):
|
| 65 |
+
await ctx.send("找不到語音頻道")
|
| 66 |
+
return
|
| 67 |
+
embed = get_pick_embed(member_names)
|
| 68 |
+
await ctx.send(embed=embed)
|
| 69 |
|
| 70 |
bot.run(os.getenv('BOT_TOKENS'))
|