How to use the aiocqhttp.exceptions.ActionFailed 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 Joenothing-lst / kkl-Android-2.0 / kkl_bot / kkl / plugins / notices.py View on Github external
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
github Joenothing-lst / kkl-Android-2.0 / kkl_bot / kkl / plugins / chat.py View on Github external
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)