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

      <bdo id='X8G6q'></bdo><ul id='X8G6q'></ul>

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

      <legend id='X8G6q'><style id='X8G6q'><dir id='X8G6q'><q id='X8G6q'></q></dir></style></legend>

      on_message() 和@bot.command 問題

      on_message() and @bot.command issue(on_message() 和@bot.command 問題)

      1. <legend id='LF5nx'><style id='LF5nx'><dir id='LF5nx'><q id='LF5nx'></q></dir></style></legend>
          <tbody id='LF5nx'></tbody>
      2. <i id='LF5nx'><tr id='LF5nx'><dt id='LF5nx'><q id='LF5nx'><span id='LF5nx'><b id='LF5nx'><form id='LF5nx'><ins id='LF5nx'></ins><ul id='LF5nx'></ul><sub id='LF5nx'></sub></form><legend id='LF5nx'></legend><bdo id='LF5nx'><pre id='LF5nx'><center id='LF5nx'></center></pre></bdo></b><th id='LF5nx'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='LF5nx'><tfoot id='LF5nx'></tfoot><dl id='LF5nx'><fieldset id='LF5nx'></fieldset></dl></div>
          <bdo id='LF5nx'></bdo><ul id='LF5nx'></ul>

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

              <tfoot id='LF5nx'></tfoot>
              • 本文介紹了on_message() 和@bot.command 問題的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                當我的代碼中有 on_message() 時,它會停止所有其他 @bot.command 命令的工作.我嘗試過 await bot.process_commands(message),但這也不起作用.這是我的代碼:

                When I have on_message() in my code, it stops every other @bot.command commands from working. I've tried to await bot.process_commands(message), but that doesn't work either. Here is my code that I have:

                @bot.event
                @commands.has_role("Owner")
                async def on_message(message):
                    if message.content.startswith('/lockdown'):
                        await bot.process_commands(message)
                        embed = discord.Embed(title=":warning: Do you want to activate Lock Down?", description="Type 'confirm' to activate Lock Down mode", color=0xFFFF00)
                        embed.add_field(name="u200b", value="Lock Down mode is still in early development, expect some issues")
                        channel = message.channel
                        await bot.send_message(message.channel, embed=embed)
                        msg = await bot.wait_for_message(author=message.author, content='confirm')
                        embed = discord.Embed(title=":white_check_mark: Lock Down mode successfully activated", description="To deactivate type '/lockdownstop'", color=0x00ff00)
                        embed.add_field(name="u200b", value="Lock Down mode is still in early development, expect some issues")
                        await bot.send_message(message.channel, embed=embed)
                

                推薦答案

                你必須將 await bot.process_commands(message) 放在 if 語句范圍之外,<無論消息是否以/lockdown"開頭,都應運行code>process_command.

                You have to place await bot.process_commands(message) outside of the if statement scope, process_command should be run regardless if the message startswith "/lockdown".

                @bot.event
                async def on_message(message):
                    if message.content.startswith('/lockdown'):
                       ...
                    await bot.process_commands(message)
                

                順便說一句,@commands.has_role(...) 不能應用于 on_message.盡管沒有任何錯誤(因為檢查到位),但 has_role 實際上不會像您預期的那樣工作.

                By the way, @commands.has_role(...) cannot be applied to on_message. Although there aren't any errors (because there’s checking in place), has_role wouldn't actually work as you would've expected.

                @has_role 裝飾器的替代方案是:

                An alternative to the @has_role decorator would be:

                @bot.event
                async def on_message(message):
                    if message.channel.is_private or discord.utils.get(message.author.roles, name="Admin") is None:
                        return False
                
                    if message.content.startswith('/lockdown'):
                       ...
                    await bot.process_commands(message)
                

                這篇關于on_message() 和@bot.command 問題的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

                相關文檔推薦

                python: Two modules and classes with the same name under different packages(python:不同包下同名的兩個模塊和類)
                Configuring Python to use additional locations for site-packages(配置 Python 以使用站點包的其他位置)
                How to structure python packages without repeating top level name for import(如何在不重復導入頂級名稱的情況下構造python包)
                Install python packages on OpenShift(在 OpenShift 上安裝 python 包)
                How to refresh sys.path?(如何刷新 sys.path?)
                Distribute a Python package with a compiled dynamic shared library(分發帶有已編譯動態共享庫的 Python 包)
                <legend id='SiEhN'><style id='SiEhN'><dir id='SiEhN'><q id='SiEhN'></q></dir></style></legend>
                  <tbody id='SiEhN'></tbody>

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

                          主站蜘蛛池模板: 久久综合久久自在自线精品自 | 一片毛片 | 国产日韩精品一区 | 国产精品毛片 | 秋霞电影一区二区 | 国产精品美女一区二区三区 | 午夜电影在线播放 | 99在线免费视频 | 成人欧美一区二区三区黑人孕妇 | 狠狠综合久久av一区二区老牛 | 国产乱码高清区二区三区在线 | 成人在线免费观看 | 天天干亚洲 | 成人精品一区二区三区四区 | 日韩久久综合 | 久久久久综合 | 日韩在线三级 | 国产精品自拍视频 | 在线免费观看a级片 | 一区欧美| 中文字幕一区二区三区在线观看 | 91视频在线观看 | 国产一区二区在线91 | 亚洲视频在线播放 | 欧美一区二区三区视频在线播放 | 伊人艹 | 久久九 | 国产午夜精品一区二区三区四区 | 国产精品大片在线观看 | 中文久久| 华丽的挑战在线观看 | 精品久久99| 中文字幕日韩欧美一区二区三区 | 天天色av | 999视频| 超碰97免费在线 | 精品国产区 | 天天躁日日躁xxxxaaaa | 欧美亚洲国语精品一区二区 | 久久久久国产一区二区三区 | 欧美在线视频免费 |