@@ -18,7 +18,7 @@ def find_hooks(parent, module):
1818 """
1919 :type parent: Plugin
2020 :type module: object
21- :rtype: (list[CommandHook], list[RegexHook], list[RawHook], list[SieveHook], List[EventHook], list[OnloadHook ])
21+ :rtype: (list[CommandHook], list[RegexHook], list[RawHook], list[SieveHook], List[EventHook], list[OnStartHook ])
2222 """
2323 # set the loaded flag
2424 module ._cloudbot_loaded = True
@@ -27,8 +27,8 @@ def find_hooks(parent, module):
2727 raw = []
2828 sieve = []
2929 event = []
30- onload = []
31- type_lists = {"command" : command , "regex" : regex , "irc_raw" : raw , "sieve" : sieve , "event" : event , "onload " : onload }
30+ on_start = []
31+ type_lists = {"command" : command , "regex" : regex , "irc_raw" : raw , "sieve" : sieve , "event" : event , "on_start " : on_start }
3232 for name , func in module .__dict__ .items ():
3333 if hasattr (func , "_cloudbot_hook" ):
3434 # if it has cloudbot hook
@@ -40,7 +40,7 @@ def find_hooks(parent, module):
4040 # delete the hook to free memory
4141 del func ._cloudbot_hook
4242
43- return command , regex , raw , sieve , event , onload
43+ return command , regex , raw , sieve , event , on_start
4444
4545
4646def find_tables (code ):
@@ -158,11 +158,11 @@ def load_plugin(self, path):
158158 # create database tables
159159 yield from plugin .create_tables (self .bot )
160160
161- # run onload hooks
162- for onload_hook in plugin .run_on_load :
163- success = yield from self .launch (onload_hook , Event (bot = self .bot , hook = onload_hook ))
161+ # run on_start hooks
162+ for on_start_hook in plugin .run_on_start :
163+ success = yield from self .launch (on_start_hook , Event (bot = self .bot , hook = on_start_hook ))
164164 if not success :
165- logger .warning ("Not registering hooks from plugin {}: onload hook errored" .format (plugin .title ))
165+ logger .warning ("Not registering hooks from plugin {}: on_start hook errored" .format (plugin .title ))
166166
167167 # unregister databases
168168 plugin .unregister_tables (self .bot )
@@ -214,7 +214,7 @@ def load_plugin(self, path):
214214 self ._log_hook (sieve_hook )
215215
216216 # we don't need this anymore
217- del plugin .run_on_load
217+ del plugin .run_on_start
218218
219219 @asyncio .coroutine
220220 def unload_plugin (self , path ):
@@ -408,7 +408,7 @@ def launch(self, hook, event):
408408 :type hook: cloudbot.plugin.Hook | cloudbot.plugin.CommandHook
409409 :rtype: bool
410410 """
411- if hook .type != "onload " : # we don't need sieves on onload hooks.
411+ if hook .type != "on_start " : # we don't need sieves on on_start hooks.
412412 for sieve in self .bot .plugin_manager .sieves :
413413 event = yield from self ._sieve (sieve , event , hook )
414414 if event is None :
@@ -483,7 +483,7 @@ def __init__(self, filepath, filename, title, code):
483483 self .file_path = filepath
484484 self .file_name = filename
485485 self .title = title
486- self .commands , self .regexes , self .raw_hooks , self .sieves , self .events , self .run_on_load = find_hooks (self , code )
486+ self .commands , self .regexes , self .raw_hooks , self .sieves , self .events , self .run_on_start = find_hooks (self , code )
487487 # we need to find tables for each plugin so that they can be unloaded from the global metadata when the
488488 # plugin is reloaded
489489 self .tables = find_tables (code )
@@ -686,19 +686,19 @@ def __str__(self):
686686 self .plugin .file_name )
687687
688688
689- class OnloadHook (Hook ):
690- def __init__ (self , plugin , on_load_hook ):
689+ class OnStartHook (Hook ):
690+ def __init__ (self , plugin , on_start_hook ):
691691 """
692692 :type plugin: Plugin
693- :type on_load_hook : cloudbot.util.hook._OnLoadHook
693+ :type on_start_hook : cloudbot.util.hook._On_startHook
694694 """
695- super ().__init__ ("onload " , plugin , on_load_hook )
695+ super ().__init__ ("on_start " , plugin , on_start_hook )
696696
697697 def __repr__ (self ):
698- return "Onload [{}]" .format (Hook .__repr__ (self ))
698+ return "On_start [{}]" .format (Hook .__repr__ (self ))
699699
700700 def __str__ (self ):
701- return "onload {} from {}" .format (self .function_name , self .plugin .file_name )
701+ return "on_start {} from {}" .format (self .function_name , self .plugin .file_name )
702702
703703
704704_hook_name_to_plugin = {
@@ -707,5 +707,5 @@ def __str__(self):
707707 "irc_raw" : RawHook ,
708708 "sieve" : SieveHook ,
709709 "event" : EventHook ,
710- "onload " : OnloadHook
710+ "on_start " : OnStartHook
711711}
0 commit comments