✨ 新增on_keywords
This commit is contained in:
24
src/liteyuki_plugins/anti_dislink.py
Normal file
24
src/liteyuki_plugins/anti_dislink.py
Normal file
@ -0,0 +1,24 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Copyright (C) 2020-2024 LiteyukiStudio. All Rights Reserved
|
||||
|
||||
@Time : 2024/8/22 上午9:06
|
||||
@Author : snowykami
|
||||
@Email : snowykami@outlook.com
|
||||
@File : anti_dislink.py
|
||||
@Software: PyCharm
|
||||
"""
|
||||
import random
|
||||
from liteyuki.plugin import PluginMetadata, PluginType
|
||||
|
||||
from liteyuki.message.on import on_keywords
|
||||
|
||||
__plugin_meta__ = PluginMetadata(
|
||||
name="严禁断联化",
|
||||
type=PluginType.APPLICATION
|
||||
)
|
||||
|
||||
|
||||
@on_keywords(["看看你的", "看看j", "给我看看"]).handle()
|
||||
async def _(event):
|
||||
event.reply(random.choice(["No dislink", "严禁断联化"]))
|
@ -14,11 +14,11 @@ from liteyuki.message.event import MessageEvent
|
||||
|
||||
__plugin_meta__ = PluginMetadata(
|
||||
name="你好轻雪",
|
||||
type=PluginType.TEST
|
||||
type=PluginType.APPLICATION
|
||||
)
|
||||
|
||||
|
||||
@on_message().handle
|
||||
@on_message().handle()
|
||||
async def _(event: MessageEvent):
|
||||
if str(event.raw_message) == "你好轻雪":
|
||||
event.reply("你好呀")
|
||||
|
26
src/liteyuki_plugins/ts_chan_main.py
Normal file
26
src/liteyuki_plugins/ts_chan_main.py
Normal file
@ -0,0 +1,26 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Copyright (C) 2020-2024 LiteyukiStudio. All Rights Reserved
|
||||
|
||||
@Time : 2024/8/22 上午8:37
|
||||
@Author : snowykami
|
||||
@Email : snowykami@outlook.com
|
||||
@File : ts_chan_main.py
|
||||
@Software: PyCharm
|
||||
"""
|
||||
import asyncio
|
||||
|
||||
from liteyuki.comm import Channel, set_channel, get_channel
|
||||
from liteyuki import get_bot
|
||||
|
||||
set_channel("chan-main", Channel("chan-main"))
|
||||
set_channel("chan-sub", Channel("chan-sub"))
|
||||
|
||||
chan_main = get_channel("chan-main")
|
||||
|
||||
|
||||
# @get_bot().on_after_start
|
||||
# async def _():
|
||||
# while True:
|
||||
# chan_main.send("Hello, World!")
|
||||
# await asyncio.sleep(5)
|
Reference in New Issue
Block a user