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

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

      1. <tfoot id='EeLhS'></tfoot>
          <bdo id='EeLhS'></bdo><ul id='EeLhS'></ul>
        <legend id='EeLhS'><style id='EeLhS'><dir id='EeLhS'><q id='EeLhS'></q></dir></style></legend>

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

        如果用戶在具有特定角色時離開服務(wù)器,則禁止

        Ban a user if they leave the server when they have a specific role discord.py(如果用戶在具有特定角色時離開服務(wù)器,則禁止用戶 discord.py)
        • <i id='LEGwG'><tr id='LEGwG'><dt id='LEGwG'><q id='LEGwG'><span id='LEGwG'><b id='LEGwG'><form id='LEGwG'><ins id='LEGwG'></ins><ul id='LEGwG'></ul><sub id='LEGwG'></sub></form><legend id='LEGwG'></legend><bdo id='LEGwG'><pre id='LEGwG'><center id='LEGwG'></center></pre></bdo></b><th id='LEGwG'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='LEGwG'><tfoot id='LEGwG'></tfoot><dl id='LEGwG'><fieldset id='LEGwG'></fieldset></dl></div>

              <tbody id='LEGwG'></tbody>
              <legend id='LEGwG'><style id='LEGwG'><dir id='LEGwG'><q id='LEGwG'></q></dir></style></legend>

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

                <tfoot id='LEGwG'></tfoot>
                • <bdo id='LEGwG'></bdo><ul id='LEGwG'></ul>
                  本文介紹了如果用戶在具有特定角色時離開服務(wù)器,則禁止用戶 discord.py的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  我想這樣做,如果用戶在具有 Muted[Banned] 角色時離開服務(wù)器,他們將被永久禁止.

                  I want make it so if a user leaves the server while they have the Muted or [Banned] role they get permanently banned.

                  這是我嘗試過的代碼:

                  @bot.event
                  async def on_member_remove(ctx, member, reason=None):
                      role="[Banned]"
                      guild = ctx.guild
                      if role in member.roles:
                          await guild.ban(discord.Object(id=member.id), reason="Leaved the server when soft banned")
                  

                  *這只是一個嘗試,只有被禁止的角色.

                  *this is just a try with only the banned role.

                  用戶沒有被禁止,也沒有錯誤或任何可以幫助我解決問題的東西.

                  The user doesn't get banned, there is also no error or anything that could help me troubleshoot it.

                  推薦答案

                  member.roles 返回一個列表 角色

                  您需要獲取 Role 對象,您可以使用的一種方法是:

                  You need to get the Role object which one way you can use is:

                  role = discord.utils.find(lambda r: r.name == '[Banned]', member.guild.roles)
                  

                  on_member_remove 接受會員.你不能有 reason 或 Context(ctx)

                  on_member_remove takes in Member. You cannot have reason or Context(ctx)

                  @bot.event
                  async def on_member_remove(member):
                      role = discord.utils.find(lambda r: r.name == '[Banned]', member.guild.roles)
                      guild = member.guild
                      if role in member.roles:
                          await guild.ban(discord.Object(id=member.id), reason="Leaved the server when soft banned")
                  

                  還請確保您啟用了成員意圖.你可以通過here 然后選擇 Bot ->服務(wù)器成員意圖

                  Please also ensure you have the Members intent enabled. You can do this by going here then selecting Bot -> SERVER MEMBERS INTENT

                  您需要在代碼中啟用意圖,方法是:

                  You will need to do enable intents in your code by using:

                  intents = discord.Intents.default()
                  intents.members = True
                  
                  bot = commands.Bot(command_prefix=".", intents=intents)
                  

                  這篇關(guān)于如果用戶在具有特定角色時離開服務(wù)器,則禁止用戶 discord.py的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

                  相關(guān)文檔推薦

                  How to make a discord bot that gives roles in Python?(如何制作一個在 Python 中提供角色的不和諧機器人?)
                  Discord bot isn#39;t responding to commands(Discord 機器人沒有響應(yīng)命令)
                  Can you Get the quot;About mequot; feature on Discord bot#39;s? (Discord.py)(你能得到“關(guān)于我嗎?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 - 自動更改角色顏色)

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

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

                        <bdo id='xgqJM'></bdo><ul id='xgqJM'></ul>
                        <legend id='xgqJM'><style id='xgqJM'><dir id='xgqJM'><q id='xgqJM'></q></dir></style></legend>

                        • <tfoot id='xgqJM'></tfoot>
                          1. 主站蜘蛛池模板: 国产精品麻 | 中文字幕一区二区三区乱码在线 | 91精品国产91综合久久蜜臀 | 人人射人人插 | 国产精品毛片av一区 | 日韩精品一区二区三区中文在线 | 99久9| a在线视频观看 | av午夜电影 | 欧美一区视频在线 | 精品国产色| 国产精品久久久精品 | 全免费a级毛片免费看视频免 | 欧美精品一二三 | 福利av在线 | 国产精品久久久久久久免费大片 | 国产精品国产三级国产aⅴ中文 | 99精品久久 | 欧美一区二区综合 | 黄片毛片在线观看 | 国产精品视频久久久久久 | 2020国产在线 | 91精品国产99久久 | 国产日韩精品久久 | 99亚洲精品| 亚洲夜夜爽| 久草网在线视频 | 91免费看片 | 日韩av最新网址 | 精品国产一区二区三区久久 | 婷婷综合色 | 欧美性受xxxx | 亚洲区一 | 成人不卡一区二区 | 中文字幕韩在线第一页 | 国产精品99久久久久久宅男 | 国产欧美一区二区三区久久手机版 | 日韩精品免费在线 | 国产精品亚洲一区 | 97人澡人人添人人爽欧美 | 欧美日韩成人在线 |