Asynchronous QQ robot frame _NoneBot

A, NoneBot use

1) monitor the transmitted message # "mass" event 
@on_command ( 'send_msg', aliases = ( ' bulk',))
the async DEF send_msg (the session: CommandSession):
Print ( "send message")
message_type = session.ctx [ 'message_type']
user_id = session.ctx [ 'user_id']
# is determined private chat message sent and transmitted is qq number 448 113 545
IF message_type == 'Private' and user_id == 448 113 545:
# of acquiring information qq group
= the await session.bot.get_group_list group_list ()
for group in group_list:
# qq transmits a group information
await session.bot.send_group_msg (group_id = group [ ' group_id'], message = ' message to the mass')
2 ) session.ctx
{'font': 6395088, 'message': [{'type': 'text', 'data': {'text': '33'}}], 'message_id': 36, 'message_type': 'private', 'post_type': 'message', 'raw_message': '33', 'self_id': 12345678, 'sender': {'age': 29, 'nickname': '美好', 'sex': 'unknown', 'user_id': 446789001}, 'sub_type': 'friend', 'time': 1578536478, 'user_id':446789001, 'to_me': True}


Guess you like

Origin www.cnblogs.com/jiguanghover/p/12169959.html