from salmon.service import add_header from salmon.typing import CQEvent, PrivateMessageEvent, GroupMessageEvent, T_State, Message from salmon.modules.setu_hina.base import get_spec_image, get_setu, search_setu, check_path from salmon.modules.setu_hina.lolicon import get_config, get_group_config, set_group_config, lolicon_fetch_process HELP_MSG = ''' 来张 [keyword] 涩/色/瑟图 : 来张keyword的涩图(不指定关键字发送一张随机涩图) 提取图片pid : 获取指定id的p站图片,没有时发送链接 ''' sv = Service('setu', bundle='娱乐', help_=HELP_MSG) # 设置limiter tlmt = util.DailyNumberLimiter(get_config('base', 'daily_max')) flmt = util.FreqLimiter(get_config('base', 'freq_limit')) set_conf = sv.on_prefix('setu', only_group=False) setu = sv.on_rex( r'^[色涩瑟][图圖]$|^[来來发發给給]((?P<num>\d+)|(?:.*))[张張个個幅点點份丶](?P<keyword>.*?)[色涩瑟][图圖]$', only_group=False) get_pic = sv.on_prefix('提取图片', only_group=False) def check_lmt(uid, num): if uid in salmon.configs.SUPERUSERS: return 0, '' if not tlmt.check(uid): return 1, f"您今天已经冲过{get_config('base', 'daily_max')}次了,请明天再来~" if num > 1 and (get_config('base', 'daily_max') - tlmt.get_num(uid)) < num: return 1, f"您今天的剩余次数为{get_config('base', 'daily_max') - tlmt.get_num(uid)}次,已不足{num}次,请注意节制哦~" if not flmt.check(uid): return 1, f'您冲的太快了,{round(flmt.left_time(uid))}秒后再来吧~'
from salmon.configs import picfinder from salmon.util import DailyNumberLimiter from salmon.service import add_header from salmon.typing import CQEvent, T_State, GroupMessageEvent, PrivateMessageEvent, Message from salmon.configs.picfinder import threshold, SAUCENAO_KEY, CHAIN_REPLY, DAILY_LIMIT from salmon.modules.picfinder.image import get_image_data_sauce, get_image_data_ascii helptext = ''' [搜图] 单张/多张搜图 '''.strip() sv = Service('picfinder', help_=helptext) lmtd = DailyNumberLimiter(DAILY_LIMIT) picfind = sv.on_prefix('搜图', aliases={'识图', '查图', '找图'}, only_group=False) @picfind.handle() async def pic_rec(bot: Bot, event: CQEvent, state: T_State): uid = event.user_id if not lmtd.check(uid): await picfind.finish(f'您今天已经搜过{DAILY_LIMIT}次图了,休息一下明天再来吧~', call_header=True) args = str(event.message).strip() if args: state['pic'] = args message = await add_header(bot, event, msg='请发送需要搜索的图片~\n如果不需要搜图请发送“算了”或“不用了”:)') state['prompt'] = message
※图片搬运自漪夢奈特''') sv_help = ''' [日/台/陆rank] rank推荐表 [查看当前/全部rank更新源] [设置rank更新源] [更新rank表缓存] [挖矿15001] 矿场余钻 [黄骑充电表] 黄骑1动规律 [谁是霸瞳] 角色别称查询 '''.strip() sv = Service('pcr-query', help_=sv_help, bundle='pcr查询') miner = sv.on_prefix('挖矿', aliases={'jjc钻石', '竞技场钻石', 'jjc钻石查询', '竞技场钻石查询'}, only_group=False) rank = sv.on_rex(r'^(\*?([日台国陆b])服?([前中后]*)卫?)?rank(表|推荐|指南)?$', only_group=False) current_source = sv.on_fullmatch('查看当前rank更新源', only_group=False) all_source = sv.on_fullmatch('查看全部rank更新源', only_group=False) set_source = sv.on_rex(r'^设置rank更新源 (.{0,5}) (.{0,10}) (.{0,20})$', only_group=False) cache_update = sv.on_fullmatch('更新rank表缓存', only_group=False) yukari = sv.on_fullmatch(('yukari-sheet', '黄骑充电', '酒鬼充电', '酒鬼充电表', '黄骑充电表'), only_group=False) who_is = sv.on_prefix('谁是', only_group=False) async def load_config(): global config
sv_help = ''' [rank日服] rank推荐表 [rank台服] rank推荐表 [rank陆服] rank推荐表 [挖矿15001] 矿场余钻 [黄骑充电表] 黄骑1动规律 [谁是霸瞳] 角色别称查询 '''.strip() sv = Service('pcr-query', help_=sv_help, bundle='pcr查询') miner = sv.on_fullmatch('挖矿', aliases={'jjc钻石', '竞技场钻石', 'jjc钻石查询', '竞技场钻石查询'}, only_group=False) rank = sv.on_fullmatch('rank', aliases={'Rank', 'rank表', 'Rank表'}, only_group=False) yukari = sv.on_fullmatch('yukari-sheet', aliases={'黄骑充电', '酒鬼充电', '酒鬼充电表', '黄骑充电表'}, only_group=False) who_is = sv.on_prefix('谁是', only_group=False) is_who = sv.on_suffix('是谁', only_group=False) @miner.handle() async def miner_rec(bot: Bot, event: CQEvent, state: T_State): user_info = await bot.get_stranger_info(user_id=event.user_id) nickname = user_info.get('nickname', '未知用户') if isinstance(event, GroupMessageEvent): state['prompt'] = f'>{nickname}\n请发送当前竞技场排名' elif isinstance(event, PrivateMessageEvent): state['prompt'] = '请发送当前竞技场排名' try: args = int(event.message.extract_plain_text()) if args: state['rank'] = args except: