Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async def bot_request(session: RequestSession):
global request_flag
f_group= session.ctx['group_id']
f_user= session.ctx['user_id']
if session.ctx['sub_type']=='invite':
if request_flag == False:
await session.bot.send_private_msg(user_id=f_user,message=f'想邀请可可萝入群嘛?请先点击这里联系作者:\nhttps://wpa.qq.com/msgrd?v=3&uin={master}&site=qq&menu=yes')
await session.bot.send_private_msg(user_id=master,message=f'有新的群邀请:\n群:{f_group}\n邀请人:{f_user}\n已忽略')
else :
try:
await session.approve()
except ActionFailed as e:
print(e.retcode)
await session.bot.send_private_msg(user_id=master,message=f'有新的群邀请:\n群:{f_group}\n邀请人:{f_user}\n已同意')
request_flag=False
async def send_group_list(session: CommandSession):
message_type=session.ctx['message_type']
user_id=session.ctx['user_id']
#判断发送的消息是私聊的,并且判断发送者的qq号码
if message_type=='private' and user_id in master:
#获取qq群的信息
try:
group_list = await session.bot.get_group_list()
except ActionFailed as e:
print(e.retcode)
msg='一共有{}个群:'.format(len(group_list))
for group in group_list:
msg+='\n-----------------\n'+'群名称:' + group['group_name'] + '\n' +'群号:' + str(group['group_id'])
await session.bot.send_private_msg(user_id=master[0],message=msg)