Ejemplo n.º 1
0
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):
    if result := await SuperResolution.handle(app, message, group, member,
                                              image, resize):
        await MessageSender(result.strategy).send(app, result.message, message,
                                                  group, member)


class SuperResolution(AbstractHandler):
Ejemplo n.º 2
0
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([
            Image(data_bytes=TextEngine([GraiaAdapter(msg_to_merge.result)],
                                        min_width=1080).draw())
        ]),
        quote=message.getFirst(Source))
Ejemplo n.º 3
0
    "在群中发送 `{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()
    if check_resource_exists(resource_name):
        await get_resource_list()
        await app.sendGroupMessage(group, MessageChain("正在生成位置...."))
        await app.sendGroupMessage(group,
                                   await query_resource(resource_name),
                                   quote=message.getFirst(Source))
    else:
Ejemplo n.º 4
0
core = AppCore.get_core_instance()
config = core.get_config()
proxy = config.proxy if config.proxy != "proxy" else ''


@channel.use(
    ListenerSchema(listening_events=[GroupMessage],
                   inline_dispatchers=[
                       Twilight([
                           FullMatch("pdf").space(SpacePolicy.FORCE),
                           RegexMatch(r".+") @ "keyword"
                       ])
                   ],
                   decorators=[
                       FrequencyLimit.require("pdf_searcher", 4),
                       Function.require(channel.module),
                       BlackListControl.enable(),
                       UserCalledCountControl.add(
                           UserCalledCountControl.SEARCH)
                   ]))
async def pdf_searcher(app: Ariadne, message: MessageChain, group: Group,
                       keyword: RegexResult):
    base_url = "https://zh.sg1lib.org"
    keyword = keyword.result.asDisplay().strip()
    url = f"{base_url}/s/?q={keyword}"
    async with aiohttp.ClientSession(connector=TCPConnector(
            verify_ssl=False)) as session:
        async with session.get(url=url, proxy=proxy) as resp:
            html = await resp.read()
    soup = BeautifulSoup(html, "html.parser")
Ejemplo n.º 5
0
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())
    url = f"https://api.wolframalpha.com/v1/simple?i={question.replace('+', '%2B')}&appid={api_key}"
    async with get_running(Adapter).session.get(url=url) as resp:
        if resp.status == 200:
            res = await resp.read()
Ejemplo n.º 6
0
    "美国": 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(
            group, MessageChain(random.choice(joke_non_replace[keyword])))
    else:
        await app.sendGroupMessage(
            group,
            MessageChain(random.choice(jokes).replace("%name%", keyword)))
Ejemplo n.º 7
0
            Twilight([
                ElementMatch(At, optional=True),
                RegexMatch(r"/?色卡"),
                ArgumentMatch("-h", "-help", optional=True, action="store_true") @ "help",
                RegexMatch(r"-(s|size)=[0-9]+", optional=True) @ "size",
                RegexMatch(r"-(m|mode)=\w+", optional=True) @ "mode",
                RegexMatch(r"-(t|text)", optional=True) @ "text",
                RegexMatch(r"[\n\r]?", optional=True),
                ElementMatch(Image, optional=True) @ "image",
                ElementMatch(At, optional=True) @ "at",
                RegexMatch(r"[1-9][0-9]+", optional=True) @ "qq",
                RegexMatch(r"[\n\r]?", optional=True)
            ])
        ],
        decorators=[
            FrequencyLimit.require("color_card", 3),
            Function.require(channel.module),
            BlackListControl.enable(),
            UserCalledCountControl.add(UserCalledCountControl.FUNCTIONS)
        ]
    )
)
async def color_card(
    app: Ariadne,
    group: Group,
    member: Member,
    message: MessageChain,
    help: RegexResult,
    size: RegexResult,
    mode: RegexResult,
    text: RegexResult,
@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,
                                      something: RegexResult,
                                      other_word: RegexResult):
    somebody = somebody.result.asDisplay()
    something = something.result.asDisplay()
    other_word = other_word.result.asDisplay()
    content = f"{somebody}{something}是怎么回事呢?" \
              f"{somebody}相信大家都很熟悉,但是{somebody}{something}是怎么回事呢,下面就让小编带大家一起了解下吧。\n" \
              f"{somebody}{something},其实就是{somebody}{other_word},大家可能会很惊讶{somebody}怎么会{something}呢?" \
              f"但事实就是这样,小编也感到非常惊讶。\n" \
Ejemplo n.º 9
0
config = AppCore.get_core_instance().get_config()


