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

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

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

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

      1. <tfoot id='KS1NI'></tfoot>
      2. Discord.py - 使用命令更改前綴

        Discord.py - Changing prefix with command(Discord.py - 使用命令更改前綴)

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

      3. <tfoot id='UybME'></tfoot>

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

                  問題描述

                  我想創建一個命令,管理員可以在其中更改命令的前綴(例如:而不是使用."他們可以將其更改為-",并且只有-"才會起作用)我會能夠設置權限以使只有管理員能夠使用該命令

                  I want to make a command where an admin can change the prefix for commands (eg: instead of using "." they can change it to "-" and only "-" will work if they do) I'd be able to setup the permissions to make only admins able to use the command

                  我環顧四周,通過 docs &互聯網,但沒有找到任何東西,我不知道如何做到這一點

                  I've looked around, through the docs & interwebs but haven't found anything and I haven't had any idea on how to do this

                  推薦答案

                  您應該使用 command_prefix 參數/api.html#bot" rel="noreferrer">discord.Bot 這接受字符串 (表示一個機器人范圍的前綴) 或可調用的 (表示根據條件返回前綴的函數).

                  You should use the command_prefix argument for discord.Bot this accepts either a string (meaning one bot wide prefix) or a callable (meaning a function that returns a prefix based on a condition).

                  您的條件依賴于調用 message.因此,您可以允許公會定義自己的前綴.我將使用一個 dict 作為一個簡單的例子:

                  Your condition relies on the invoking message. Therefore you can allow guilds to define their own prefixes. I'll use a dict as a simple example:

                  ...
                  
                  custom_prefixes = {}
                  #You'd need to have some sort of persistance here,
                  #possibly using the json module to save and load
                  #or a database
                  default_prefixes = ['.']
                  
                  async def determine_prefix(bot, message):
                      guild = message.guild
                      #Only allow custom prefixs in guild
                      if guild:
                          return custom_prefixes.get(guild.id, default_prefixes)
                      else:
                          return default_prefixes
                  
                  bot = commands.Bot(command_prefix = determine_prefix, ...)
                  bot.run()
                  
                  @commands.command()
                  @commands.guild_only()
                  async def setprefix(self, ctx, *, prefixes=""):
                      #You'd obviously need to do some error checking here
                      #All I'm doing here is if prefixes is not passed then
                      #set it to default 
                      custom_prefixes[ctx.guild.id] = prefixes.split() or default_prefixes
                      await ctx.send("Prefixes set!")
                  

                  關于這個使用的一個很好的例子,請參考 Rapptz (discord.py 的創建者) 自己的 RoboDanny 機器人,他將其作為教育目的的公共回購例子.具體見prefix_callable函數,這是我的 determine_prefix 示例的更強大的版本.

                  For a great example of this in use, refer to Rapptz (the creator of discord.py)'s very own RoboDanny bot, he made it a public repo for educational purposes as an example. In specific, see prefix_callable function, it's a more robust version of my determine_prefix example.

                  這篇關于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 - 自動更改角色顏色)
                  <legend id='gLkrD'><style id='gLkrD'><dir id='gLkrD'><q id='gLkrD'></q></dir></style></legend>

                    <tbody id='gLkrD'></tbody>
                  • <small id='gLkrD'></small><noframes id='gLkrD'>

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

                          <i id='gLkrD'><tr id='gLkrD'><dt id='gLkrD'><q id='gLkrD'><span id='gLkrD'><b id='gLkrD'><form id='gLkrD'><ins id='gLkrD'></ins><ul id='gLkrD'></ul><sub id='gLkrD'></sub></form><legend id='gLkrD'></legend><bdo id='gLkrD'><pre id='gLkrD'><center id='gLkrD'></center></pre></bdo></b><th id='gLkrD'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='gLkrD'><tfoot id='gLkrD'></tfoot><dl id='gLkrD'><fieldset id='gLkrD'></fieldset></dl></div>
                          <tfoot id='gLkrD'></tfoot>
                          • 主站蜘蛛池模板: www.47久久青青 | 91视频.com| 免费看一区二区三区 | 国产一区久久 | 久久av网站 | 久久国产精品无码网站 | 一区二区在线 | 国产韩国精品一区二区三区 | 亚洲电影一区二区三区 | 免费在线成人网 | 美女在线国产 | 亚洲区视频 | 中文字幕视频在线观看免费 | 91素人| 嫩草懂你的影院入口 | 精品视频一区二区三区四区 | 欧美性一区二区三区 | 午夜精品一区二区三区免费视频 | 婷婷精品 | 久久久精品 | 中文字幕一区二区三区在线观看 | 999精品视频 | 国产精品a免费一区久久电影 | 久久久久久亚洲精品 | 亚洲精品一区国语对白 | 91久久久久久久久久久久久 | 欧美一级二级三级 | 久久91| 日本小电影网站 | www.狠狠干| 色综合99 | 久久日韩精品一区二区三区 | 久久一区二区三区四区 | 97精品一区二区 | 99re6热在线精品视频播放 | 操久久 | 亚洲精品1 | 免费国产精品久久久久久 | 超碰av免费| 精品久久网| 一区二区免费视频 |