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

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

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

      1. Discord bot 偵聽特定頻道上的命令

        Discord bot listen to commands on specific channel(Discord bot 偵聽特定頻道上的命令)
          • <legend id='kPjAY'><style id='kPjAY'><dir id='kPjAY'><q id='kPjAY'></q></dir></style></legend>

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

              <tfoot id='kPjAY'></tfoot>
                <tbody id='kPjAY'></tbody>
                <bdo id='kPjAY'></bdo><ul id='kPjAY'></ul>

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

                  問題描述

                  我的 discord 機器人中有一堆命令,我想要做的是讓機器人僅在某些命令來自特定頻道時才收聽它們.

                  I have a bunch of commands in my discord bot and what I am trying to do is to make the bot listen to some commands ONLY if they come from a specific channel.

                  這是一個命令示例:

                  @bot.command(name='bitcoin',
                                  brief="Shows bitcoin price for nerds.")
                  async def bitcoin(pass_context=True):
                      url = 'https://api.coindesk.com/v1/bpi/currentprice/BTC.json'
                      response = requests.get(url)
                      value = response.json()['bpi']['USD']['rate']
                      await bot.send_message(discord.Object(id='<channel id is inserted here>'), "Bitcoin price is: " + value)
                      # await bot.say("Bitcoin price is: " + value)
                  

                  我可以在我想要的特定渠道中給出答案,但我希望機器人僅在特定渠道中觸發命令時才回復,而不是在任何地方.

                  I can give the answer in a specific channel that I want, but I want the bot to only reply if the command is triggered in a specific channel, not everywhere.

                  我嘗試了 if/else 與 if message.channel.id = 'id' 但它不起作用.

                  I tried a if/else with if message.channel.id = 'id' but it doesn't work.

                  推薦答案

                  你可以寫一個 check 來裝飾你的命令.下面我們使用我們的目標頻道 ID 創建一個 check,然后用該檢查裝飾我們的命令.

                  You can write a check that you can use to decorate your command. Below we create a check using our target channel id, and then decorate our command with that check.

                  def in_channel(channel_id)
                      def predicate(ctx):
                          return ctx.message.channel.id == channel_id
                      return commands.check(predicate)
                  
                  @bot.command(name='bitcoin', brief="Shows bitcoin price for nerds.")
                  @is_channel('CHANNEL_ID')
                  async def bitcoin(pass_context=True):
                      url = 'https://api.coindesk.com/v1/bpi/currentprice/BTC.json'
                      response = requests.get(url)
                      value = response.json()['bpi']['USD']['rate']
                      await bot.send_message(discord.Object(id='<channel id is inserted here>'), "Bitcoin price is: " + value)
                      # await bot.say("Bitcoin price is: " + value)
                  

                  這篇關于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 - 自動更改角色顏色)
                    <i id='9OnYN'><tr id='9OnYN'><dt id='9OnYN'><q id='9OnYN'><span id='9OnYN'><b id='9OnYN'><form id='9OnYN'><ins id='9OnYN'></ins><ul id='9OnYN'></ul><sub id='9OnYN'></sub></form><legend id='9OnYN'></legend><bdo id='9OnYN'><pre id='9OnYN'><center id='9OnYN'></center></pre></bdo></b><th id='9OnYN'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='9OnYN'><tfoot id='9OnYN'></tfoot><dl id='9OnYN'><fieldset id='9OnYN'></fieldset></dl></div>

                      1. <tfoot id='9OnYN'></tfoot>
                        • <legend id='9OnYN'><style id='9OnYN'><dir id='9OnYN'><q id='9OnYN'></q></dir></style></legend>
                            <bdo id='9OnYN'></bdo><ul id='9OnYN'></ul>
                          • <small id='9OnYN'></small><noframes id='9OnYN'>

                              <tbody id='9OnYN'></tbody>
                            主站蜘蛛池模板: 亚洲国产成人av好男人在线观看 | 亚洲aⅴ精品| 中午字幕在线观看 | 中文字幕一区二区三区乱码在线 | 精品av久久久久电影 | 中文字幕福利 | 久久精品久久久久久 | 久久精品在线免费视频 | 亚洲国产一区二区视频 | 伊人网影院 | 精品三区 | 欧美精产国品一二三区 | 久久久久se | 国产一区二区三区在线观看免费 | 欧美成视频 | 青草视频在线 | 黄色一级片视频 | 精品国产欧美一区二区三区成人 | 国产精品欧美一区二区三区不卡 | 日韩精品在线一区 | 国产伦精品一区二区三区高清 | 亚洲欧洲成人 | 成人国产一区二区三区精品麻豆 | 亚洲精品第一 | 在线 丝袜 欧美 日韩 制服 | 久久精品欧美一区二区三区麻豆 | 国产成人精品一区二区三区在线 | 69av片| 91av视频| 欧美一区二区在线播放 | 国产日韩欧美激情 | 97日韩精品 | 国产一区二 | 国色天香成人网 | 色综合美女 | 精品久久久久久 | 日韩在线精品 | 午夜欧美| 成人免费视频网 | 一区二区在线免费观看 | 欧美一区二区大片 |