diff --git a/discord/ext/commands/bot.py b/discord/ext/commands/bot.py index 589e4a6b6..5eb40f1ca 100644 --- a/discord/ext/commands/bot.py +++ b/discord/ext/commands/bot.py @@ -555,7 +555,7 @@ class BotBase(GroupMixin): return prefix @asyncio.coroutine - def get_context(self, message): + def get_context(self, message, *, cls=Context): """|coro| Returns the invocation context from the message. @@ -572,15 +572,21 @@ class BotBase(GroupMixin): ----------- message: :class:`discord.Message` The message to get the invocation context from. + cls: type + The factory class that will be used to create the context. + By default, this is :class:`Context`. Should a custom + class be provided, it must be similar enough to :class:`Context`\'s + interface. Returns -------- :class:`Context` - The invocation context. + The invocation context. The type of this can change via the + ``cls`` parameter. """ view = StringView(message.content) - ctx = Context(prefix=None, view=view, bot=self, message=message) + ctx = cls(prefix=None, view=view, bot=self, message=message) if self._skip_check(message.author.id, self.user.id): return ctx