Got discord.py to work with scrython.
This commit is contained in:
parent
f14dc616af
commit
ab96f0fa23
|
@ -41,6 +41,6 @@ async def mtg(name):
|
|||
power_toughness=PT
|
||||
)
|
||||
|
||||
await self.bot.say(string)
|
||||
await bot.say(string)
|
||||
|
||||
bot.run(BotUtils.AUTH_TOKEN)
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import aiohttp
|
||||
import asyncio
|
||||
import urllib.parse
|
||||
from threading import Thread
|
||||
|
||||
class CardsObject(object):
|
||||
"""
|
||||
|
@ -90,9 +91,14 @@ class CardsObject(object):
|
|||
async with aiohttp.ClientSession(loop=loop) as client:
|
||||
self.scryfallJson = await getRequest(client, self._url)
|
||||
|
||||
loop = asyncio.get_event_loop()
|
||||
def do_everything():
|
||||
loop = asyncio.new_event_loop()
|
||||
asyncio.set_event_loop(loop)
|
||||
loop.run_until_complete(main(loop))
|
||||
|
||||
t = Thread(target=do_everything)
|
||||
t.run()
|
||||
|
||||
if self.scryfallJson['object'] == 'error':
|
||||
raise Exception(self.scryfallJson['details'])
|
||||
|
||||
|
|
Loading…
Reference in New Issue