pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

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

    1. <tfoot id='hVDlz'></tfoot>

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

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

      1. 我的 TEMPMUTE 命令出現一定錯誤

        I#39;m getting a certain error on my TEMPMUTE command(我的 TEMPMUTE 命令出現一定錯誤)

          <tfoot id='1qgl6'></tfoot>

          <small id='1qgl6'></small><noframes id='1qgl6'>

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

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

                1. 本文介紹了我的 TEMPMUTE 命令出現一定錯誤的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我已經制作了一個臨時代碼,或者我們可以說我在 stackoverflow 上找到了一個.我復制了代碼,但它似乎不起作用.如果你們中的任何人現在可以幫助我,謝謝!代碼是;

                  I have made a tempmute code or we can say I found one on stackoverflow. I copied the code but it doesn't seem to work. If anyone of you now and can help me thanks! The code is;

                  @commands.has_permissions(kick_members=True)
                  async def tempmute(ctx, member: discord.Member, time=0, reason=None):
                      if not member or time == 0:
                          return
                      elif reason == None:
                          reason = 'No reason'
                      try:
                          if time_list[2] == "s":
                              time_in_s = int(time_list[1])
                          if time_list[2] == "min":
                              time_in_s = int(time_list[1]) * 60
                          if time_list[2] == "h":
                              time_in_s = int(time_list[1]) * 60 * 60
                          if time_list[2] == "d":
                              time_in_s = int(time_list[1]) * 60 * 60 * 60
                      except:
                          time_in_s = 0
                   
                      tempmuteembed = discord.Embed(colour=discord.Colour.from_rgb(0, 255, 0))
                      tempmuteembed.set_author(icon_url=member.avatar_url, name=f'{member} has been tempmuted!')
                      tempmuteembed.set_footer(text=f"{ctx.guild.name}  ?  {datetime.strftime(datetime.now(), '%d.%m.%Y at %I:%M %p')}")
                      tempmuteembed.add_field(name=f'ID:', value=f'{member.id}', inline=False)
                      tempmuteembed.add_field(name='Reason:', value=f"{reason}")
                      tempmuteembed.add_field(name='Duration:', value=f"{time}")
                      tempmuteembed.add_field(name=f'By:', value=f'{ctx.author.name}#{ctx.author.discriminator}', inline=False)
                      await ctx.send(embed=tempmuteembed)
                  
                   
                      guild = ctx.guild
                      for role in guild.roles:
                          if role.name == 'Muted':
                              await member.add_roles(role)
                              await ctx.send(embed=tempmuteembed)
                              await asyncio.sleep(time_in_s)
                              await member.remove_roles(role)
                              return
                  

                  我得到的錯誤如下;

                  discord.ext.commands.errors.BadArgument: Converting to "int" failed for parameter "time".
                  

                  推薦答案

                  這是因為 CommandConverters 在其參數上運行.由于 time 默認為 0,其類型為 int,因此庫嘗試將 time 轉換為 >int.但是,如果您提供像 10m 這樣的單位后綴,則此轉換將失敗,因為 int('10m') 失敗并出現 ValueError,其中輪到提出 BadArgument.

                  This is because Commands have Converters that are run on their arguments. Since time defaults to 0, which is of type int, the library tries to convert time to an int. However, this conversion will fail if you give a unit suffix like 10m, since int('10m') fails with a ValueError, which in turn raises BadArgument.

                  要解決這個問題,只需在 time 參數中添加適當的類型注釋:

                  To fix this, simply add a proper type annotation to your time parameter:

                  from typing import Union
                  async def tempmute(ctx, member: discord.Member, time: Union[int, str] = 0, reason=None):
                  

                  這篇關于我的 TEMPMUTE 命令出現一定錯誤的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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='SAfsR'></bdo><ul id='SAfsR'></ul>

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

                  • <legend id='SAfsR'><style id='SAfsR'><dir id='SAfsR'><q id='SAfsR'></q></dir></style></legend>

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

                            主站蜘蛛池模板: 钢制暖气片散热器_天津钢制暖气片_卡麦罗散热器厂家 | Safety light curtain|Belt Sway Switches|Pull Rope Switch|ultrasonic flaw detector-Shandong Zhuoxin Machinery Co., Ltd | 自动钻孔机-全自动数控钻孔机生产厂家-多米(广东)智能装备有限公司 | 塑料脸盆批发,塑料盆生产厂家,临沂塑料广告盆,临沂家用塑料盆-临沂市永顺塑业 | 称重传感器,测力传感器,拉压力传感器,压力变送器,扭矩传感器,南京凯基特电气有限公司 | 陕西安玻璃自动感应门-自动重叠门-磁悬浮平开门厂家【捷申达门业】 | 南京雕塑制作厂家-不锈钢雕塑制作-玻璃钢雕塑制作-先登雕塑厂 | 广州企亚 - 数码直喷、白墨印花、源头厂家、透气无手感方案服务商! | 楼承板-开闭口楼承板-无锡海逵楼承板 | 【星耀裂变】_企微SCRM_任务宝_视频号分销裂变_企业微信裂变增长_私域流量_裂变营销 | 成都APP开发-成都App定制-成都app开发公司-【未来久】 | ★济南领跃标识制作公司★济南标识制作,标牌制作,山东标识制作,济南标牌厂 | 超声骨密度仪-骨密度检测仪-经颅多普勒-tcd仪_南京科进实业有限公司 | 【365公司转让网】公司求购|转让|资质买卖_股权转让交易平台 | 亿诺千企网-企业核心产品贸易 | 扬子叉车厂家_升降平台_电动搬运车|堆高车-扬子仓储叉车官网 | 结晶点测定仪-润滑脂滴点测定仪-大连煜烁 | 塑料瓶罐_食品塑料瓶_保健品塑料瓶_调味品塑料瓶–东莞市富慷塑料制品有限公司 | 深圳天际源广告-形象堆头,企业文化墙,喷绘,门头招牌设计制作专家 | 数控专用机床,专用机床,自动线,组合机床,动力头,自动化加工生产线,江苏海鑫机床有限公司 | 台式核磁共振仪,玻璃软化点测定仪,旋转高温粘度计,测温锥和测温块-上海麟文仪器 | 广州冷却塔维修厂家_冷却塔修理_凉水塔风机电机填料抢修-广东康明节能空调有限公司 | 糖衣机,除尘式糖衣机,全自动糖衣机,泰州市长江制药机械有限公司 体感VRAR全息沉浸式3D投影多媒体展厅展会游戏互动-万展互动 | 蓝米云-专注于高性价比香港/美国VPS云服务器及海外公益型免费虚拟主机 | 济南律师,济南法律咨询,山东法律顾问-山东沃德律师事务所 | 环比机械| 对辊破碎机_四辊破碎机_双齿辊破碎机_华盛铭重工 | 制冷采购电子商务平台——制冷大市场 | 天津电机维修|水泵维修-天津晟佳机电设备有限公司 | Maneurop/美优乐压缩机,活塞压缩机,型号规格,技术参数,尺寸图片,价格经销商 | 电缆接头_防水接头_电缆防水接头_防水电缆接头_上海闵彬 | 快速门厂家-快速卷帘门-工业快速门-硬质快速门-西朗门业 | 高硼硅玻璃|水位计玻璃板|光学三棱镜-邯郸奥维玻璃科技有限公司 高温高压釜(氢化反应釜)百科 | 杜康白酒加盟_杜康酒代理_杜康酒招商加盟官网_杜康酒厂加盟总代理—杜康酒神全国运营中心 | ★济南领跃标识制作公司★济南标识制作,标牌制作,山东标识制作,济南标牌厂 | 至顶网 | 香港新时代国际美容美发化妆美甲培训学校-26年培训经验,值得信赖! | 红外光谱仪维修_二手红外光谱仪_红外压片机_红外附件-天津博精仪器 | 伺服电机维修、驱动器维修「安川|三菱|松下」伺服维修公司-深圳华创益 | 杭州可当科技有限公司—流量卡_随身WiFi_AI摄像头一站式解决方案 | 原子吸收设备-国产分光光度计-光谱分光光度计-上海光谱仪器有限公司 |