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

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

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

        • <bdo id='SPh1N'></bdo><ul id='SPh1N'></ul>

        如何在沒有命令或事件 discord.py 的情況下發送消

        How to send message without command or event discord.py(如何在沒有命令或事件 discord.py 的情況下發送消息)

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

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

              • <bdo id='1I6FA'></bdo><ul id='1I6FA'></ul>
                  <tfoot id='1I6FA'></tfoot><legend id='1I6FA'><style id='1I6FA'><dir id='1I6FA'><q id='1I6FA'></q></dir></style></legend>
                  本文介紹了如何在沒有命令或事件 discord.py 的情況下發送消息的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我正在使用 datetime 文件來打印:現在是早上 7 點,每天早上 7 點.現在因為這超出了命令或事件引用,我不知道如何發送一條不和諧的消息說現在是早上 7 點.只是為了澄清一下,這不是警報,它實際上是針對我的學校服務器的,它會在早上 7 點發送一份我們需要的所有東西的清單.

                  I am using the datetime file, to print: It's 7 am, every morning at 7. Now because this is outside a command or event reference, I don't know how I would send a message in discord saying It's 7 am. Just for clarification though, this isn't an alarm, it's actually for my school server and It sends out a checklist for everything we need at 7 am.

                  import datetime
                  from time import sleep
                  import discord
                  
                  time = datetime.datetime.now
                  
                  
                  while True:
                      print(time())
                      if time().hour == 7 and time().minute == 0:
                          print("Its 7 am")
                      sleep(1)
                  

                  這是早上 7 點觸發警報的原因.我只想知道如何在觸發時不和諧地發送消息.

                  This is what triggers the alarm at 7 am I just want to know how to send a message in discord when this is triggered.

                  如果您需要任何說明,請詢問.謝謝!

                  If you need any clarification just ask. Thanks!

                  推薦答案

                  您可以創建一個后臺任務來執行此操作并將消息發布到所需的頻道.

                  You can create a background task that does this and posts a message to the required channel.

                  您還需要使用 asyncio.sleep() 而不是 time.sleep(),因為后者會阻塞并且可能會凍結和崩潰您的機器人.

                  You also need to use asyncio.sleep() instead of time.sleep() as the latter is blocking and may freeze and crash your bot.

                  我還添加了一項檢查,以便頻道不會在早上 7 點每秒都發送垃圾郵件.

                  I've also included a check so that the channel isn't spammed every second that it is 7 am.

                  from discord.ext import commands
                  import datetime
                  import asyncio
                  
                  time = datetime.datetime.now
                  
                  bot = commands.Bot(command_prefix='!')
                  
                  async def timer():
                      await bot.wait_until_ready()
                      channel = bot.get_channel(123456789) # replace with channel ID that you want to send to
                      msg_sent = False
                  
                      while True:
                          if time().hour == 7 and time().minute == 0:
                              if not msg_sent:
                                  await channel.send('Its 7 am')
                                  msg_sent = True
                          else:
                              msg_sent = False
                  
                      await asyncio.sleep(1)
                  
                  bot.loop.create_task(timer())
                  bot.run('TOKEN')
                  

                  這篇關于如何在沒有命令或事件 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 - 自動更改角色顏色)

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

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

                          • <small id='AW3Nw'></small><noframes id='AW3Nw'>

                            主站蜘蛛池模板: 久久久观看 | 亚洲一区二区三区免费视频 | 亚洲成a人片 | 欧美日韩在线播放 | 精品国产91久久久久久 | 亚洲精品 在线播放 | 成人av免费播放 | 日韩中文字幕在线观看 | 在线一区| 伊人久久综合 | 刘亦菲国产毛片bd | 国产一区二区视频免费在线观看 | 欧洲尺码日本国产精品 | 国产黄色小视频在线观看 | 色天天综合 | 日韩视频在线观看一区二区 | aa级毛片毛片免费观看久 | 国产精品成人久久久久 | 久久久九九 | 亚洲一区在线播放 | 国产精品美女一区二区 | 久久99精品久久久久久国产越南 | 成人免费看黄网站在线观看 | 国产精品一区二区免费看 | 国产精品欧美一区二区三区不卡 | 国产2区| 成人国产精品久久 | 欧美成视频 | 雨宫琴音一区二区在线 | 欧美1区2区 | 国产精品福利在线 | 精品免费国产 | 午夜免费观看网站 | 亚洲一区二区三区免费 | 亚洲欧美日韩精品久久亚洲区 | 亚洲精品视频一区二区三区 | 欧美在线一二三 | 福利社午夜影院 | 国产精品a级 | 播放一级黄色片 | 午夜一区二区三区在线观看 |