久久久久久久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 - 使用命令更改前綴的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

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

                  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

                  我環(huán)顧四周,通過 docs &互聯(lián)網(wǎng),但沒有找到任何東西,我不知道如何做到這一點(diǎn)

                  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

                  推薦答案

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

                  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).

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

                  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!")
                  

                  關(guān)于這個(gè)使用的一個(gè)很好的例子,請(qǐng)參考 Rapptz (discord.py 的創(chuàng)建者) 自己的 RoboDanny 機(jī)器人,他將其作為教育目的的公共回購例子.具體見prefix_callable函數(shù),這是我的 determine_prefix 示例的更強(qiáng)大的版本.

                  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.

                  這篇關(guān)于Discord.py - 使用命令更改前綴的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

                  相關(guān)文檔推薦

                  How to make a discord bot that gives roles in Python?(如何制作一個(gè)在 Python 中提供角色的不和諧機(jī)器人?)
                  Discord bot isn#39;t responding to commands(Discord 機(jī)器人沒有響應(yīng)命令)
                  Can you Get the quot;About mequot; feature on Discord bot#39;s? (Discord.py)(你能得到“關(guān)于我嗎?Discord 機(jī)器人的功能?(不和諧.py))
                  message.channel.id Discord PY(message.channel.id Discord PY)
                  How do I host my discord.py bot on heroku?(如何在 heroku 上托管我的 discord.py 機(jī)器人?)
                  discord.py - Automaticaly Change an Role Color(discord.py - 自動(dòng)更改角色顏色)
                  <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>
                          • 主站蜘蛛池模板: 国产成人福利视频在线观看 | 精品中文字幕一区二区三区 | 81精品国产乱码久久久久久 | 一区二区在线不卡 | 91久久| 亚洲精品免费在线观看 | 中文字幕日韩一区 | 黄色大片在线播放 | 亚洲欧美激情精品一区二区 | 亚洲国产精品久久久久久 | 国产大学生情侣呻吟视频 | 国产三级国产精品 | 91精品国产综合久久久久久 | 精品欧美激情在线观看 | 黄色毛片在线看 | 国产a视频 | 国精产品一区二区三区 | 成人国产在线视频 | 亚洲久草 | 日韩一区二区精品 | 欧美一区二区三区的 | 日韩av成人 | 国产精品久久久久久久久久久免费看 | 久草新在线 | 蜜臀网站| 亚洲精品电影网在线观看 | 欧美5区| 久久99精品国产麻豆婷婷 | 天天综合网7799精品 | 日韩一区二区三区视频在线观看 | 亚洲乱码一区二区 | 欧美精品一区二区三区四区 在线 | 久久久久久久亚洲精品 | www.一区二区三区 | 日韩成人精品 | 午夜免费在线观看 | 毛片一区二区 | 黄网免费看 | 中文字幕久久精品 | 免费永久av| 亚洲欧美一区二区三区国产精品 |