<small id='2u6Sr'></small><noframes id='2u6Sr'>

    1. <i id='2u6Sr'><tr id='2u6Sr'><dt id='2u6Sr'><q id='2u6Sr'><span id='2u6Sr'><b id='2u6Sr'><form id='2u6Sr'><ins id='2u6Sr'></ins><ul id='2u6Sr'></ul><sub id='2u6Sr'></sub></form><legend id='2u6Sr'></legend><bdo id='2u6Sr'><pre id='2u6Sr'><center id='2u6Sr'></center></pre></bdo></b><th id='2u6Sr'></th></span></q></dt></tr></i><div id='2u6Sr'><tfoot id='2u6Sr'></tfoot><dl id='2u6Sr'><fieldset id='2u6Sr'></fieldset></dl></div>

        <tfoot id='2u6Sr'></tfoot>

        <legend id='2u6Sr'><style id='2u6Sr'><dir id='2u6Sr'><q id='2u6Sr'></q></dir></style></legend>
          <bdo id='2u6Sr'></bdo><ul id='2u6Sr'></ul>

        如果消息被编辑,反发誓系统不起作用

        时间:2023-10-11
          <tbody id='YAYrE'></tbody>
        • <bdo id='YAYrE'></bdo><ul id='YAYrE'></ul>
          1. <legend id='YAYrE'><style id='YAYrE'><dir id='YAYrE'><q id='YAYrE'></q></dir></style></legend>

            <small id='YAYrE'></small><noframes id='YAYrE'>

            <tfoot id='YAYrE'></tfoot>
            <i id='YAYrE'><tr id='YAYrE'><dt id='YAYrE'><q id='YAYrE'><span id='YAYrE'><b id='YAYrE'><form id='YAYrE'><ins id='YAYrE'></ins><ul id='YAYrE'></ul><sub id='YAYrE'></sub></form><legend id='YAYrE'></legend><bdo id='YAYrE'><pre id='YAYrE'><center id='YAYrE'></center></pre></bdo></b><th id='YAYrE'></th></span></q></dt></tr></i><div id='YAYrE'><tfoot id='YAYrE'></tfoot><dl id='YAYrE'><fieldset id='YAYrE'></fieldset></dl></div>

                • 本文介绍了如果消息被编辑,反发誓系统不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  基本上,如果您说的不是脏话,然后将消息编辑成脏话,机器人将不会检测到它.我该如何解决?这是我的代码:

                  Basically if you say something that's not a swear word but then edit the message into a swear word, the bot will not detect it. How do I fix this? Here's my code:

                  @client.event
                  async def on_message(message):
                      if message.author.bot:
                          return
                      for badword in file:
                          if badword in message.content.lower():
                              await message.delete()
                              warnMessage = f"Hey {message.author.mention}! Don't say that!"
                              await message.channel.send(warnMessage, delete_after=5.0)
                              print(f"{message.author.name} tried saying: {badword}")
                              channel = client.get_channel(836232733126426666)
                              
                              embed = discord.Embed(title=f"Someone tried to swear!", colour=0x2D2D2D)
                              embed.add_field(name="Person who tried to swear:", value=f"{message.author.name}", inline=False)
                              embed.add_field(name="What they tried to say:", value=f"{badword}", inline=False)
                              embed.add_field(name="Channel they tried to swear in:", value=f"<#{message.channel.id}>", inline=False)
                              
                              await channel.send(embed=embed)
                              return
                              await client.process_commands(message)
                      if message.content.startswith('Jason derulo'):
                          await message.channel.send('Wiggle wiggle wiggle')
                      if message.content.startswith('fast'):
                          await message.channel.send('She a runner she a track star')
                      await client.process_commands(message)
                  

                  推荐答案

                  您可以为此使用 on_message_edit 事件,并使用您在 on_message 事件(只要记住使用 after 参数而不是 message)

                  You can use the on_message_edit event for that and use the same logic you're using in the on_message event (just remember to use the after arg instead of message)

                  @client.event
                  async def on_message_edit(before, after):
                      for badword in file:
                          if badword in after.content.lower():
                              await after.delete()
                              warnMessage = f"Hey {after.author.mention}! Don't say that!"
                              await after.channel.send(warnMessage, delete_after=5.0)
                              print(f"{message.author.name} tried saying: {badword}")
                              channel = client.get_channel(836232733126426666)
                              
                              embed = discord.Embed(title=f"Someone tried to swear!", colour=0x2D2D2D)
                              embed.add_field(name="Person who tried to swear:", value=f"{message.author.name}", inline=False)
                              embed.add_field(name="What they tried to say:", value=f"{badword}", inline=False)
                              embed.add_field(name="Channel they tried to swear in:", value=f"<#{message.channel.id}>", inline=False)
                              
                              return await channel.send(embed=embed)
                  

                  参考:

                  • on_message_edit
                  • 这篇关于如果消息被编辑,反发誓系统不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:Discord.py member.server_default_channel 中的参数无效 下一篇:对于 discord.py,我如何将作者的 id 变成不和谐用

                  相关文章

                  最新文章

                    1. <i id='E3JXv'><tr id='E3JXv'><dt id='E3JXv'><q id='E3JXv'><span id='E3JXv'><b id='E3JXv'><form id='E3JXv'><ins id='E3JXv'></ins><ul id='E3JXv'></ul><sub id='E3JXv'></sub></form><legend id='E3JXv'></legend><bdo id='E3JXv'><pre id='E3JXv'><center id='E3JXv'></center></pre></bdo></b><th id='E3JXv'></th></span></q></dt></tr></i><div id='E3JXv'><tfoot id='E3JXv'></tfoot><dl id='E3JXv'><fieldset id='E3JXv'></fieldset></dl></div>
                    2. <legend id='E3JXv'><style id='E3JXv'><dir id='E3JXv'><q id='E3JXv'></q></dir></style></legend>
                    3. <small id='E3JXv'></small><noframes id='E3JXv'>

                        <bdo id='E3JXv'></bdo><ul id='E3JXv'></ul>
                      <tfoot id='E3JXv'></tfoot>