2021-05-20 19:23:32 +08:00
|
|
|
|
from nonebot import on_notice
|
2022-02-19 18:20:19 +08:00
|
|
|
|
from nonebot.adapters.onebot.v11 import PokeNotifyEvent
|
|
|
|
|
|
from configs.path_config import RECORD_PATH, IMAGE_PATH
|
2021-07-30 21:21:51 +08:00
|
|
|
|
from utils.message_builder import record, image, poke
|
2021-05-20 19:23:32 +08:00
|
|
|
|
from services.log import logger
|
|
|
|
|
|
import random
|
2021-06-30 19:50:55 +08:00
|
|
|
|
from utils.utils import CountLimiter
|
2021-05-20 19:23:32 +08:00
|
|
|
|
from models.ban_user import BanUser
|
2022-02-19 18:20:19 +08:00
|
|
|
|
import os
|
2021-05-20 19:23:32 +08:00
|
|
|
|
|
2021-10-03 14:24:07 +08:00
|
|
|
|
__zx_plugin_name__ = "戳一戳"
|
2021-06-15 10:57:08 +08:00
|
|
|
|
|
2021-10-03 14:24:07 +08:00
|
|
|
|
__plugin_usage__ = """
|
|
|
|
|
|
usage:
|
|
|
|
|
|
戳一戳随机掉落语音或美图萝莉图
|
|
|
|
|
|
""".strip()
|
|
|
|
|
|
__plugin_des__ = "戳一戳发送语音美图萝莉图不美哉?"
|
2021-12-16 11:16:28 +08:00
|
|
|
|
__plugin_type__ = ("其他",)
|
2021-10-03 14:24:07 +08:00
|
|
|
|
__plugin_version__ = 0.1
|
|
|
|
|
|
__plugin_author__ = "HibiKier"
|
|
|
|
|
|
__plugin_settings__ = {
|
|
|
|
|
|
"level": 5,
|
|
|
|
|
|
"default_status": True,
|
|
|
|
|
|
"limit_superuser": False,
|
|
|
|
|
|
"cmd": ["戳一戳"],
|
|
|
|
|
|
}
|
2021-05-20 19:23:32 +08:00
|
|
|
|
|
|
|
|
|
|
poke__reply = [
|
2021-07-30 21:21:51 +08:00
|
|
|
|
"lsp你再戳?",
|
|
|
|
|
|
"连个可爱美少女都要戳的肥宅真恶心啊。",
|
|
|
|
|
|
"你再戳!",
|
|
|
|
|
|
"?再戳试试?",
|
|
|
|
|
|
"别戳了别戳了再戳就坏了555",
|
|
|
|
|
|
"我爪巴爪巴,球球别再戳了",
|
|
|
|
|
|
"你戳你🐎呢?!",
|
|
|
|
|
|
"那...那里...那里不能戳...绝对...",
|
|
|
|
|
|
"(。´・ω・)ん?",
|
|
|
|
|
|
"有事恁叫我,别天天一个劲戳戳戳!",
|
|
|
|
|
|
"欸很烦欸!你戳🔨呢",
|
|
|
|
|
|
"?",
|
|
|
|
|
|
"再戳一下试试?",
|
|
|
|
|
|
"???",
|
|
|
|
|
|
"正在关闭对您的所有服务...关闭成功",
|
|
|
|
|
|
"啊呜,太舒服刚刚竟然睡着了。什么事?",
|
|
|
|
|
|
"正在定位您的真实地址...定位成功。轰炸机已起飞",
|
2021-05-20 19:23:32 +08:00
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_clmt = CountLimiter(3)
|
|
|
|
|
|
|
2021-06-15 10:57:08 +08:00
|
|
|
|
poke_ = on_notice(priority=5, block=False)
|
2021-05-20 19:23:32 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@poke_.handle()
|
2022-02-19 18:20:19 +08:00
|
|
|
|
async def _poke_event(event: PokeNotifyEvent):
|
2021-06-15 10:57:08 +08:00
|
|
|
|
if event.self_id == event.target_id:
|
2021-05-20 19:23:32 +08:00
|
|
|
|
_clmt.add(event.user_id)
|
|
|
|
|
|
if _clmt.check(event.user_id) or random.random() < 0.3:
|
2021-07-30 21:21:51 +08:00
|
|
|
|
rst = ""
|
2021-05-20 19:23:32 +08:00
|
|
|
|
if random.random() < 0.15:
|
|
|
|
|
|
await BanUser.ban(event.user_id, 1, 60)
|
2021-07-30 21:21:51 +08:00
|
|
|
|
rst = "气死我了!"
|
2021-05-20 19:23:32 +08:00
|
|
|
|
await poke_.finish(rst + random.choice(poke__reply), at_sender=True)
|
|
|
|
|
|
rand = random.random()
|
|
|
|
|
|
if rand <= 0.3:
|
2022-02-19 18:20:19 +08:00
|
|
|
|
path = random.choice(["luoli", "meitu"])
|
2022-04-09 12:44:33 +08:00
|
|
|
|
index = random.randint(0, len(os.listdir(IMAGE_PATH / "image_management" / path)))
|
|
|
|
|
|
result = f"id:{index}" + image(f"{index}.jpg", "image_management/" + path)
|
2021-05-20 19:23:32 +08:00
|
|
|
|
await poke_.send(result)
|
2021-07-30 21:21:51 +08:00
|
|
|
|
logger.info(f"USER {event.user_id} 戳了戳我 回复: {result} \n {result}")
|
2021-05-20 19:23:32 +08:00
|
|
|
|
elif 0.3 < rand < 0.6:
|
2022-02-19 18:20:19 +08:00
|
|
|
|
voice = random.choice(os.listdir(RECORD_PATH / "dinggong"))
|
2021-05-20 19:23:32 +08:00
|
|
|
|
result = record(voice, "dinggong")
|
|
|
|
|
|
await poke_.send(result)
|
2021-07-30 21:21:51 +08:00
|
|
|
|
await poke_.send(voice.split("_")[1])
|
|
|
|
|
|
logger.info(
|
|
|
|
|
|
f'USER {event.user_id} 戳了戳我 回复: {result} \n {voice.split("_")[1]}'
|
|
|
|
|
|
)
|
2021-05-20 19:23:32 +08:00
|
|
|
|
else:
|
|
|
|
|
|
await poke_.send(poke(event.user_id))
|