久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

<tfoot id='fVb8G'></tfoot>

  • <i id='fVb8G'><tr id='fVb8G'><dt id='fVb8G'><q id='fVb8G'><span id='fVb8G'><b id='fVb8G'><form id='fVb8G'><ins id='fVb8G'></ins><ul id='fVb8G'></ul><sub id='fVb8G'></sub></form><legend id='fVb8G'></legend><bdo id='fVb8G'><pre id='fVb8G'><center id='fVb8G'></center></pre></bdo></b><th id='fVb8G'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='fVb8G'><tfoot id='fVb8G'></tfoot><dl id='fVb8G'><fieldset id='fVb8G'></fieldset></dl></div>
  • <small id='fVb8G'></small><noframes id='fVb8G'>

        <bdo id='fVb8G'></bdo><ul id='fVb8G'></ul>
      1. <legend id='fVb8G'><style id='fVb8G'><dir id='fVb8G'><q id='fVb8G'></q></dir></style></legend>

        Discord.py 狙擊命令

        Discord.py Snipe command(Discord.py 狙擊命令)
      2. <small id='3OAhP'></small><noframes id='3OAhP'>

          <tfoot id='3OAhP'></tfoot>

            <legend id='3OAhP'><style id='3OAhP'><dir id='3OAhP'><q id='3OAhP'></q></dir></style></legend>
                • <bdo id='3OAhP'></bdo><ul id='3OAhP'></ul>
                    <tbody id='3OAhP'></tbody>
                  <i id='3OAhP'><tr id='3OAhP'><dt id='3OAhP'><q id='3OAhP'><span id='3OAhP'><b id='3OAhP'><form id='3OAhP'><ins id='3OAhP'></ins><ul id='3OAhP'></ul><sub id='3OAhP'></sub></form><legend id='3OAhP'></legend><bdo id='3OAhP'><pre id='3OAhP'><center id='3OAhP'></center></pre></bdo></b><th id='3OAhP'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='3OAhP'><tfoot id='3OAhP'></tfoot><dl id='3OAhP'><fieldset id='3OAhP'></fieldset></dl></div>
                  本文介紹了Discord.py 狙擊命令的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我試圖在機器人狙擊"的地方發出命令.最后刪除的消息.這是我當前的代碼:

                  Im trying to make a command where the bot "snipes" the last deleted message. this is my current code:

                  
                  snipe_message_content = None
                  snipe_message_author = None
                  
                  @client.event
                  async def on_message_delete(message):
                      snipe_message_author.remove(None)
                      snipe_message_content.remove(None)
                      snipe_message_content.append(message.content) 
                      snipe_message_author.append(message.author.id) 
                      await asyncio.sleep(str(60))
                      snipe_message_author.remove(message.author.id)
                      snipe_message_content.remove(message.content)
                      
                  
                  @client.command()
                  async def snipe(message):
                      if snipe_message_content==None:
                          await message.channel.send("Theres nothing to snipe.")
                      else:
                          embed = discord.Embed(description=f"{snipe_message_content}")
                          embed.set_footer(text=f"Asked by {message.author.name}#{message.author.discriminator}", icon_url=message.author.avatar_url)
                          embed.set_author(name= f"<@{snipe_message_author}>")
                          await message.channel.send(embed=embed)
                          return
                  
                  

                  await message.channel.send("Theres nothing to snip.") 部分可以正常工作,但其余部分無法正常工作.有人可以幫忙嗎?

                  the await message.channel.send("Theres nothing to snipe.") part works perfectly fine, but the rest wont work. Can anyone help?

                  推薦答案

                  你的 on_message_delete() 函數只是不工作.

                  Well your on_message_delete() function is just not working.

                  我會將您的變量縮短為 smc (snipe_message_content) 和 sma (snipe_message_author).

                  I'll shorten your variables as smc (snipe_message_content) and sma (snipe_message_author).

                  首先,你的變量 smasmc 的類型是 None,但是方法 removeappendlist 類型的一部分,所以你必須聲明列表

                  First of all, your variables sma and smc are of the type None, but the methods remove and append are part of the type list, so you'd have to declare lists

                  smc = []
                  sma = []
                  

                  為了讓他們工作.

                  不過,無論如何您都不必這樣做.只需給您當前的變量一個新值:

                  Still, you wouldn't have to do this anyway. Just give your current variables a new value:

                  snipe_message_content = None
                  snipe_message_author = None
                  
                  @client.event
                  async def on_message_delete(message):
                  
                      global snipe_message_content
                      global snipe_message_author
                      # Variables outside a function have to be declared as global in order to be changed
                  
                      snipe_message_content = message.content
                      snipe_message_author = message.author.id
                      await asyncio.sleep(60)
                      snipe_message_author = None
                      snipe_message_content = None
                  

                  此外,您不應將 60 轉換為字符串.time.sleepasyncio.sleep 都需要一個 integer 才能工作.(順便說一句,如果你想讓 60 成為一個字符串,只需將 60" 寫成帶引號.

                  Also, you should not convert 60 to a string. time.sleep and asyncio.sleep both need an integer in order to work. (And by the way, if you wanted 60 to be a string, just write "60" with quotation marks.

                  另外,請注意以下情況:如果一條消息被刪除,但在新消息被刪除 50 秒后,smasmc 將分配給新消息.但是 10 秒后,之前消息執行的函數會將 smasmc 的值設置為 None.

                  Also, be careful of the following case: If a message gets deleted, but 50 seconds after a new message gets deleted, sma and smc would be assigned to the new message. But 10 seconds later, the function executed by the message before would set he value of sma and smc to None.

                  因此,在 await asyncio.sleep(60) 之后檢查您的消息是否仍然與之前相同:

                  Therefore, after await asyncio.sleep(60) check wether your message is still the same as before:

                  snipe_message_content = None
                  snipe_message_author = None
                  snipe_message_id = None
                  
                  @client.event
                  async def on_message_delete(message):
                  
                      global snipe_message_content
                      global snipe_message_author
                      global snipe_message_id
                  
                      snipe_message_content = message.content
                      snipe_message_author = message.author.id
                      snipe_message_id = message.id
                      await asyncio.sleep(60)
                  
                      if message.id == snipe_message_id:
                          snipe_message_author = None
                          snipe_message_content = None
                          snipe_message_id = None
                  

                  這篇關于Discord.py 狙擊命令的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  How to make a discord bot that gives roles in Python?(如何制作一個在 Python 中提供角色的不和諧機器人?)
                  Discord bot isn#39;t responding to commands(Discord 機器人沒有響應命令)
                  Can you Get the quot;About mequot; feature on Discord bot#39;s? (Discord.py)(你能得到“關于我嗎?Discord 機器人的功能?(不和諧.py))
                  message.channel.id Discord PY(message.channel.id Discord PY)
                  How do I host my discord.py bot on heroku?(如何在 heroku 上托管我的 discord.py 機器人?)
                  discord.py - Automaticaly Change an Role Color(discord.py - 自動更改角色顏色)
                  • <small id='90da6'></small><noframes id='90da6'>

                  • <i id='90da6'><tr id='90da6'><dt id='90da6'><q id='90da6'><span id='90da6'><b id='90da6'><form id='90da6'><ins id='90da6'></ins><ul id='90da6'></ul><sub id='90da6'></sub></form><legend id='90da6'></legend><bdo id='90da6'><pre id='90da6'><center id='90da6'></center></pre></bdo></b><th id='90da6'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='90da6'><tfoot id='90da6'></tfoot><dl id='90da6'><fieldset id='90da6'></fieldset></dl></div>
                    • <bdo id='90da6'></bdo><ul id='90da6'></ul>
                        <legend id='90da6'><style id='90da6'><dir id='90da6'><q id='90da6'></q></dir></style></legend>
                        <tfoot id='90da6'></tfoot>

                          <tbody id='90da6'></tbody>

                          • 主站蜘蛛池模板: 亚洲91| 精品国产黄a∨片高清在线 成人区精品一区二区婷婷 日本一区二区视频 | 成人在线一区二区 | 亚洲精品麻豆 | 国产农村妇女精品一二区 | 国产一区二区激情视频 | 日韩视频在线免费观看 | 99爱视频| 精品香蕉一区二区三区 | 亚洲精品久久久久久久久久久久久 | av一二三区| 日韩精品无码一区二区三区 | 久久精品亚洲精品国产欧美 | 黄色av大片 | 亚洲免费精品 | 欧美中文字幕在线 | 在线免费观看黄色av | 亚洲一级淫片 | 午夜免费影视 | 欧美不卡在线 | 久草免费电影 | 久久午夜国产精品www忘忧草 | 91欧美| 成人欧美一区二区三区在线播放 | 狠狠久久综合 | 国产免费人成xvideos视频 | 国产一区二区三区四区在线观看 | 亚洲欧洲日韩精品 中文字幕 | 国产精品久久久久久久久久了 | 亚洲福利视频网 | 国产日韩欧美 | 毛色毛片免费看 | 亚洲一区视频在线 | 麻豆av网站 | 国产高清在线视频 | 成人二区 | 高清色视频 | 亚洲欧美日韩中文字幕一区二区三区 | 久久久久久亚洲精品 | 精品久久不卡 | 91九色视频在线 |