mirror of
https://github.com/Genshin-bots/gsuid_core.git
synced 2025-05-12 06:55:49 +08:00
✨ 新增给我发消息
和特殊ID配置
This commit is contained in:
parent
242b0ec2b9
commit
583793c063
@ -16,6 +16,8 @@ R_enabled = core_plugins_config.get_config('AutoAddRandomText').data
|
||||
R_text = core_plugins_config.get_config('RandomText').data
|
||||
is_text2pic = core_plugins_config.get_config('AutoTextToPic').data
|
||||
text2pic_limit = core_plugins_config.get_config('TextToPicThreshold').data
|
||||
is_specific_msg_id = core_plugins_config.get_config('EnableSpecificMsgId').data
|
||||
specific_msg_id = core_plugins_config.get_config('SpecificMsgId').data
|
||||
|
||||
|
||||
class _Bot:
|
||||
@ -72,6 +74,9 @@ class _Bot:
|
||||
img = await text2pic(_message[0].data)
|
||||
_message = [MessageSegment.image(img)]
|
||||
|
||||
if is_specific_msg_id:
|
||||
msg_id = specific_msg_id
|
||||
|
||||
send = MessageSend(
|
||||
content=_message,
|
||||
bot_id=bot_id,
|
||||
|
@ -1,10 +1,13 @@
|
||||
from gsuid_core.sv import SV
|
||||
from gsuid_core.bot import Bot
|
||||
from gsuid_core.gss import gss
|
||||
from gsuid_core.models import Event
|
||||
from gsuid_core.logger import logger
|
||||
|
||||
from .draw_user_card import get_user_card
|
||||
|
||||
core_user_info = SV('core用户信息')
|
||||
core_user_msg = SV('core信息确认')
|
||||
|
||||
|
||||
@core_user_info.on_fullmatch(('绑定信息'))
|
||||
@ -13,3 +16,12 @@ async def send_bind_card(bot: Bot, ev: Event):
|
||||
im = await get_user_card(ev.bot_id, ev.user_id)
|
||||
await bot.logger.info('[查询用户绑定状态]完成!等待图片发送中...')
|
||||
await bot.send(im)
|
||||
|
||||
|
||||
@core_user_msg.on_fullmatch(('给我发消息'))
|
||||
async def send_direct_msg(bot: Bot, ev: Event):
|
||||
logger.info('开始执行[给我发消息]')
|
||||
for bot_id in gss.active_bot:
|
||||
await gss.active_bot[bot_id].target_send(
|
||||
'这是一条主动消息', 'direct', ev.user_id, ev.bot_id, ev.bot_self_id, ''
|
||||
)
|
||||
|
@ -56,4 +56,6 @@ CONIFG_DEFAULT: Dict[str, GSC] = {
|
||||
'ChangeErrorToPic': GsBoolConfig('错误提示转换为图片', '将一部分报错提示转换为图片', True),
|
||||
'AutoTextToPic': GsBoolConfig('自动文字转图', '将所有发送的文字转图', True),
|
||||
'TextToPicThreshold': GsStrConfig('文转图阈值', '开启自动转图后超过该阈值的文字会转成图片', '20'),
|
||||
'EnableSpecificMsgId': GsBoolConfig('启用回复特殊ID', '如不知道请勿开启', False),
|
||||
'SpecificMsgId': GsStrConfig('特殊返回消息ID', '如不知道请勿填写', ''),
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user