File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change 9
9
from cloudbot .bot import CloudBot
10
10
from cloudbot .util import async_util
11
11
12
+
12
13
async def async_main ():
13
14
# store the original working directory, for use when restarting
14
15
original_wd = Path ().resolve ()
@@ -55,7 +56,7 @@ def exit_gracefully(signum, frame):
55
56
# start the bot
56
57
57
58
# CloudBot.run() will return True if it should restart, False otherwise
58
- restart = _bot .run ()
59
+ restart = await _bot .run ()
59
60
60
61
# the bot has stopped, do we want to restart?
61
62
if restart :
Original file line number Diff line number Diff line change @@ -186,22 +186,21 @@ def data_dir(self) -> str:
186
186
)
187
187
return str (self .data_path )
188
188
189
- def run (self ):
189
+ async def run (self ):
190
190
"""
191
191
Starts CloudBot.
192
192
This will load plugins, connect to IRC, and process input.
193
193
:return: True if CloudBot should be restarted, False otherwise
194
194
"""
195
195
self .loop .set_default_executor (self .executor )
196
196
# Initializes the bot, plugins and connections
197
- self .loop . run_until_complete ( self . _init_routine () )
197
+ await self ._init_routine ()
198
198
# Wait till the bot stops. The stopped_future will be set to True to restart, False otherwise
199
199
logger .debug ("Init done" )
200
- restart = self .loop . run_until_complete ( self . stopped_future )
200
+ restart = await self .stopped_future
201
201
logger .debug ("Waiting for plugin unload" )
202
- self .loop . run_until_complete ( self . plugin_manager .unload_all () )
202
+ await self .plugin_manager .unload_all ()
203
203
logger .debug ("Unload complete" )
204
- self .loop .close ()
205
204
return restart
206
205
207
206
def get_client (self , name : str ) -> Type [Client ]:
You can’t perform that action at this time.
0 commit comments