我的不和谐机器人由于某种原因不断断开连接

时间:2019-05-06 14:09:20

标签: python-3.6 discord.py

我已经有几周没有更换机器人了,由于某种原因,过去五天左右https://imgur.com/VCLx2kv我每天都会收到这样的错误消息

我不认为该错误是由我的代码引起的,除了我不知道如何解决的整个循环之外,它也没有给我造成任何问题,但是如果您对此部分感到好奇,导致该问题的代码部分在下面

我已经尝试过重新生成令牌。

@client.event
async def dead_check():
    i = 1
    d = datetime.now()
    date = str(d.strftime("%Y-%m-%d"))
    server = client.get_server(id = '105388450575859712')
    while i == 1:
        async for message in client.logs_from(discord.Object(id='561667365927124992'), limit=9999999):
            if date in message.content:
                usid = message.content.split('=')
                usid1 = usid[1].split(' ')
                cunt = message.content.split('#')
                cd = message.content.split('?')
                ev = cd[1]
                if ev == '00':
                    number = 0
                elif ev == '01':
                    number = 1
                elif ev == '10':
                    number = 2
                elif ev == '11':
                    number = 3
                name = cunt[0]
                await client.send_message(discord.Object(id='339182193911922689'), '@here\n' + name + ' has reached the deadline for the **FRICKLING** program.\nThe user has attended ' + str(number) + ' events.')
        async for message in client.logs_from(discord.Object(id='567328773922619392'), limit=9999):
            if date in message.content and message.reactions:
                usid = message.content.split(' ')
                user=await client.get_user_info(usid[0])
                await client.send_message(discord.Object(id='567771853796540465'), user.mention + ' needs to be paid, if you have already paid him - react with :HYPERS:')
                await client.delete_message(message)
        await asyncio.sleep(60*60*24)



@client.event
async def on_ready():
    await client.change_presence(game=Game(name='with nuclear waste'))
    print('Ready, bitch')
    asyncio.get_event_loop().run_until_complete(dead_check())

1 个答案:

答案 0 :(得分:0)

您是否尝试过减少那些logs_from调用的限制? 9999999是一个很大的数字,它可能使速度降低得很慢,以致于无法在适当的时间发送心跳。您还应该清理错误消息的图像,其中包含您的机器人令牌。

向Patrick Haugh致谢,但我想关闭此主题,他没有将其发布为答案