Discord.py任务循环在不同的python环境中不起作用

时间:2020-01-14 00:38:20

标签: python loops python-multithreading discord.py

我一直在研究一种不和谐机器人,当有人进入游戏时,该机器人会发送《英雄联盟》游戏摘要。我总是使用PyCharm进行测试,然后转移到RaspberryPi 4中使其在后台运行。

d / 100

@tasks.loop(seconds=65) async def currentgamesummary(): global currentmatchids loop = asyncio.get_event_loop() tracker = getleaguers() print(tracker) channel = bot.get_channel(644341150420959262) #bot dumps for summ in tracker: m_id = await loop.run_in_executor(ThreadPoolExecutor(),getmatchid, summ) ing = await loop.run_in_executor(ThreadPoolExecutor(),apriorigame, summ) if ing and m_id not in currentmatchids and m_id != False: print(summ, ing, m_id) block_return = await loop.run_in_executor(ThreadPoolExecutor(), grabsummary, summ) currentmatchids.append(getmatchid(summ)) currentmatchids = currentmatchids[-20:] await channel.send(file=discord.File('pil_text.png')) 定义调用所有游戏中名称,以检查它们是否在游戏中。它应该使用先前声明的getleaguers()变量检查该人是否已经打印了摘要。

global currentmatchids检查某人是否在游戏中

ing检查匹配ID

在pycharm中,这是输出(正确100%)。由于也保护了垃圾邮件,因此我也省略了几行,因为它阻止了我发布此问题。

m_id

但是,在我的RaspberryPi上,输出如下:

['Dage', 'Zengin', 'GoogleSamet', 'Mert', 'Flexecution', 'FSM Wolfie', 'Caveat Emptor', 'Freelobaer', 'Snoowwy', 'Fat Oof', 'Pkelove', 'Oluhoholo', 'Kubı', 'FrontCrazyTurk', 'c1000 oreo', 'pothead4life11']
Making call: https://***summoner/v4/summoners/by-name/Dage
Making call: https://***spectator/v4/active-games/by-summoner/X3DGAjNzMZUcQZdP60MzTMJSAyx-Hr-i75Twx4SZMORV9ww
Making call: https://***spectator/v4/active-games/by-summoner/X3DGAjNzMZUcQZdP60MzTMJSAyx-Hr-i75Twx4SZMORV9ww
Making call: https://***summoner/v4/summoners/by-name/Zengin
Making call: https://***spectator/v4/active-games/by-summoner/RoAnhB47eSJSDN3p1tjtEuLZnW-80wc8uXv8X6-7YWa2dYI
Zengin True 4364352367
Making call: https://ddragon.leagueoflegends.com/api/versions.json
Making call: https://ddragon.leagueoflegends.com/realms/euw.json
Making call: https://ddragon.leagueoflegends.com/cdn/10.1.1/data/en_GB/map.json
Making call: https://ddragon.leagueoflegends.com/cdn/10.1.1/data/en_GB/championFull.json
Making call: https://ddragon.leagueoflegends.com/cdn/10.1.1/data/en_GB/summoner.json
Making call: https://***summoner/v4/summoners/RoAnhB47eSJSDN3p1tjtEuLZnW-80wc8uXv8X6-7YWa2dYI
etc.

它基本上会永远重复,不会产生任何东西。我更新了大多数库以匹配RaspberryPi上的最新版本。但是,我无法通过更新库来破坏PyCharm中的版本。

python的版本在PC上是3.7.4,在RasPi上是3.7.3。

0 个答案:

没有答案