How to use the aiocqhttp.message.MessageSegment.text function in aiocqhttp

To help you get started, we’ve selected a few aiocqhttp examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github richardchien / python-aiocqhttp / aiocqhttp / __init__.py View on Github external
at_sender = kwargs.pop('at_sender', False) and 'user_id' in context

        context = context.copy()
        context['message'] = message
        context.update(kwargs)
        if 'message_type' not in context:
            if 'group_id' in context:
                context['message_type'] = 'group'
            elif 'discuss_id' in context:
                context['message_type'] = 'discuss'
            elif 'user_id' in context:
                context['message_type'] = 'private'

        if at_sender and context['message_type'] != 'private':
            context['message'] = MessageSegment.at(context['user_id']) + \
                                 MessageSegment.text(' ') + context['message']

        return await self.send_msg(**context)