Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: support use Message object as message template #545

Merged
merged 3 commits into from
Oct 2, 2021

Conversation

mnixry
Copy link
Member

@mnixry mnixry commented Oct 2, 2021

demo code (with mirai adapter):

from nonebot.adapters.mirai import MessageEvent, Bot, MessageChain, MessageSegment
from nonebot.plugin import on_message

handler = on_message()


@handler.handle()
async def _(bot: Bot, event: MessageEvent, state: dict):
    await handler.send(MessageChain.template(
        MessageSegment.plain('test {event.source}') + MessageSegment.face(233) +
        MessageSegment.plain('test {event.message_chain}')).format(event=event),
                       at_sender=True)

@mnixry mnixry added the enhancement New feature or request label Oct 2, 2021
@mnixry mnixry requested a review from yanyongyu October 2, 2021 05:59
@mnixry mnixry self-assigned this Oct 2, 2021
@github-actions github-actions bot temporarily deployed to commit October 2, 2021 05:59 Inactive
@mnixry mnixry force-pushed the feature/message-as-template branch from e9efa98 to 5d72a34 Compare October 2, 2021 06:01
@github-actions
Copy link
Contributor

github-actions bot commented Oct 2, 2021

🚀 Deployed on https://deploy-preview-545--nonebot2.netlify.app

@github-actions github-actions bot temporarily deployed to commit October 2, 2021 06:03 Inactive
@github-actions github-actions bot temporarily deployed to commit October 2, 2021 06:03 Inactive
@github-actions github-actions bot temporarily deployed to commit October 2, 2021 06:04 Inactive
@mnixry mnixry force-pushed the feature/message-as-template branch from c806009 to 5cff808 Compare October 2, 2021 06:06
@github-actions github-actions bot temporarily deployed to commit October 2, 2021 06:08 Inactive
@github-actions github-actions bot temporarily deployed to commit October 2, 2021 06:09 Inactive
@mnixry mnixry merged commit 4a7c07a into dev Oct 2, 2021
@mnixry mnixry deleted the feature/message-as-template branch October 2, 2021 06:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

Successfully merging this pull request may close these issues.

2 participants