@channel.use(
    ListenerSchema(
        listening_events=[GroupMessage],
        inline_dispatchers=[
            Twilight(
                [
                    ElementMatch(At) @ "at",
                    WildcardMatch()
                ]
            )
        ],
        decorators=[
            FrequencyLimit.require("chat_reply", 2),
            Function.require(channel.module),
            BlackListControl.enable(),
            UserCalledCountControl.add(UserCalledCountControl.AT)
        ]
    )
)
async def chat_reply(
        app: Ariadne,
        message: MessageChain,
        group: Group,
        member: Member,
        at: ElementResult
):
    assert isinstance(at.result, At)
    if at.result.target == config.bot_qq:
Ejemplo n.º 10
0
            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),
            BlackListControl.enable(),
            UserCalledCountControl.add(UserCalledCountControl.SEARCH)
        ]))
async def aminer(app: Ariadne, group: Group, message: MessageChain,
                 person: ArgResult, article: ArgResult, patent: ArgResult,
                 keyword: RegexResult):
    if person.matched:
        router = "person"
    elif article.matched:
        router = "publication"
    elif patent.matched:
        router = "patent"
    else:
        router = "person"
Ejemplo n.º 11
0
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 sagiri_bot.control import FrequencyLimit, Function, BlackListControl, UserCalledCountControl

saya = Saya.current()
channel = Channel.current()

channel.name("KugimiyaVoice")
channel.author("SAGIRI-kawaii")
channel.description("一个钉宫语音包插件,发送 `来点钉宫` 即可")


@channel.use(
    ListenerSchema(
        listening_events=[GroupMessage],
        inline_dispatchers=[Twilight([FullMatch("来点钉宫")])],
        decorators=[
            FrequencyLimit.require("kugimiya_voice", 1),
            Function.require(channel.module),
            BlackListControl.enable(),
            UserCalledCountControl.add(UserCalledCountControl.FUNCTIONS)
        ]
    )
)
async def kugimiya_voice(app: Ariadne, group: Group):
    base_path = f"{os.getcwd()}/statics/voice/kugimiya/"
    path = base_path + random.sample(os.listdir(base_path), 1)[0]
    await app.sendGroupMessage(group, MessageChain([Voice(data_bytes=await silkcoder.async_encode(path))]))
Ejemplo n.º 12
0
from sagiri_bot.control import FrequencyLimit, Function, BlackListControl, UserCalledCountControl

saya = Saya.current()
channel = Channel.current()

channel.name("PoisonousChickenSoup")
channel.author("SAGIRI-kawaii")
channel.description("一个获取毒鸡汤的插件,在群中发送 `[鸡汤|毒鸡汤|来碗鸡汤]` 即可")

core = AppCore.get_core_instance()
config = core.get_config()


@channel.use(
    ListenerSchema(
        listening_events=[GroupMessage],
        inline_dispatchers=[Twilight([RegexMatch(r"(鸡汤|毒鸡汤|来碗鸡汤)$")])],
        decorators=[
            FrequencyLimit.require("poisonous_chicken_soup", 1),
            Function.require(channel.module),
            BlackListControl.enable(),
            UserCalledCountControl.add(UserCalledCountControl.FUNCTIONS)
        ]
    )
)
async def poisonous_chicken_soup(app: Ariadne, group: Group):
    url = f"https://api.shadiao.app/du"
    async with get_running(Adapter).session.get(url=url) as resp:
        text = (await resp.json())["data"].get("text", "未找到数据")
    await app.sendGroupMessage(group, MessageChain(text))
Ejemplo n.º 13
0
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)]),
        quote=message.getFirst(Source)
    )
