Update __main__.py
This commit is contained in:
parent
f2b509f9fa
commit
bc8d2d3153
@ -11,6 +11,7 @@ import logging
|
|||||||
import random
|
import random
|
||||||
import traceback
|
import traceback
|
||||||
import os
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
import discord
|
import discord
|
||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
@ -27,6 +28,12 @@ logging.basicConfig(level='INFO')
|
|||||||
# If uvloop is installed, change to that eventloop policy as it
|
# If uvloop is installed, change to that eventloop policy as it
|
||||||
# is more efficient
|
# is more efficient
|
||||||
try:
|
try:
|
||||||
|
# https://stackoverflow.com/a/45700730
|
||||||
|
if sys.platform == 'win32':
|
||||||
|
loop = asyncio.ProactorEventLoop()
|
||||||
|
asyncio.set_event_loop(loop)
|
||||||
|
logging.warning('Detected Windows. Changing event loop to ProactorEventLoop.')
|
||||||
|
else:
|
||||||
import uvloop
|
import uvloop
|
||||||
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
|
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
|
||||||
del uvloop
|
del uvloop
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user