async def delete_black_list_group(session: nonebot.CommandSession): ctx = session.ctx.copy() if get_privilege(ctx['user_id'], perm.WHITELIST): group_id = session.get('group_id', prompt='请输入要禁用的qq群') try: admin_control.set_data(group_id, 'banned', False) except ValueError: await session.finish('emmm没找到哦~') await session.finish('你群%s又有色图了' % group_id)
async def set_exempt(session: nonebot.CommandSession): ctx = session.ctx.copy() if not get_privilege(ctx['user_id'], perm.ADMIN) or 'group_id' not in ctx: return group_id = ctx['group_id'] if admin_control.get_data(group_id, 'exempt'): admin_control.set_data(group_id, 'exempt', False) await session.finish('已打开R18闪照发送模式') else: admin_control.set_data(group_id, 'exempt', True) await session.finish('本群R18图将不再已闪照形式发布')
async def entertain_switch(session: nonebot.CommandSession): ctx = session.ctx.copy() id_num = str(ctx['user_id']) if not get_privilege(id_num, perm.WHITELIST): await session.finish('您无权进行该操作') group_id = session.get('group_id', prompt='请输入要禁用所有功能的qq群') if not str(group_id).isdigit(): await session.finish('这不是qq号哦~') if admin_control.get_data(group_id, 'enabled'): admin_control.set_data(group_id, 'enabled', False) await session.finish('已禁用娱乐功能!') else: admin_control.set_data(group_id, 'enabled', True) await session.finish('已开启娱乐功能!')
async def set_r18(session: nonebot.CommandSession): ctx = session.ctx.copy() if not get_privilege(ctx['user_id'], perm.WHITELIST): await session.finish('您无权进行该操作') if 'group_id' in ctx: id_num = ctx['group_id'] else: await session.finish('请在需要禁用或开启R18的群内使用本指令') id_num = -1 setting = session.get('stats', prompt='请设置开启或关闭') if '开' in setting: admin_control.set_data(id_num, 'R18', True) resp = '开启' else: admin_control.set_data(id_num, 'R18', False) resp = '关闭' await session.finish('Done! 已设置%s' % resp)