bot.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:asif 作者: minus7 项目源码 文件源码
def on_command(self, *args: Sequence[str], rest: str=None) -> Callable[[Callable], Callable]:
        """
        Register a handler that's called when (the beginning of) a `IrcMessage` matches.
        The handler is called with the `IrcMessage` as argument, must be a coroutine
        and is run blocking, i.e. you cannot use `await_command` in it!
        :param args: commands args that must match (the actual command is the first arg)
        :param rest: match the rest (after the " :") of the `IrcMessage`
        """
        def decorator(fn: Callable[[self.IrcMessage], None]):
            ch = self.CommandHandler(args, rest, fn)
            self._on_command_handlers.append(ch)
            self._log.debug("Added command handler {}".format(ch))
            return fn

        return decorator
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号