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

  • <tfoot id='V2nil'></tfoot>

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

      1. <small id='V2nil'></small><noframes id='V2nil'>

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

        根據 UTC 時間制作 discord.py(重寫版本)計時器

        Making a discord.py (rewrite version) timer based off of UTC time(根據 UTC 時間制作 discord.py(重寫版本)計時器)

            <tbody id='qgCIc'></tbody>

          1. <tfoot id='qgCIc'></tfoot>
            <legend id='qgCIc'><style id='qgCIc'><dir id='qgCIc'><q id='qgCIc'></q></dir></style></legend>

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

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

                  本文介紹了根據 UTC 時間制作 discord.py(重寫版本)計時器的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我想添加一個基于 UTC 時間的計時器來刷新我每天下載的 API 文件.我正在使用 Discord.py 的重寫版本.這就是我在下面制作的方式:

                  I want to add a timer based off of UTC time to refresh my API files that I download daily. I am using the rewrite version of Discord.py. This is how I made it below:

                  @client.event
                  # Updates API files daily
                  async def clock_timer():
                      from datetime import datetime
                      import pytz
                  
                      datetime_utc = datetime.now(pytz.utc)
                  
                      await datetime_utc.strftime("%H:%M:%S") == "03:00:00"
                      if datetime_utc.strftime("%H:%M:%S") == "03:00:00":
                          processes.api_grabber()
                  

                  我這樣做對嗎?

                  推薦答案

                  await datetime_utc.strftime("%H:%M:%S") == "03:00:00" 不是一個有效的語句,你需要做的是獲取 time_delta 并一直休眠.

                  await datetime_utc.strftime("%H:%M:%S") == "03:00:00" is not a valid statement, what you need to do is get the time_delta and sleep till that.

                  datetime_utc = datetime.now(pytz.utc)
                  three_am_tmr = datetime_utc.replace(hour=3, minute=0, second=0) + timedelta(days=1)
                  delta = (three_am_tmr - datetime_utc).total_seconds()
                  await asyncio.sleep(delta)
                  #process api here
                  

                  但是,如果您希望計時器每天執行,您必須使用 discord.py 任務或類似 APS

                  However if you want the timer to execute daily, you have to use a discord.py task or something like APS

                  from discord.ext import tasks
                  
                  @tasks.loop(days=1)
                  async def grab(something):
                       #proccess api here
                  
                  
                  @grab.before_loop()
                  async def waiter():
                     datetime_utc = datetime.now(pytz.utc)
                     three_am_tmr = datetime_utc.replace(hour=3, minute=0, second=0) + 
                     timedelta(days=1)
                     delta = (three_am_tmr - datetime_utc).total_seconds()
                     await asyncio.sleep(delta)
                  
                  #start task in a command
                  

                  參考資料:

                  • 日期時間
                  • 任務
                  • 這篇關于根據 UTC 時間制作 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='BL8EI'><style id='BL8EI'><dir id='BL8EI'><q id='BL8EI'></q></dir></style></legend>
                  1. <small id='BL8EI'></small><noframes id='BL8EI'>

                        <tbody id='BL8EI'></tbody>

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

                            主站蜘蛛池模板: 三级黄视频在线观看 | 午夜成人免费电影 | 国产成人免费在线 | 日日干夜夜操天天操 | 最新一级毛片 | 精品久| 9久久精品| 欧美日韩亚洲系列 | 亚洲三区在线 | 欧美精品乱码99久久影院 | 久久一级大片 | 久久久久久国产 | 91精品国产美女在线观看 | 精品国产综合 | 色婷婷狠狠 | 密室大逃脱第六季大神版在线观看 | 涩爱av一区二区三区 | 欧美性大战久久久久久久蜜臀 | 一区二区三区四区视频 | 五月花丁香婷婷 | 日日夜夜狠狠操 | 观看av | 日韩a v在线免费观看 | 久久免费精品 | h片在线观看免费 | 久久国产精品72免费观看 | 美女天天干 | 国产一区二区在线免费 | 欧美电影免费观看 | 亚洲欧美另类在线观看 | www.亚洲区 | 精品福利在线视频 | 亚洲三区视频 | 欧美一级α片 | 久久久久久久夜 | 精品99久久 | 羞羞视频免费观看入口 | 四虎影院免费在线 | 亚洲人成人一区二区在线观看 | 99精品九九| 日韩欧美精品在线 |