inc = InterruptControl(bcc) loop = bcc.loop channel.name("GenshinResourcePoints") channel.author("SAGIRI-kawaii") channel.description( "一个获取原神资源的插件\n" "在群中发送 `{resource_name} 在哪里? | 哪里?有 {resource_name}` 即可查看资源地图\n" "在群中发送 `原神资源列表` 即可查看资源列表") @channel.use( ListenerSchema(listening_events=[GroupMessage], inline_dispatchers=[ Twilight([ FullMatch("原神"), RegexMatch(r"哪里?有", optional=True), RegexMatch(r"[^\s]+") @ "resource_name", RegexMatch(r"在哪里?") ]) ], decorators=[ FrequencyLimit.require("genshin_resource_points", 4), Function.require(channel.module), BlackListControl.enable(), UserCalledCountControl.add( UserCalledCountControl.FUNCTIONS) ])) async def genshin_resource_points(app: Ariadne, message: MessageChain, group: Group, resource_name: RegexResult): resource_name = resource_name.result.asDisplay().strip()
self.__is_running = False gw = GithubWatcher() @channel.use(SchedulerSchema(timer=timers.every_minute())) async def github_schedule(app: Ariadne): try: await gw.github_schedule(app=app, manual=False) except: pass twilight = Twilight([ FullMatch("/github-watch "), UnionMatch("disable", "add", "remove", "check", "cache"), WildcardMatch() ]) @channel.use( ListenerSchema(listening_events=[FriendMessage], # inline_dispatchers=[twilight] )) async def github_watcher_friend_handler(app: Ariadne, message: MessageChain, friend: Friend): if result := await gw.real_handle(app, message, friend=friend): await MessageSender(result.strategy).send(app, result.message, message, friend, friend)
channel.name("DailyNewspaper") channel.author("SAGIRI-kawaii") channel.description("一个定时发送每日日报的插件\n" "主人私聊bot发送 `发送早报` 可在群中发送早报\n" "在群中发送 `今日早报` 可在群中发送早报") @channel.use(SchedulerSchema(crontabify("30 8 * * *"))) async def something_scheduled(app: Ariadne): await send_newspaper(app) @channel.use( ListenerSchema(listening_events=[FriendMessage], inline_dispatchers=[Twilight([FullMatch("发送早报")])])) async def main(app: Ariadne, friend: Friend): if not friend.id == host_qq: return None await send_newspaper(app) @channel.use( ListenerSchema(listening_events=[GroupMessage], inline_dispatchers=[Twilight([FullMatch("今日早报")])])) async def main(app: Ariadne, group: Group): await app.sendMessage(group, MessageChain([Image(data_bytes=await get_image())])) async def send_newspaper(app: Ariadne):
channel.description("一个接入lolicon api的插件,在群中发送 `来点{keyword}[色涩瑟]图` 即可") core = AppCore.get_core_instance() config = core.get_config() proxy = config.proxy if config.proxy != "proxy" else "" image_cache = config.data_related.get("lolicon_image_cache") data_cache = config.data_related.get("lolicon_data_cache") @channel.use( ListenerSchema( listening_events=[GroupMessage], inline_dispatchers=[ Twilight( [ FullMatch("来点"), RegexMatch(r"[^\s]+") @ "keyword", RegexMatch(r"[色涩瑟]图$"), ] ) ], decorators=[ FrequencyLimit.require("lolicon_keyword_searcher", 2), Function.require(channel.module), BlackListControl.enable(), UserCalledCountControl.add(UserCalledCountControl.SETU), ], ) ) async def lolicon_keyword_searcher( app: Ariadne, message: MessageChain, group: Group, keyword: RegexResult
class ConfirmWaiter(Waiter.create([GroupMessage])): """ 超时Waiter """ def __init__(self, group: Union[int, Group], member: Union[int, Member]): self.group = group if isinstance(group, int) else group.id self.member = (member if isinstance(member, int) else member.id) if member else None async def detected_event(self, app: Ariadne, group: Group, member: Member, message: MessageChain): if group.id == self.group and member.id == self.member: return True if re.match(r"[是否]", message.asDisplay()) else False add_keyword_twilight = Twilight([ FullMatch(r"添加"), FullMatch("群组", optional=True) @ "group_only", RegexMatch(r"(模糊|正则)", optional=True) @ "op_type", FullMatch("回复关键词#"), RegexMatch(r"[^\s]+") @ "keyword", FullMatch("#"), WildcardMatch().flags(re.DOTALL) @ "response" ]) delete_keyword_twilight = Twilight([ FullMatch(r"删除"), FullMatch("群组", optional=True) @ "group_only", RegexMatch(r"(模糊|正则)", optional=True) @ "op_type", FullMatch("回复关键词#"), RegexMatch(r"[^\s]+") @ "keyword" ])
group_pool[gid] = pool_name else: group_pool.setdefault(gid, pool_name) save_group_pool() await app.sendMessage(group, MessageChain(f"卡池已切换为 {pool_name} ")) return txt = "请使用以下命令来切换卡池\n" for i in POOL.keys(): txt += f"原神卡池切换 {i} \n" await app.sendMessage(group, MessageChain(txt)) @channel.use( ListenerSchema(listening_events=[GroupMessage], inline_dispatchers=[Twilight([FullMatch("更新原神卡池")])], decorators=[ Function.require(channel.module), BlackListControl.enable() ])) async def up_pool_(app: Ariadne, group: Group, member: Member, message: MessageChain): if not await user_permission_require(group, member, 3): await app.sendMessage(group, MessageChain('只有群管理才能更新卡池'), quote=message.getFirst(Source)) return await app.sendMessage(group, MessageChain('正在更新卡池')) _ = await init_pool_list() await app.sendMessage(group, MessageChain('更新卡池完成'))
saya = Saya.current() channel = Channel.current() channel.name("BWGrass") channel.author("SAGIRI-kawaii") channel.description("一个生成黑白草图的插件,在群中发送 `黑白[草]图 内容 图片` 即可") core = AppCore.get_core_instance() config = core.get_config() @channel.use( ListenerSchema(listening_events=[GroupMessage], inline_dispatchers=[ Twilight([ FullMatch("黑白"), FullMatch("草", optional=True), FullMatch("图"), RegexMatch(r".+") @ "content", ElementMatch(Image) @ "image" ]) ])) async def black_white_grass(app: Ariadne, message: MessageChain, group: Group, member: Member, content: RegexResult, image: ElementResult): if result := await BWGrass.handle(app, message, group, member, content, image): await MessageSender(result.strategy).send(app, result.message, message, group, member)
from utils.text_engine.text_engine import TextEngine from sagiri_bot.control import FrequencyLimit, Function, BlackListControl, UserCalledCountControl saya = Saya.current() channel = Channel.current() channel.name("MessageMerger") channel.author("SAGIRI-kawaii") channel.description("将收到的消息合并为图片,在群中发送 `/merge 文字/图片`") @channel.use( ListenerSchema(listening_events=[GroupMessage], inline_dispatchers=[ Twilight([ FullMatch("/merge"), WildcardMatch().flags(re.S) @ "msg_to_merge" ]) ], decorators=[ FrequencyLimit.require("message_merger", 2), Function.require(channel.module), BlackListControl.enable(), UserCalledCountControl.add( UserCalledCountControl.FUNCTIONS) ])) async def message_merger(app: Ariadne, message: MessageChain, group: Group, msg_to_merge: RegexResult): await app.sendGroupMessage( group, MessageChain([
from sagiri_bot.orm.async_orm import Setting from sagiri_bot.control import FrequencyLimit, Function, BlackListControl, UserCalledCountControl saya = Saya.current() channel = Channel.current() channel.name("NetworkCompiler") channel.author("SAGIRI-kawaii") channel.description("一个网络编译器插件,在群中发送 `super language\\n code`即可") @channel.use( ListenerSchema(listening_events=[GroupMessage], inline_dispatchers=[ Twilight([ FullMatch("super"), RegexMatch(r"[^\s]+") @ "language", RegexMatch(r"[\s]+", optional=True), RegexMatch(r"[\s\S]+") @ "code" ]) ], decorators=[ FrequencyLimit.require("network_compiler", 2), Function.require(channel.module), BlackListControl.enable(), UserCalledCountControl.add( UserCalledCountControl.FUNCTIONS) ])) async def network_compiler(app: Ariadne, message: MessageChain, group: Group, language: RegexResult, code: RegexResult): if not await group_setting.get_setting(group.id, Setting.compile):
saya = Saya.current() channel = Channel.current() channel.name("GenshinMaterialRemind") channel.author("SAGIRI-kawaii") channel.description("一个可以查询原神每日可获取素材的插件,在群中发送 `原神今日素材` 即可") core = AppCore.get_core_instance() config = core.get_config() proxy = config.proxy if config.proxy != "proxy" else '' IMAGE_PATH = Path.cwd() / "statics" / "genshin" / "material" @channel.use( ListenerSchema(listening_events=[GroupMessage], inline_dispatchers=[Twilight([FullMatch("原神今日素材")])], decorators=[ FrequencyLimit.require("genshin_material_remind", 2), Function.require(channel.module), BlackListControl.enable(), UserCalledCountControl.add( UserCalledCountControl.FUNCTIONS) ])) async def genshin_material_remind( app: Ariadne, message: MessageChain, group: Group, ): if time.strftime("%w") == "0": await app.sendGroupMessage(group, MessageChain("今天是周日,所有材料副本都开放了。"),
), tile=0, tile_pad=10, pre_pad=0, half=False, ) if enable else None max_size = 2073600 mutex = Semaphore(1) @channel.use( ListenerSchema(listening_events=[GroupMessage], inline_dispatchers=[ Twilight([ FullMatch("/超分"), FullMatch("-resize", optional=True) @ "resize", FullMatch("\n", optional=True) @ "enter", ElementMatch(Image, optional=True) @ "image" ]) ], decorators=[ FrequencyLimit.require("super_resolution", 5), Function.require(channel.module), BlackListControl.enable(), UserCalledCountControl.add( UserCalledCountControl.FUNCTIONS) ])) async def super_resolution(app: Ariadne, message: MessageChain, group: Group, member: Member, image: ElementResult, resize: RegexResult):
from sagiri_bot.control import FrequencyLimit, Function, BlackListControl, UserCalledCountControl saya = Saya.current() channel = Channel.current() channel.name("QrcodeGenerator") channel.author("SAGIRI-kawaii") channel.description("一个生成二维码的插件,在群中发送 `qrcode 内容` 即可(文字)") @channel.use( ListenerSchema( listening_events=[GroupMessage], inline_dispatchers=[ Twilight([FullMatch("qrcode"), RegexMatch(r"[^\s]+$") @ "content"]) ], decorators=[ FrequencyLimit.require("qrcode_generator", 1), Function.require(channel.module), BlackListControl.enable(), UserCalledCountControl.add(UserCalledCountControl.FUNCTIONS) ])) async def qrcode_generator(app: Ariadne, message: MessageChain, group: Group, content: RegexResult): content = content.result.asDisplay() qrcode_img = qrcode.make(content) bytes_io = BytesIO() qrcode_img.save(bytes_io) await app.sendGroupMessage(group,
saya = Saya.current() channel = Channel.current() channel.name("Aminer") channel.author("SAGIRI-kawaii") channel.description("一个搜索导师信息的插件") config = AppCore.get_core_instance().get_config() @channel.use( ListenerSchema( listening_events=[GroupMessage], inline_dispatchers=[ Twilight([ FullMatch("/aminer"), ArgumentMatch("-person", action="store_true", optional=True) @ "person", ArgumentMatch("-article", "-a", "-paper", action="store_true", optional=True) @ "article", ArgumentMatch("-patent", action="store_true", optional=True) @ "patent", WildcardMatch() @ "keyword" ]) ], decorators=[ FrequencyLimit.require("aminer", 1), Function.require(channel.module),
from sagiri_bot.control import FrequencyLimit, Function, BlackListControl, UserCalledCountControl saya = Saya.current() channel = Channel.current() channel.name("DDCheck") channel.author("SAGIRI-kawaii") channel.description("一个查成分的插件") config = AppCore.get_core_instance().get_config() @channel.use( ListenerSchema( listening_events=[GroupMessage], inline_dispatchers=[Twilight([FullMatch("/查成分"), WildcardMatch() @ "username"])], decorators=[ FrequencyLimit.require("dd_check", 2), Function.require(channel.module), BlackListControl.enable(), UserCalledCountControl.add(UserCalledCountControl.SEARCH) ] ) ) async def dd_check(app: Ariadne, group: Group, message: MessageChain, username: RegexResult): if not username.result.asDisplay().strip(): return await app.sendGroupMessage(group, MessageChain("空白名怎么查啊kora!"), quote=message.getFirst(Source)) res = await get_reply(username.result.asDisplay().strip()) await app.sendGroupMessage( group, MessageChain(res if isinstance(res, str) else [Image(data_bytes=res)]),
saya = Saya.current() channel = Channel.current() channel.name("SystemStatus") channel.author("SAGIRI-kawaii") channel.description("查看系统状态") image_path = AppCore.get_core_instance().get_config().image_path @channel.use( ListenerSchema( listening_events=[GroupMessage], inline_dispatchers=[ Twilight([ FullMatch("/sys"), ArgumentMatch("-a", "-all", optional=True, action="store_true") @ "all_info", ArgumentMatch( "-i", "-info", optional=True, action="store_true") @ "info", ArgumentMatch( "-s", "-storage", optional=True, action="store_true") @ "storage", ]) ], decorators=[Permission.require(Permission.SUPER_ADMIN)])) async def system_status(app: Ariadne, group: Group, all_info: ArgResult, info: ArgResult, storage: ArgResult): mem = psutil.virtual_memory() memory_message = MessageChain(
from sagiri_bot.control import FrequencyLimit, Function, BlackListControl, UserCalledCountControl saya = Saya.current() channel = Channel.current() channel.name("PhantomTank") channel.author("SAGIRI-kawaii") channel.description("一个幻影坦克生成器,在群中发送 `幻影 [显示图] [隐藏图]` 即可") @channel.use( ListenerSchema(listening_events=[GroupMessage], inline_dispatchers=[ Twilight([ FullMatch("彩色", optional=True) @ "colorful", FullMatch("幻影"), RegexMatch(r'[\s]?', optional=True), ElementMatch(Image) @ "img1", RegexMatch(r'[\s]?', optional=True), ElementMatch(Image) @ "img2" ]) ], decorators=[ FrequencyLimit.require("phantom_tank", 3), Function.require(channel.module), BlackListControl.enable(), UserCalledCountControl.add( UserCalledCountControl.FUNCTIONS) ])) async def phantom_tank(app: Ariadne, message: MessageChain, group: Group,
await update_member_statistic(group, member, StatisticType.wrong) await app.sendGroupMessage( group, MessageChain( [Image(data_bytes=self.wordle.get_board_bytes())]), quote=message_source) return False @channel.use( ListenerSchema( listening_events=[GroupMessage], inline_dispatchers=[ Twilight([ FullMatch("/wordle"), ArgumentMatch("-single", action="store_true", optional=True) @ "single_game", ArgumentMatch("-group", action="store_true", optional=True) @ "group_game", RegexMatch(r"-(l|length)=[0-9]+", optional=True) @ "length", RegexMatch(r"-(d|dic)=\w+", optional=True) @ "dic", ArgumentMatch( "-help", "-h", action="store_true", optional=True) @ "get_help", ArgumentMatch( "-giveup", "-g", action="store_true", optional=True) @ "give_up", ArgumentMatch( "-s", "-statistic", action="store_true", optional=True) @ "statistic"
from sagiri_bot.control import FrequencyLimit, Function, BlackListControl, UserCalledCountControl saya = Saya.current() channel = Channel.current() channel.name("MarketingContentGenerator") channel.author("SAGIRI-kawaii") channel.description("一个营销号内容生成器插件,在群中发送 `营销号#事件主体#事件内容#事件另一种说法` 即可") @channel.use( ListenerSchema( listening_events=[GroupMessage], inline_dispatchers=[ Twilight([ FullMatch("营销号#"), RegexMatch(r"[^\s]+") @ "somebody", FullMatch("#"), RegexMatch(r"[^\s]+") @ "something", FullMatch("#"), RegexMatch(r"[^\s]+") @ "other_word" ]) ], decorators=[ FrequencyLimit.require("marketing_content_generator", 1), Function.require(channel.module), BlackListControl.enable(), UserCalledCountControl.add(UserCalledCountControl.FUNCTIONS) ])) async def marketing_content_generator(app: Ariadne, message: MessageChain, group: Group, somebody: RegexResult,
from sagiri_bot.control import FrequencyLimit, Function, BlackListControl, UserCalledCountControl saya = Saya.current() channel = Channel.current() channel.name("HotWordsExplainer") channel.author("SAGIRI-kawaii") channel.description("一个可以查询热门词的插件,在群中发送 `{keyword}是什么梗`") @channel.use( ListenerSchema( listening_events=[GroupMessage], inline_dispatchers=[ Twilight([RegexMatch(r"[^\s]+") @ "keyword", FullMatch("是什么梗")]) ], decorators=[ FrequencyLimit.require("hot_words_explainer", 2), Function.require(channel.module), BlackListControl.enable(), UserCalledCountControl.add(UserCalledCountControl.FUNCTIONS) ])) async def hot_words_explainer(app: Ariadne, message: MessageChain, group: Group, keyword: RegexResult): await app.sendGroupMessage(group, await get_result(keyword.result.asDisplay()), quote=message.getFirst(Source)) async def get_result(keyword: str) -> MessageChain:
saya = Saya.current() channel = Channel.current() channel.name("AbstractMessageTransformer") channel.author("SAGIRI-kawaii") channel.description("一个普通话转抽象话的插件,在群中发送 `/抽象 文字` 即可") @channel.use( ListenerSchema( listening_events=[GroupMessage], inline_dispatchers=[ Twilight([ FullMatch("/抽象 "), RegexMatch(r".*").help("要转抽象的内容") @ "content" ]) ], decorators=[ FrequencyLimit.require("abstract_message_transformer", 1), Function.require(channel.module), BlackListControl.enable(), UserCalledCountControl.add(UserCalledCountControl.FUNCTIONS) ] ) ) async def abstract_message_transformer(app: Ariadne, message: MessageChain, group: Group, content: RegexResult): result = "" content = content.result.asDisplay() length = len(content)
saya = Saya.current() channel = Channel.current() channel.name("CPGenerator") channel.author("SAGIRI-kawaii") channel.description("生成CP文的插件,在群中发送 `/cp {攻名字} {受名字}`") with open(f"{os.getcwd()}/statics/cp_data.json", "r", encoding="utf-8") as r: cp_data = json.loads(r.read()) @channel.use( ListenerSchema(listening_events=[GroupMessage], inline_dispatchers=[ Twilight([ FullMatch("/cp"), RegexMatch(r"[^\s]+") @ "attack", RegexMatch(r"[^\s]+") @ "defence" ]) ], decorators=[ FrequencyLimit.require("cp_generator", 1), Function.require(channel.module), BlackListControl.enable(), UserCalledCountControl.add( UserCalledCountControl.FUNCTIONS) ])) async def cp_generator(app: Ariadne, message: MessageChain, group: Group, attack: RegexResult, defence: RegexResult): attack = attack.result.asDisplay() defence = defence.result.asDisplay()
saya = Saya.current() channel = Channel.current() channel.name("WolframAlpha") channel.author("SAGIRI-kawaii") channel.description("一个接入WolframAlpha的插件,在群中发送 `/solve {content}` 即可") api_key = AppCore.get_core_instance().get_config().functions.get( "wolfram_alpha_key", None) @channel.use( ListenerSchema( listening_events=[GroupMessage], inline_dispatchers=[ Twilight([FullMatch("/solve"), RegexMatch(".+") @ "content"]) ], decorators=[ FrequencyLimit.require("wolfram_alpha", 4), Function.require(channel.module), BlackListControl.enable(), UserCalledCountControl.add(UserCalledCountControl.FUNCTIONS) ])) async def wolfram_alpha(app: Ariadne, message: MessageChain, group: Group, content: RegexResult): question = content.result.asDisplay() if not api_key or api_key == "wolfram_alpha_key": return MessageItem( MessageChain.create([Plain(text="尚未配置wolfram_alpha_key!")]), QuoteSource())
from sagiri_bot.control import FrequencyLimit, Function, BlackListControl, UserCalledCountControl saya = Saya.current() channel = Channel.current() channel.name("XsList") channel.author("SAGIRI-kawaii") channel.description("一个简查老师的插件,发送 `/查老师 {作品名/老师名/图片}` 即可") @channel.use( ListenerSchema( listening_events=[GroupMessage], inline_dispatchers=[ Twilight([ FullMatch("/查老师"), RegexMatch(r"[\s]+", optional=True), ElementMatch(Image, optional=True) @ "image", WildcardMatch(optional=True) @ "keyword" ]) ], decorators=[ FrequencyLimit.require("xslist", 3), Function.require(channel.module), BlackListControl.enable(), UserCalledCountControl.add(UserCalledCountControl.FUNCTIONS) ] ) ) async def xslist_handler(app: Ariadne, group: Group, keyword: RegexResult, image: ElementResult): if image.matched: await app.sendGroupMessage(group, await search(data_bytes=await image.result.get_bytes()))
channel.name("Joke") channel.author("SAGIRI-kawaii") channel.description("一个生成笑话的插件,在群中发送 `来点{keyword|法国|苏联|美国}笑话`") joke_non_replace = { "法国": french_jokes, "美国": america_jokes, "苏联": soviet_jokes } @channel.use( ListenerSchema(listening_events=[GroupMessage], inline_dispatchers=[ Twilight([ FullMatch("来点"), RegexMatch(r"[^\s]+") @ "keyword", FullMatch("笑话") ]) ], decorators=[ FrequencyLimit.require("joke", 1), Function.require(channel.module), BlackListControl.enable(), UserCalledCountControl.add( UserCalledCountControl.FUNCTIONS) ])) async def joke(app: Ariadne, group: Group, keyword: RegexResult): keyword = keyword.result.asDisplay() if keyword in joke_non_replace.keys(): await app.sendGroupMessage(
from graia.ariadne.message.parser.twilight import Twilight from graia.ariadne.message.parser.twilight import FullMatch from graia.ariadne.event.message import Group, GroupMessage from graia.saya.builtins.broadcast.schema import ListenerSchema from statics.pero_dog_contents import pero_dog_contents from sagiri_bot.control import FrequencyLimit, Function, BlackListControl, UserCalledCountControl saya = Saya.current() channel = Channel.current() channel.name("PeroDog") channel.author("SAGIRI-kawaii") channel.description("一个获取舔狗日记的插件,在群中发送 `舔` 即可") @channel.use( ListenerSchema( listening_events=[GroupMessage], inline_dispatchers=[Twilight([FullMatch("舔")])], decorators=[ FrequencyLimit.require("pero_dog", 1), Function.require(channel.module), BlackListControl.enable(), UserCalledCountControl.add(UserCalledCountControl.FUNCTIONS) ] ) ) async def pero_dog(app: Ariadne, group: Group): await app.sendGroupMessage(group, MessageChain(random.choice(pero_dog_contents).replace('*', '')))
DAILY_RANK_LIMITER = DailyNumberLimiter(DAILY_RANK_LIMIT) limit_text = { "download": "今天已经达到每日下载上限啦~\n明天再来吧~\n❤你❤这❤个❤小❤色❤批❤~", "search": "今天已经达到每日搜索上限啦~\n明天再来吧~\n想找本子的话,自己去下载个哔咔好咯~", "random": "今天已经达到每日随机本子上限啦~\n明天再来吧~\n你这个人对本子真是挑剔呢~", "rank": "今天已经达到每日排行榜查询上限啦~\n明天再来吧~\n排行榜一次还看不够嘛~" } @channel.use( ListenerSchema( listening_events=[GroupMessage], inline_dispatchers=[ Twilight([ FullMatch("pica"), UnionMatch("download", "search", "random", "rank", "init") @ "operation", ArgumentMatch("-forward", action="store_true", optional=True) @ "forward_type", ArgumentMatch("-message", action="store_true", optional=True) @ "message_type", UnionMatch("-H24", "-D7", "-D30", optional=True) @ "rank_time", RegexMatch(r".+", optional=True) @ "content" ]) ], decorators=[ FrequencyLimit.require("pica_function", 3), Function.require(channel.module), BlackListControl.enable(), UserCalledCountControl.add(UserCalledCountControl.FUNCTIONS)
config = core.get_config() user_data = config.functions["tencent"] cred = credential.Credential(user_data["secret_id"], user_data["secret_key"]) http_profile = HttpProfile() http_profile.endpoint = "tts.tencentcloudapi.com" client_profile = ClientProfile() client_profile.httpProfile = http_profile @channel.use( ListenerSchema( listening_events=[GroupMessage], inline_dispatchers=[ Twilight([ FullMatch("说").space(SpacePolicy.FORCE), ArgumentMatch("-v", "--voice", type=int, optional=True) @ "voice_type", WildcardMatch().flags(re.DOTALL) @ "content" ]) ], decorators=[ FrequencyLimit.require("speak", 2), Function.require(channel.module), BlackListControl.enable(), UserCalledCountControl.add(UserCalledCountControl.FUNCTIONS) ])) async def speak(app: Ariadne, message: MessageChain, group: Group, voice_type: ArgResult, content: RegexResult): text = content.result.asDisplay() voice_type = voice_type.result if voice_type.matched else await group_setting.get_setting(
channel.description( "一个生成假聊天记录插件,\n" "在群中发送 " "`我(有一?个)?朋友(想问问|说|让我问问|想问|让我问|想知道|让我帮他问问|让我帮他问|让我帮忙问|让我帮忙问问|问) [-dark] [@target] 内容` " "即可 [@目标]") core = AppCore.get_core_instance() config = core.get_config() @channel.use( ListenerSchema( listening_events=[GroupMessage], inline_dispatchers=[ Twilight([ FullMatch("我"), RegexMatch(r"有一?个", optional=True), FullMatch("朋友"), RegexMatch( r"(想问问|说|让我问问|想问|让我问|想知道|让我帮他问问|让我帮他问|让我帮忙问|让我帮忙问问|问)"), FullMatch(" ", optional=True), FullMatch("-dark", optional=True) @ "dark", ElementMatch(At, optional=True) @ "target", RegexMatch(".+", optional=True) @ "content" ]) ], decorators=[ FrequencyLimit.require("i_have_a_friend", 2), Function.require(channel.module), BlackListControl.enable(), UserCalledCountControl.add(UserCalledCountControl.FUNCTIONS)
from sagiri_bot.control import FrequencyLimit, Function, BlackListControl, UserCalledCountControl saya = Saya.current() channel = Channel.current() channel.name("GithubInfo") channel.author("SAGIRI-kawaii") channel.description("可以搜索Github项目信息的插件,在群中发送 `/github [-i] {项目名}`") @channel.use( ListenerSchema( listening_events=[GroupMessage], inline_dispatchers=[ Twilight([ FullMatch("/github"), ArgumentMatch("-i", "-image", action="store_true", optional=True) @ "image", RegexMatch(r"[^\s]+") @ "keyword" ]) ], decorators=[ FrequencyLimit.require("github_info", 2), Function.require(channel.module), BlackListControl.enable(), UserCalledCountControl.add(UserCalledCountControl.FUNCTIONS) ] ) ) async def github_info(app: Ariadne, message: MessageChain, group: Group, image: ArgResult, keyword: RegexResult): image = image.matched keyword = keyword.result.asDisplay()
channel.name("EmojiMix") channel.author("SAGIRI-kawaii") channel.author("from: MeetWq") channel.description("一个生成emoji融合图的插件,发送 '{emoji1}+{emoji2}' 即可") EmojiData = Tuple[List[int], str, str] API = 'https://www.gstatic.com/android/keyboard/emojikitchen/' proxy = AppCore.get_core_instance().get_config().proxy @channel.use( ListenerSchema(listening_events=[GroupMessage], inline_dispatchers=[ Twilight([ RegexMatch(u"[\u200d-\U0001fab5]") @ "emoji1", FullMatch("+"), RegexMatch(u"[\u200d-\U0001fab5]") @ "emoji2" ]) ], decorators=[ FrequencyLimit.require("emoji_mix", 2), Function.require(channel.module), BlackListControl.enable(), UserCalledCountControl.add( UserCalledCountControl.FUNCTIONS) ])) async def emoji_mix(app: Ariadne, message: MessageChain, group: Group, emoji1: RegexResult, emoji2: RegexResult): emoji1 = emoji1.result.asDisplay() emoji2 = emoji2.result.asDisplay() result = await mix_emoji(emoji1, emoji2)