def run ( self , * args , * * kwargs ) : self . eventloop . run_until_complete ( self . connect ( * args , * * kwargs ) ) try : self . eventloop . run_forever ( ) finally : self . eventloop . stop ( )
how to create a discord bot using python and asyncio
Connect and run bot in event loop .
def run(self, *args, **kwargs):
        """ Connect and run bot in event loop. """
        self.eventloop.run_until_complete(self.connect(*args, **kwargs))
        try:
            self.eventloop.run_forever()
        finally:
            self.eventloop.stop()