mirror of
https://github.com/xuthus83/LittlePaimon.git
synced 2024-10-21 16:27:15 +08:00
优化壁纸获取
This commit is contained in:
parent
8d92fbb1b2
commit
f3ab0d0c19
@ -1,6 +1,6 @@
|
|||||||
chat_list = {
|
chat_list = {
|
||||||
'确实': {'pattern': r'.*(雀食|确实).*', 'cooldown': 60, 'pro': 0.6, 'files': ['雀食', '确实']},
|
'确实': {'pattern': r'.*(雀食|确实).*', 'cooldown': 120, 'pro': 0.5, 'files': ['雀食', '确实']},
|
||||||
'坏了': {'pattern': r'.*派蒙.*坏.*', 'cooldown': 60, 'pro': 0.6, 'files': ['你才坏!', '瞎说啥呢?', '派蒙怎么可能会坏!']},
|
'坏了': {'pattern': r'.*派蒙.*坏.*', 'cooldown': 120, 'pro': 0.5, 'files': ['你才坏!', '瞎说啥呢?', '派蒙怎么可能会坏!']},
|
||||||
'诶嘿': {'pattern': r'.*(诶嘿|哎嘿|欸嘿).*', 'cooldown': 120, 'pro': 0.5, 'files': ['诶嘿.mp3', '诶嘿cn.mp3']},
|
'诶嘿': {'pattern': r'.*(诶嘿|哎嘿|欸嘿).*', 'cooldown': 120, 'pro': 0.5, 'files': ['诶嘿.mp3', '诶嘿cn.mp3']},
|
||||||
'进不去': {'pattern': r'.*进不?(来|去).*', 'cooldown': 180, 'pro': 0.5, 'files': ['进不去.mp3']},
|
'进不去': {'pattern': r'.*进不?(来|去).*', 'cooldown': 180, 'pro': 0.5, 'files': ['进不去.mp3']},
|
||||||
'派蒙是谁': {'pattern': r'.*(派蒙.*是(什么|谁))|((什么|谁)是?.*派蒙).*', 'cooldown': 240, 'pro': 1,
|
'派蒙是谁': {'pattern': r'.*(派蒙.*是(什么|谁))|((什么|谁)是?.*派蒙).*', 'cooldown': 240, 'pro': 1,
|
||||||
@ -13,15 +13,15 @@ chat_list = {
|
|||||||
'憨批': {'pattern': r'.*(憨批|傻(逼|B|b)).*', 'cooldown': 360, 'pro': 0.5, 'files': ['憨批.mp3']},
|
'憨批': {'pattern': r'.*(憨批|傻(逼|B|b)).*', 'cooldown': 360, 'pro': 0.5, 'files': ['憨批.mp3']},
|
||||||
'可爱': {'pattern': r'.*可爱|卡哇伊', 'cooldown': 360, 'pro': 0.5, 'files': ['真是个小可爱.mp3']},
|
'可爱': {'pattern': r'.*可爱|卡哇伊', 'cooldown': 360, 'pro': 0.5, 'files': ['真是个小可爱.mp3']},
|
||||||
'绿茶': {'pattern': r'.*派蒙.*(giegie|绿茶).*', 'cooldown': 360, 'pro': 1, 'files': ['绿茶派.mp3']},
|
'绿茶': {'pattern': r'.*派蒙.*(giegie|绿茶).*', 'cooldown': 360, 'pro': 1, 'files': ['绿茶派.mp3']},
|
||||||
'不是吧': {'pattern': r'不(是|会)吧', 'cooldown': 300, 'pro': 0.5, 'files': ['不是吧阿sir.mp3']},
|
'不是吧': {'pattern': r'不(是|会)吧', 'cooldown': 300, 'pro': 0.4, 'files': ['不是吧阿sir.mp3']},
|
||||||
'好耶': {'pattern': r'好耶|太(好|棒)(了|啦)|好(\!|\!)', 'cooldown': 180, 'pro': 0.75, 'files': ['好耶.mp3', '太好啦.mp3']},
|
'好耶': {'pattern': r'好耶|太(好|棒)(了|啦)|好(\!|\!)', 'cooldown': 180, 'pro': 0.75, 'files': ['好耶.mp3', '太好啦.mp3']},
|
||||||
'好听': {'pattern': r'(好|真|非常)?好听(\!|\!)?', 'cooldown': 360, 'pro': 0.4, 'files': ['好听.mp3']},
|
'好听': {'pattern': r'(好|真|非常)?好听(\!|\!)?', 'cooldown': 360, 'pro': 0.4, 'files': ['好听.mp3']},
|
||||||
'耽误时间': {'pattern': r'快{1,4}|gkd|搞?快点|赶紧的?|(.*耽误.*时间.*)', 'cooldown': 360, 'pro': 0.6, 'files': ['耽误时间.mp3']},
|
'耽误时间': {'pattern': r'快{3,5}|gkd|搞?快点|赶紧的?|(.*耽误.*时间.*)', 'cooldown': 360, 'pro': 0.6, 'files': ['耽误时间.mp3']},
|
||||||
'不可以': {'pattern': r'不(可以|行|能)(吧|的|噢)?', 'cooldown': 180, 'pro': 0.6, 'files': ['不可以.mp3']},
|
'不可以': {'pattern': r'不(可以|行|能)(吧|的|噢)?', 'cooldown': 240, 'pro': 0.4, 'files': ['不可以.mp3']},
|
||||||
'好意思': {'pattern': r'.*好意思.*', 'cooldown': 300, 'pro': 0.5, 'files': ['好意思.mp3']},
|
'好意思': {'pattern': r'.*好意思.*', 'cooldown': 300, 'pro': 0.5, 'files': ['好意思.mp3']},
|
||||||
'不要啊': {'pattern': r'不(好|要)(吧|啊)?', 'cooldown': 180, 'pro': 0.5, 'files': ['不要啊.mp3']},
|
'不要啊': {'pattern': r'不(好|要)(吧|啊)', 'cooldown': 180, 'pro': 0.5, 'files': ['不要啊.mp3']},
|
||||||
'羡慕': {'pattern': r'.*羡慕.*', 'cooldown': 180, 'pro': 0.5, 'files': ['羡慕.mp3']},
|
'羡慕': {'pattern': r'.*羡慕.*', 'cooldown': 180, 'pro': 0.5, 'files': ['羡慕.mp3']},
|
||||||
'过分': {'pattern': r'.*过分.*', 'cooldown': 300, 'pro': 0.5, 'files': ['好过分.mp3']},
|
'过分': {'pattern': r'.*过分.*', 'cooldown': 300, 'pro': 0.4, 'files': ['好过分.mp3']},
|
||||||
'不明白': {'pattern': r'.*明白.*', 'cooldown': 300, 'pro': 0.5, 'files': ['不明白.mp3']},
|
'不明白': {'pattern': r'.*明白.*', 'cooldown': 300, 'pro': 0.4, 'files': ['不明白.mp3']},
|
||||||
'哪里不对': {'pattern': r'(是|对)(吧|吗)', 'cooldown': 300, 'pro': 0.5, 'files': ['哪里不对.mp3']}
|
'哪里不对': {'pattern': r'(是|对)(吧|吗)', 'cooldown': 300, 'pro': 0.4, 'files': ['哪里不对.mp3']}
|
||||||
}
|
}
|
@ -1,8 +1,8 @@
|
|||||||
from aiohttp import ClientSession
|
from aiohttp import ClientSession
|
||||||
from urllib.parse import quote
|
from urllib.parse import quote
|
||||||
from typing import Union
|
from typing import Union
|
||||||
from nonebot import on_command, get_driver
|
from nonebot import on_command, on_regex, get_driver
|
||||||
from nonebot.params import CommandArg
|
from nonebot.params import CommandArg, RegexGroup
|
||||||
from nonebot.message import event_preprocessor
|
from nonebot.message import event_preprocessor
|
||||||
from nonebot.adapters.onebot.v11 import Bot, GroupMessageEvent, MessageEvent, MessageSegment, FriendRequestEvent, \
|
from nonebot.adapters.onebot.v11 import Bot, GroupMessageEvent, MessageEvent, MessageSegment, FriendRequestEvent, \
|
||||||
GroupRequestEvent
|
GroupRequestEvent
|
||||||
@ -15,7 +15,7 @@ superuser = int(list(get_driver().config.superusers)[0])
|
|||||||
|
|
||||||
duilian = on_command('对联', aliases={'对对联'}, priority=15, block=True)
|
duilian = on_command('对联', aliases={'对对联'}, priority=15, block=True)
|
||||||
cat_pic = on_command('猫图', aliases={'来点猫片', '看看猫猫', '来个猫猫'}, priority=15, block=True)
|
cat_pic = on_command('猫图', aliases={'来点猫片', '看看猫猫', '来个猫猫'}, priority=15, block=True)
|
||||||
ecy_pic = on_command('二次元图', aliases={'来点二次元', '来点二刺螈'}, priority=15, block=True)
|
ecy_pic = on_regex(r'^来点(二次元|二刺螈|银发|兽耳|星空|竖屏|横屏)图?$', priority=15, block=True)
|
||||||
ys_pic = on_command('原神壁纸', aliases={'来点原神图', '来点原神壁纸'}, priority=15, block=True)
|
ys_pic = on_command('原神壁纸', aliases={'来点原神图', '来点原神壁纸'}, priority=15, block=True)
|
||||||
|
|
||||||
duilian_limit = FreqLimiter(config.paimon_duilian_cd)
|
duilian_limit = FreqLimiter(config.paimon_duilian_cd)
|
||||||
@ -55,29 +55,41 @@ async def cat_pic_handler(event: Union[GroupMessageEvent, MessageEvent]):
|
|||||||
if not cat_lmt.check(event.group_id or event.user_id):
|
if not cat_lmt.check(event.group_id or event.user_id):
|
||||||
await cat_pic.finish(f'猫片冷却ing(剩余{cat_lmt.left_time(event.group_id or event.user_id)}秒)')
|
await cat_pic.finish(f'猫片冷却ing(剩余{cat_lmt.left_time(event.group_id or event.user_id)}秒)')
|
||||||
else:
|
else:
|
||||||
|
await cat_pic.send('派蒙努力找图ing..请稍候...')
|
||||||
cat_lmt.start_cd(event.group_id or event.user_id, config.paimon_cat_cd)
|
cat_lmt.start_cd(event.group_id or event.user_id, config.paimon_cat_cd)
|
||||||
url = 'http://edgecats.net/'
|
url = 'http://edgecats.net/'
|
||||||
async with ClientSession() as session:
|
await cat_pic.finish(MessageSegment.image(file=url))
|
||||||
res = await session.get(url)
|
|
||||||
res = await res.read()
|
|
||||||
await cat_pic.finish(MessageSegment.image(res))
|
|
||||||
|
|
||||||
|
|
||||||
@ecy_pic.handle()
|
@ecy_pic.handle()
|
||||||
async def ecy_pic_handler(event: Union[GroupMessageEvent, MessageEvent]):
|
async def ecy_pic_handler(event: Union[GroupMessageEvent, MessageEvent], regexGroup=RegexGroup()):
|
||||||
urls = [
|
urls = [
|
||||||
'https://www.dmoe.cc/random.php',
|
'https://www.dmoe.cc/random.php',
|
||||||
'https://acg.toubiec.cn/random.php',
|
'https://acg.toubiec.cn/random.php',
|
||||||
'https://api.ixiaowai.cn/api/api.php'
|
'https://api.ixiaowai.cn/api/api.php',
|
||||||
|
'https://iw233.cn/api.php?sort=iw233'
|
||||||
]
|
]
|
||||||
|
img_type = regexGroup[0]
|
||||||
|
if img_type in ['二次元', '二刺螈']:
|
||||||
|
url = random.choice(urls)
|
||||||
|
elif img_type == '银发':
|
||||||
|
url = 'https://iw233.cn/api.php?sort=yin'
|
||||||
|
elif img_type == '兽耳':
|
||||||
|
url = 'https://iw233.cn/api.php?sort=cat'
|
||||||
|
elif img_type == '星空':
|
||||||
|
url = 'https://iw233.cn/api.php?sort=xing'
|
||||||
|
elif img_type == '竖屏':
|
||||||
|
url = 'https://iw233.cn/api.php?sort=mp'
|
||||||
|
elif img_type == '横屏':
|
||||||
|
url = 'https://iw233.cn/api.php?sort=pc'
|
||||||
|
else:
|
||||||
|
url = ''
|
||||||
if not ecy_lmt.check(event.group_id or event.user_id):
|
if not ecy_lmt.check(event.group_id or event.user_id):
|
||||||
await ecy_pic.finish(f'二次元图片冷却ing(剩余{ecy_lmt.left_time(event.group_id or event.user_id)}秒)')
|
await ecy_pic.finish(f'二次元图片冷却ing(剩余{ecy_lmt.left_time(event.group_id or event.user_id)}秒)')
|
||||||
else:
|
elif url:
|
||||||
|
await cat_pic.send('派蒙努力找图ing..请稍候...')
|
||||||
ecy_lmt.start_cd(event.group_id or event.user_id, config.paimon_ecy_cd)
|
ecy_lmt.start_cd(event.group_id or event.user_id, config.paimon_ecy_cd)
|
||||||
async with ClientSession() as session:
|
await cat_pic.finish(MessageSegment.image(file=url))
|
||||||
res = await session.get(random.choice(urls))
|
|
||||||
res = await res.read()
|
|
||||||
await cat_pic.finish(MessageSegment.image(res))
|
|
||||||
|
|
||||||
|
|
||||||
@ys_pic.handle()
|
@ys_pic.handle()
|
||||||
@ -91,11 +103,9 @@ async def ys_pic_handler(event: Union[GroupMessageEvent, MessageEvent]):
|
|||||||
if not ys_lmt.check(event.group_id or event.user_id):
|
if not ys_lmt.check(event.group_id or event.user_id):
|
||||||
await ys_pic.finish(f'原神壁纸冷却ing(剩余{ys_lmt.left_time(event.group_id or event.user_id)}秒)')
|
await ys_pic.finish(f'原神壁纸冷却ing(剩余{ys_lmt.left_time(event.group_id or event.user_id)}秒)')
|
||||||
else:
|
else:
|
||||||
|
await cat_pic.send('派蒙努力找图ing..请稍候...')
|
||||||
ys_lmt.start_cd(event.group_id or event.user_id, config.paimon_ysp_cd)
|
ys_lmt.start_cd(event.group_id or event.user_id, config.paimon_ysp_cd)
|
||||||
async with ClientSession() as session:
|
await ys_pic.finish(MessageSegment.image(file=random.choice(urls)))
|
||||||
res = await session.get(random.choice(urls))
|
|
||||||
res = await res.read()
|
|
||||||
await ys_pic.finish(MessageSegment.image(res))
|
|
||||||
|
|
||||||
|
|
||||||
@event_preprocessor
|
@event_preprocessor
|
||||||
|
Loading…
Reference in New Issue
Block a user