discord.py 块踢命令

时间:2021-05-05 12:11:38

标签: discord discord.py

  @commands.command()
  async def chunkkick(self, ctx, members: commands.Greedy[discord.Member]):
      embed = discord.Embed(description="<:ocheckmark:839069223749812264>  "+f"Successfully chunk kicked ".join([member for member in members]), color=discord.Color.orange())
      for member in members:
          await member.kick(reason=f"{ctx.author} | User was in a chunk kick")
      await ctx.reply(embed=embed, mention_author=False)

我正在制作一个块踢命令,一次踢多个用户。当我添加 .join 时它停止工作。我也没有收到错误。

1 个答案:

答案 0 :(得分:0)

尝试使用单引号代替双引号,您需要其中的两个。像这样:

  @commands.command()
  async def chunkkick(self, ctx, members: commands.Greedy[discord.Member]):
      embed = discord.Embed(description="<:ocheckmark:839069223749812264>  "+f"Successfully chunk kicked {''.join([member for member in members])}, color=discord.Color.orange())
      for member in members:
          await member.kick(reason=f"{ctx.author} | User was in a chunk kick")
      await ctx.reply(embed=embed, mention_author=False)

因为python认为你用双引号结束了字符串 它喜欢做

"Hello"World"