Ejemplo n.º 14
0
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):
        await app.sendGroupMessage(group,
                                   MessageChain("网络编译器功能关闭了呐~去联系管理员开启吧~"))
        return
    language = language.result.asDisplay()
    code = code.result.asDisplay()
    result = await get_result(language, code)
    if isinstance(result, str):
        listening_events=[GroupMessage],
        inline_dispatchers=[
            Twilight(
                [
                    UnionMatch("我的", "本群") @ "scope",
                    UnionMatch("年内", "月内", "日内", "今日", "本月", "本年", "年度", "月度") @ "period",
                    UnionMatch("总结", "词云"),
                    RegexMatch(r"[0-9]+", optional=True) @ "topK",
                    RegexMatch(r"[\s]", optional=True),
                    ElementMatch(Image, optional=True) @ "mask",
                    RegexMatch(r"[\s]", optional=True)
                ]
            )
        ],
        decorators=[
            FrequencyLimit.require(channel.meta["name"], 2),
            Function.require(channel.module),
            BlackListControl.enable(),
            UserCalledCountControl.add(UserCalledCountControl.FUNCTIONS),
        ],
    )
)
async def group_wordcloud_generator(
    app: Ariadne,
    message: MessageChain,
    group: Group,
    member: Member,
    scope: MatchResult,
    period: MatchResult,
    topK: MatchResult,
    mask: ElementResult
Ejemplo n.º 16
0

@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,
                       colorful: RegexResult, img1: ElementResult,
                       img2: ElementResult):
    async with get_running(Adapter).session.get(url=img1.result.url) as resp:
        display_img = PIL.Image.open(BytesIO(await resp.read()))
    async with get_running(Adapter).session.get(url=img2.result.url) as resp:
        hide_img = PIL.Image.open(BytesIO(await resp.read()))
    if colorful.matched:
        msg = MessageChain([
            Image(data_bytes=await PhantomTank.colorful_tank(
Ejemplo n.º 17
0
from sagiri_bot.control import FrequencyLimit, Function, BlackListControl, UserCalledCountControl

saya = Saya.current()
channel = Channel.current()

channel.name("Dice")
channel.author("SAGIRI-kawaii")
channel.description("一个简单的投骰子插件,发送 `{times}d{range}` 即可")


@channel.use(
    ListenerSchema(
        listening_events=[GroupMessage],
        inline_dispatchers=[Twilight([RegexMatch(r"[0-9]+d[0-9]+$")])],
        decorators=[
            FrequencyLimit.require("dice", 1),
            Function.require(channel.module),
            BlackListControl.enable(),
            UserCalledCountControl.add(UserCalledCountControl.FUNCTIONS)
        ]))
async def dice(app: Ariadne, message: MessageChain, group: Group):
    if not await group_setting.get_setting(group.id, Setting.dice):
        await app.sendGroupMessage(group,
                                   MessageChain("骰子功能尚未开启哟~"),
                                   quote=message.getFirst(Source))
        return
    times, max_point = message.asDisplay().strip().split('d')
    times, max_point = int(times), int(max_point)
    if times > 100:
        await app.sendGroupMessage(group,
                                   MessageChain("nmd,太多次了!"),
Ejemplo n.º 18
0
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)
    index = 0
    while index < length:
        if index < length - 1 and (get_pinyin(content[index]) + get_pinyin(content[index + 1])) in emoji:
            result += emoji[get_pinyin(content[index]) + get_pinyin(content[index + 1])]
            index += 1
Ejemplo n.º 19
0
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,
                               MessageChain(
                                   [Image(data_bytes=bytes_io.getvalue())]),
                               quote=message.getFirst(Source))
Ejemplo n.º 20
0
from sagiri_bot.control import FrequencyLimit, Function, BlackListControl, UserCalledCountControl

saya = Saya.current()
channel = Channel.current()

channel.name("Tarot")
channel.author("SAGIRI-kawaii")
channel.description("可以抽塔罗牌的插件,在群中发送 `塔罗牌` 即可")


@channel.use(
    ListenerSchema(listening_events=[GroupMessage],
                   inline_dispatchers=[Twilight([FullMatch("塔罗牌")])],
                   decorators=[
                       FrequencyLimit.require("tarot", 1),
                       Function.require(channel.module),
                       BlackListControl.enable(),
                       UserCalledCountControl.add(
                           UserCalledCountControl.FUNCTIONS)
                   ]))
async def tarot(app: Ariadne, message: MessageChain, group: Group):
    await app.sendGroupMessage(group,
                               Tarot.get_tarot(),
                               quote=message.getFirst(Source))


class Tarot(object):
    @staticmethod
    def get_tarot() -> MessageChain:
        card, filename = Tarot.get_random_tarot()
Ejemplo n.º 21
0
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("今天是周日,所有材料副本都开放了。"),
                                   quote=message.getFirst(Source))
        return
Ejemplo n.º 22
0
                    "在群中发送 `github热搜` 即可查看github热搜")

core = AppCore.get_core_instance()
config = core.get_config()
proxy = config.proxy if config.proxy != "proxy" else ''


@channel.use(
    ListenerSchema(
        listening_events=[GroupMessage],
        inline_dispatchers=[
            Twilight(
                [UnionMatch("微博热搜", "知乎热搜", "github热搜") @ "trending_type"])
        ],
        decorators=[
            FrequencyLimit.require("trending", 1),
            Function.require(channel.module),
            BlackListControl.enable(),
            UserCalledCountControl.add(UserCalledCountControl.FUNCTIONS)
        ]))
async def trending(app: Ariadne, group: Group, trending_type: RegexResult):
    trending_type = trending_type.result.asDisplay()
    if trending_type == "微博热搜":
        await app.sendGroupMessage(group, await Trending.get_weibo_trending())
    elif trending_type == "知乎热搜":
        await app.sendGroupMessage(group, await Trending.get_zhihu_trending())
    elif trending_type == "github热搜":
        await app.sendGroupMessage(group, await Trending.get_github_trending())


class Trending(object):
Ejemplo n.º 23
0
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)
    if isinstance(result, str):
        await app.sendGroupMessage(group,
                                   MessageChain(result),
                                   quote=message.getFirst(Source))
    elif isinstance(result, bytes):