def __init__(self, **kwargs):
self.activation_str = kwargs.get(self.ACTIVATION_STR_KEY, self.ACTIVATION_STR)
self.description = kwargs.get(self.DESCRIPTION_KEY, self.DESCRIPTION)
self.token_file_path = kwargs.get(self.TOKEN_FILE_PATH_KEY, self.TOKEN_FILE_PATH)
## Todo: pass kwargs to the their modules
## Init the bot and module manager
self.bot = commands.Bot(
command_prefix=commands.when_mentioned_or(self.activation_str),
description=self.description
)
self.module_manager = ModuleManager(self, self.bot)
## Register the modules (Order of registration is important, make sure dependancies are loaded first)
self.module_manager.register(speech.Speech, *[self.bot])
self.module_manager.register(phrases.Phrases, *[self, self.bot],
**dict(pass_context=True, no_pm=True))
self.module_manager.register(music.Music, *[self, self.bot])
self.module_manager.register(admin.Admin, *[self, self.bot])
## Give some feedback for when the bot is ready to go
@self.bot.event
async def on_ready():
print("Logged in as '{}' (version: {}), (id: {})".format(self.bot.user.name, self.VERSION, self.bot.user.id))
## Methods
## Add an arbitary cog to the bot
评论列表
文章目录