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

    2. <tfoot id='kIjNw'></tfoot>

      1. <small id='kIjNw'></small><noframes id='kIjNw'>

      2. 使用 Python Discord 机器人删除消息?

        时间:2023-10-10

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

      4. <small id='DPFfu'></small><noframes id='DPFfu'>

              <tfoot id='DPFfu'></tfoot>
              <legend id='DPFfu'><style id='DPFfu'><dir id='DPFfu'><q id='DPFfu'></q></dir></style></legend>
                <tbody id='DPFfu'></tbody>
              • <bdo id='DPFfu'></bdo><ul id='DPFfu'></ul>

                  本文介绍了使用 Python Discord 机器人删除消息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我正在尝试制作一个 Python Discord Bot,它首先可以删除频道中的消息.我希望它以终结者 3 为主题,所以它会从用户说天网开始,然后机器人要求激活 Y 或 N?当用户输入Y时,它会删除频道中的所有消息,如果用户输入N,它会说审判日是不可避免的.任何帮助将不胜感激.

                  I'm trying to make a Python Discord Bot that firstly can delete messages within a channel. I wanted it to be Terminator 3 themed so it would start out by the user saying Skynet then the bot asks to activate Y or N? and when the user types Y it would delete all the messages in the channel if the user typed N it would say judgment day is inevitable. any help would be greatly appreciated.

                  import discord
                  from discord.ext.commands import Bot
                  from discord.ext import commands
                  import asyncio
                  
                  token = 'Token'
                  
                  Client = discord.Client()
                  client = commands.Bot(command_prefix = '!')
                  
                  
                  @client.event
                    async def on_ready():
                       print("Skynet Online")
                  
                  @client.event
                  
                    async def on_message(message):
                      if message.content == 'skynet':
                          await client.send_message(message.channel, 'Execute Y/N?')
                  
                  @asyncio.coroutine
                    async def delete_messages(messages):
                      if message.content == 'Y':
                          await client.delete_messages()
                  
                  
                  client.run('Token')
                  

                  推荐答案

                  import discord
                  from discord.ext.commands import Bot
                  from discord.ext import commands
                  import asyncio
                  
                  @has_permissions(manage_messages=True, read_message_history=True)
                  @bot_has_permissions(manage_messages=True, read_message_history=True)
                  async def purge(ctx, limit: int = 100, user: d.Member = None, *, matches: str = None):
                      """Purge all messages, optionally from ``user``
                      or contains ``matches``."""
                      logger.info('purge', extra={'ctx': ctx})
                      def check_msg(msg):
                          if msg.id == ctx.message.id:
                              return True
                          if user is not None:
                              if msg.author.id != user.id:
                                  return False
                          if matches is not None:
                              if matches not in msg.content:
                                  return False
                          return True
                      deleted = await ctx.channel.purge(limit=limit, check=check_msg)
                      msg = await ctx.send(i18n(ctx, 'purge', len(deleted)))
                      await a.sleep(2)
                      await msg.delete()
                  

                  即删除消息的命令

                  这篇关于使用 Python Discord 机器人删除消息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:使用机器人 Discord.py 授予和删除角色 下一篇:通过用户名查找用户#discrim

                  相关文章

                  最新文章

                  <legend id='2HIKL'><style id='2HIKL'><dir id='2HIKL'><q id='2HIKL'></q></dir></style></legend>

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

                  1. <tfoot id='2HIKL'></tfoot>

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