🎨 兼容PEP614

This commit is contained in:
Wuyi无疑 2023-03-25 00:36:07 +08:00
parent 9983979d7c
commit 9196e894f2

View File

@ -4,8 +4,10 @@ from gsuid_core.bot import Bot
from gsuid_core.sv import SL, SV from gsuid_core.sv import SL, SV
from gsuid_core.models import Event from gsuid_core.models import Event
sv_switch = SV('测试开关')
@SV('开关').on_prefix(('关闭', '开启'))
@sv_switch.on_prefix(('关闭', '开启'))
async def get_switch_msg(bot: Bot, ev: Event): async def get_switch_msg(bot: Bot, ev: Event):
name = ev.text name = ev.text
if not name: if not name:
@ -24,28 +26,28 @@ async def get_switch_msg(bot: Bot, ev: Event):
await bot.send('未找到该服务...') await bot.send('未找到该服务...')
@SV('测试').on_fullmatch('全匹配测试') @sv_switch.on_fullmatch('全匹配测试')
async def get_fullmatch_msg(bot: Bot, ev: Event): async def get_fullmatch_msg(bot: Bot, ev: Event):
await bot.send('正在进行[全匹配测试]') await bot.send('正在进行[全匹配测试]')
await asyncio.sleep(2) await asyncio.sleep(2)
await bot.send('[全匹配测试]校验成功!') await bot.send('[全匹配测试]校验成功!')
@SV('测试').on_prefix('前缀测试') @sv_switch.on_prefix('前缀测试')
async def get_prefix_msg(bot: Bot, ev: Event): async def get_prefix_msg(bot: Bot, ev: Event):
await bot.send('正在进行[前缀测试]') await bot.send('正在进行[前缀测试]')
await asyncio.sleep(2) await asyncio.sleep(2)
await bot.send('[前缀测试]校验成功!') await bot.send('[前缀测试]校验成功!')
@SV('测试').on_suffix('后缀测试') @sv_switch.on_suffix('后缀测试')
async def get_suffix_msg(bot: Bot, ev: Event): async def get_suffix_msg(bot: Bot, ev: Event):
await bot.send('正在进行[后缀测试]') await bot.send('正在进行[后缀测试]')
await asyncio.sleep(2) await asyncio.sleep(2)
await bot.send('[后缀测试]校验成功!') await bot.send('[后缀测试]校验成功!')
@SV('测试').on_keyword('关键词测试') @sv_switch.on_keyword('关键词测试')
async def get_keyword_msg(bot: Bot, ev: Event): async def get_keyword_msg(bot: Bot, ev: Event):
await bot.send('正在进行[关键词测试]') await bot.send('正在进行[关键词测试]')
await asyncio.sleep(2) await asyncio.sleep(2)