CMHopeSunshine fa12023db0 小派蒙
2022-03-13 21:25:42 +08:00

25 lines
980 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import hoshino
from hoshino import Service, priv
from hoshino.typing import CQEvent
from hoshino.util import DailyNumberLimiter
sv = Service('_feedback_', manage_priv=priv.SUPERUSER, help_='[#来杯咖啡] 后接反馈内容 联系维护组')
_max = 1
lmt = DailyNumberLimiter(_max)
EXCEED_NOTICE = f'您今天已经喝过{_max}杯了请明早5点后再来'
@sv.on_prefix('#来杯咖啡')
async def feedback(bot, ev: CQEvent):
uid = ev.user_id
if not lmt.check(uid):
await bot.finish(ev, EXCEED_NOTICE, at_sender=True)
coffee = hoshino.config.SUPERUSERS[0]
text = str(ev.message).strip()
if not text:
await bot.send(ev, "请发送来杯咖啡+您要反馈的内容~", at_sender=True)
else:
await bot.send_private_msg(self_id=ev.self_id, user_id=coffee, message=f'Q{uid}@群{ev.group_id}\n{text}')
await bot.send(ev, f'您的反馈已发送至维护组!\n======\n{text}', at_sender=True)
lmt.increase(uid)