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

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

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

    • <bdo id='C2YdX'></bdo><ul id='C2YdX'></ul>

    1. <legend id='C2YdX'><style id='C2YdX'><dir id='C2YdX'><q id='C2YdX'></q></dir></style></legend>

      前綴和非前綴命令在 python discord bot 上不能一起工

      Prefixed and non prefix commands are not working together on python discord bot(前綴和非前綴命令在 python discord bot 上不能一起工作)
      <tfoot id='ewMWo'></tfoot>

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

            • <bdo id='ewMWo'></bdo><ul id='ewMWo'></ul>
                <tbody id='ewMWo'></tbody>
            • <i id='ewMWo'><tr id='ewMWo'><dt id='ewMWo'><q id='ewMWo'><span id='ewMWo'><b id='ewMWo'><form id='ewMWo'><ins id='ewMWo'></ins><ul id='ewMWo'></ul><sub id='ewMWo'></sub></form><legend id='ewMWo'></legend><bdo id='ewMWo'><pre id='ewMWo'><center id='ewMWo'></center></pre></bdo></b><th id='ewMWo'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='ewMWo'><tfoot id='ewMWo'></tfoot><dl id='ewMWo'><fieldset id='ewMWo'></fieldset></dl></div>
                <legend id='ewMWo'><style id='ewMWo'><dir id='ewMWo'><q id='ewMWo'></q></dir></style></legend>
                本文介紹了前綴和非前綴命令在 python discord bot 上不能一起工作的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                import asyncio
                import discord
                from discord.ext import commands
                from discord.ext.commands import Bot
                import chalk
                
                
                bot = commands.Bot(command_prefix='!')
                
                @bot.event
                async def on_ready():
                    await bot.change_presence(game=discord.Game(name='Test'))
                    print("All systems online and working " + bot.user.name)
                    await bot.send_message(discord.Object(id=386518608550952965), "All systems online and working")
                
                @bot.command(pass_context=True)
                async def hel(ctx):
                    await bot.say("A help message is sent to user")
                
                
                @bot.command
                async def on_message(message):
                    if message.content.startswith("ping"):
                        await bot.send_message(message.channel, "Pong")
                
                
                
                
                bot.run("TOKEN", bot=True)
                

                我試圖在我的 discord 測試服務器上完成這項工作,但是當我像這樣使用它時,只有第一個on_ready"和 !hel 命令有效,ping 不打印任何內容,但是當我刪除 !hel命令代碼部分,ping 有效,有什么方法可以讓它們一起工作嗎?

                I'm trying to get this work on my discord test server but when I use it like this, only the first "on_ready" and !hel command works, ping doesn't print anything, but when I delete the !hel commands code part, ping works, is there any way that I can make them work together?

                推薦答案

                使用on_message@bot.command改為@bot.event>

                Change @bot.command to @bot.event when using on_message

                在使用on_message時添加bot.process_commands

                為什么 on_message 會讓我的命令停止工作?

                覆蓋默認提供的 on_message 會禁止運行任何額外的命令.要解決此問題,請在 on_message 末尾添加 bot.process_commands(message) 行.例如:

                Overriding the default provided on_message forbids any extra commands from running. To fix this, add a bot.process_commands(message) line at the end of your on_message. For example:

                @bot.event
                async def on_message(message):
                    # do some extra stuff here
                
                    await bot.process_commands(message)
                

                http://discordpy.readthedocs.io/en/latest/faq.html#why-does-on-message-make-my-commands-stop-working

                您的代碼應如下所示:

                import asyncio
                import discord
                from discord.ext import commands
                from discord.ext.commands import Bot
                import chalk
                
                
                bot = commands.Bot(command_prefix='!')
                
                @bot.event
                async def on_ready():
                    await bot.change_presence(game=discord.Game(name='Test'))
                    print("All systems online and working " + bot.user.name)
                    await bot.send_message(discord.Object(id=386518608550952965), "All systems online and working")
                
                @bot.command(pass_context=True)
                async def hel(ctx):
                    await bot.say("A help message is sent to user")
                
                
                @bot.event
                async def on_message(message):
                    if message.content.startswith("ping"):
                        await bot.send_message(message.channel, "Pong")
                
                    await bot.process_commands(message)
                
                
                bot.run("TOKEN", bot=True)
                

                這篇關于前綴和非前綴命令在 python discord bot 上不能一起工作的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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 - 自動更改角色顏色)

                • <bdo id='ggdly'></bdo><ul id='ggdly'></ul>

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

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

                        <tfoot id='ggdly'></tfoot>
                          <tbody id='ggdly'></tbody>

                          主站蜘蛛池模板: 日操操夜操操 | 成人免费观看男女羞羞视频 | 国产精品美女久久久久久久久久久 | 午夜网 | 日韩国产专区 | 国产成人精品久久二区二区 | 熟女毛片 | 亚洲欧美一区二区在线观看 | 中文字幕高清免费日韩视频在线 | 91久久精品国产91久久性色tv | 9久9久| 日本三级电影在线观看视频 | 中文字幕久久精品 | 国产xxxx搡xxxxx搡麻豆 | 成人在线视频免费看 | 999久久久久久久久 国产欧美在线观看 | 日韩一区在线播放 | 91在线视频在线观看 | 欧美日韩大片 | 天天色综网 | 欧美日韩久久久久 | 国产一区视频在线 | 成人av电影免费在线观看 | 黄色在线免费观看 | 国产激情视频在线免费观看 | 999久久久精品 | 热久久久久 | 国产第一区二区 | 美女福利视频一区 | 97精品超碰一区二区三区 | 久久久久久a| 亚洲va欧美va人人爽午夜 | 国产99免费 | 亚洲午夜精品一区二区三区 | 草久网| 亚洲天堂二区 | 国产精品欧美一区二区三区不卡 | 成人av电影在线 | 男人的天堂亚洲 | 成人在线播放 | 日韩一区二区三区视频在线观看 |