def START():
loop = asyncio.new_event_loop()
try:
loop.run_until_complete(bot.start(config.BOT_TOKEN))
except KeyboardInterrupt:
loop.run_until_complete(bot.close())
finally:
loop.close()
class WorkThread(QtCore.QThread):
threadSignal = QtCore.pyqtSignal(int)
def __init__(self):
super().__init__()
def run(self):
i = ''
self.msleep(300)
self.threadSignal.connect(START)
self.threadSignal.emit(i)
@client.event
async def on_member_join(member):
channel = member.guild.system_channel
if channel is not None:
await channel.send('Приветствую, {0.mention}.'.format(member))