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

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

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

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

      1. 運(yùn)行我的 discord.py 機(jī)器人時(shí)在 client.run('token

        Receiving a runtime error at client.run(#39;token#39;) when running my discord.py bot(運(yùn)行我的 discord.py 機(jī)器人時(shí)在 client.run(token) 收到運(yùn)行時(shí)錯(cuò)誤)
        <tfoot id='9bGNN'></tfoot>
        <legend id='9bGNN'><style id='9bGNN'><dir id='9bGNN'><q id='9bGNN'></q></dir></style></legend>
          • <i id='9bGNN'><tr id='9bGNN'><dt id='9bGNN'><q id='9bGNN'><span id='9bGNN'><b id='9bGNN'><form id='9bGNN'><ins id='9bGNN'></ins><ul id='9bGNN'></ul><sub id='9bGNN'></sub></form><legend id='9bGNN'></legend><bdo id='9bGNN'><pre id='9bGNN'><center id='9bGNN'></center></pre></bdo></b><th id='9bGNN'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='9bGNN'><tfoot id='9bGNN'></tfoot><dl id='9bGNN'><fieldset id='9bGNN'></fieldset></dl></div>

            <small id='9bGNN'></small><noframes id='9bGNN'>

                  <tbody id='9bGNN'></tbody>
                • <bdo id='9bGNN'></bdo><ul id='9bGNN'></ul>

                  本文介紹了運(yùn)行我的 discord.py 機(jī)器人時(shí)在 client.run('token') 收到運(yùn)行時(shí)錯(cuò)誤的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  我正在嘗試用 Python 制作一個(gè) Discord 機(jī)器人,它根據(jù)您所在的班級(jí)(在我的學(xué)校)為您提供 Discord 服務(wù)器上的角色.我剛剛開始,但每當(dāng)我嘗試運(yùn)行它時(shí)都會(huì)收到錯(cuò)誤消息(我在 Python 3 Notebook 中的 Google Colab 中運(yùn)行它).這是我的代碼:

                  I am attempting to make a Discord bot in Python that gives you a role on a Discord server based upon what class you are in (at my school). I have just started, but I am receiving an error whenever I attempt to run it (I run it in Google Colab in a Python 3 Notebook). Here is my code:

                  from datetime import date
                  import time
                  import discord
                  
                  client = discord.Client()
                  
                  @client.event
                  async def on_ready():
                      print('We have logged in as {0.user}'.format(client))
                  
                  client.run('my token (not shown for obvious reasons)')
                  
                  starttime=time.time()
                  while True:
                    currentTime = time.strftime("%H:%M")
                    print("new minute")
                    if 0 <= date(int(time.strftime("%Y")), int(time.strftime("%m")), int(time.strftime("%d"))).weekday() <= 4:
                      if currentTime == "13:41":
                        print("First hour has started!")
                      elif currentTime == "13:45":
                        print("First hour has started! (hs)")
                      elif currentTime == "14:30":
                        print("First hour has ended at high school.")
                    time.sleep(60.0 - ((time.time() - starttime) % 60.0))
                  
                  

                  當(dāng)我運(yùn)行它時(shí),它會(huì)提示我這個(gè)錯(cuò)誤:

                  When I run it, it presents me with this error:

                  ---------------------------------------------------------------------------
                  RuntimeError                              Traceback (most recent call last)
                  <ipython-input-5-d40f2b4200ae> in <module>()
                        9     print('We have logged in as {0.user}'.format(client))
                       10 
                  ---> 11 client.run('my token')
                       12 
                       13 starttime=time.time()
                  
                  2 frames
                  /usr/local/lib/python3.6/dist-packages/discord/client.py in run(self, *args, **kwargs)
                      570 
                      571         try:
                  --> 572             loop.add_signal_handler(signal.SIGINT, lambda: loop.stop())
                      573             loop.add_signal_handler(signal.SIGTERM, lambda: loop.stop())
                      574         except NotImplementedError:
                  
                  /usr/lib/python3.6/asyncio/unix_events.py in add_signal_handler(self, sig, callback, *args)
                       92                             "with add_signal_handler()")
                       93         self._check_signal(sig)
                  ---> 94         self._check_closed()
                       95         try:
                       96             # set_wakeup_fd() raises ValueError if this is not the
                  
                  /usr/lib/python3.6/asyncio/base_events.py in _check_closed(self)
                      375     def _check_closed(self):
                      376         if self._closed:
                  --> 377             raise RuntimeError('Event loop is closed')
                      378 
                      379     def _asyncgen_finalizer_hook(self, agen):
                  
                  RuntimeError: Event loop is closed
                  

                  如果我將 client.run 命令放在底部,程序永遠(yuǎn)不會(huì)到達(dá)它,因?yàn)檠h(huán)會(huì)阻止它到達(dá)命令.

                  If I put the client.run command at the bottom, the program never reaches it because the loop prevents it from reaching the command.

                  我錯(cuò)過了什么嗎?我不知道問題出在哪里.非常感謝幫助.

                  Am I missing something? I do not know where the problem is. Would appreciate help.

                  推薦答案

                  基本上,如果你想在 google colab 上運(yùn)行 discord 機(jī)器人,你需要做各種黑客攻擊.這里我使用 discord.ext python 庫(kù),執(zhí)行這個(gè),但是會(huì)阻塞,并阻止你執(zhí)行任何其他單元格.

                  Basically there are various hacks you need to do if you want to run a discord bot on google colab. Here I use discord.ext python library, executing this, however will be blocking, and prevent you from executing any other cells.

                  !pip install discord.py
                  import nest_asyncio
                  nest_asyncio.apply()
                   
                  import asyncio
                  await = lambda x: asyncio.get_event_loop().run_until_complete(x)
                  async def init(what, token):
                      await what(token)
                  import discord
                  from discord.ext import commands
                  bot = commands.Bot(command_prefix="")
                  async def start():
                      await bot.wait_until_ready()
                      print("ready")
                      await bot.get_channel(channelID).send("hi")
                  
                  bot.loop.create_task(start())
                  
                  TOKEN = ""   #@param {type: "string"}
                  
                  

                  這篇關(guān)于運(yùn)行我的 discord.py 機(jī)器人時(shí)在 client.run('token') 收到運(yùn)行時(shí)錯(cuò)誤的文章就介紹到這了,希望我們推薦的答案對(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)更改角色顏色)
                    <bdo id='Qh9CD'></bdo><ul id='Qh9CD'></ul>
                    <i id='Qh9CD'><tr id='Qh9CD'><dt id='Qh9CD'><q id='Qh9CD'><span id='Qh9CD'><b id='Qh9CD'><form id='Qh9CD'><ins id='Qh9CD'></ins><ul id='Qh9CD'></ul><sub id='Qh9CD'></sub></form><legend id='Qh9CD'></legend><bdo id='Qh9CD'><pre id='Qh9CD'><center id='Qh9CD'></center></pre></bdo></b><th id='Qh9CD'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='Qh9CD'><tfoot id='Qh9CD'></tfoot><dl id='Qh9CD'><fieldset id='Qh9CD'></fieldset></dl></div>

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

                        <legend id='Qh9CD'><style id='Qh9CD'><dir id='Qh9CD'><q id='Qh9CD'></q></dir></style></legend>
                          <tbody id='Qh9CD'></tbody>
                      1. <tfoot id='Qh9CD'></tfoot>
                          • 主站蜘蛛池模板: 操皮视频| 国产精品一区二区在线 | 羞羞网站在线免费观看 | 欧美在线观看网站 | 色吊丝2288sds中文字幕 | 欧美精品tv | www国产亚洲精品久久网站 | 欧美日韩亚洲视频 | 国产免费高清 | 亚洲一区视频在线播放 | 欧美视频在线播放 | 一区二区在线免费观看 | 欧美一区二区三区四区视频 | 欧美日韩一区二区三区四区 | 免费视频久久 | 成人免费一区二区三区牛牛 | 国产精品一区二区久久精品爱微奶 | 国精品一区二区 | 午夜电影网 | 中文字幕一区二区三区精彩视频 | 国产成人免费视频网站高清观看视频 | 最近免费日本视频在线 | 欧美福利视频 | 青草视频在线 | 91精品国产91久久综合桃花 | 亚洲一二三区在线观看 | 成人免费看片又大又黄 | 日日操日日舔 | 夜夜精品浪潮av一区二区三区 | 精品粉嫩超白一线天av | 久久精品国产免费看久久精品 | 中文字幕 在线观看 | 激情欧美一区二区三区中文字幕 | 九九伦理电影 | 久久中文字幕视频 | 精品区一区二区 | 久久精品一 | 久久亚洲一区二区三 | 国产激情视频 | 成人在线一区二区三区 | 欧美日韩精品在线一区 |