supybot-plugin-create: Various updates (stock supybot compatibility, Python 3 compatibility, reload config by default.

This commit is contained in:
Valentin Lorentz 2013-04-11 19:33:42 +02:00
parent 0595489166
commit 43248f5cea

View File

@ -95,9 +95,15 @@ from supybot.commands import *
import supybot.plugins as plugins import supybot.plugins as plugins
import supybot.ircutils as ircutils import supybot.ircutils as ircutils
import supybot.callbacks as callbacks import supybot.callbacks as callbacks
from supybot.i18n import PluginInternationalization, internationalizeDocstring try:
from supybot.i18n import PluginInternationalization
_ = PluginInternationalization('%s') from supybot.i18n import internationalizeDocstring
_ = PluginInter
except:
# These are useless functions that's allow to run the plugin on a bot
# without the i18n plugin
_ = lambda x:x
internationalizeDocstring = lambda x:xnationalization('%s')
@internationalizeDocstring @internationalizeDocstring
class %s(callbacks.Plugin): class %s(callbacks.Plugin):
@ -117,9 +123,15 @@ configTemplate = '''
import supybot.conf as conf import supybot.conf as conf
import supybot.registry as registry import supybot.registry as registry
from supybot.i18n import PluginInternationalization, internationalizeDocstring try:
from supybot.i18n import PluginInternationalization
_ = PluginInternationalization('%s') from supybot.i18n import internationalizeDocstring
_ = PluginInternationalization('%s')
except:
# These are useless functions that's allow to run the plugin on a bot
# without the i18n plugin
_ = lambda x:x
internationalizeDocstring = lambda x:x
def configure(advanced): def configure(advanced):
# This will be called by supybot to configure this module. advanced is # This will be called by supybot to configure this module. advanced is
@ -165,14 +177,17 @@ __contributors__ = {}
# This is a url where the most recent plugin package can be downloaded. # This is a url where the most recent plugin package can be downloaded.
__url__ = '' # 'http://supybot.com/Members/yourname/%s/download' __url__ = '' # 'http://supybot.com/Members/yourname/%s/download'
import config from . import config
import plugin from . import plugin
reload(plugin) # In case we\'re being reloaded. from imp import reload
# In case we\'re being reloaded.
reload(config)
reload(plugin)
# Add more reloads here if you add third-party modules and want them to be # Add more reloads here if you add third-party modules and want them to be
# reloaded when this plugin is reloaded. Don\'t forget to import them as well! # reloaded when this plugin is reloaded. Don\'t forget to import them as well!
if world.testing: if world.testing:
import test from . import test
Class = plugin.Class Class = plugin.Class
configure = config.configure configure = config.configure