Skip to content

Commit

Permalink
🐛 version 0.47.1
Browse files Browse the repository at this point in the history
fix uniseg warning about satori
  • Loading branch information
RF-Tar-Railt committed Jun 19, 2024
1 parent b08b40c commit 311a06f
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/nonebot_plugin_alconna/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
from .uniseg import SupportAdapterModule as SupportAdapterModule
from .extension import add_global_extension as add_global_extension

__version__ = "0.47.0"
__version__ = "0.47.1"

__plugin_meta__ = PluginMetadata(
name="Alconna 插件",
Expand Down
2 changes: 1 addition & 1 deletion src/nonebot_plugin_alconna/builtins/extensions/reply.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,4 @@ async def message_provider(self, event, state, bot, use_origin: bool = False):
return uni_msg


__extension__ = ReplyRecordExtension
__extension__ = ReplyMergeExtension
2 changes: 1 addition & 1 deletion src/nonebot_plugin_alconna/uniseg/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
from .constraint import SupportAdapterModule as SupportAdapterModule
from .adapters import BUILDER_MAPPING, FETCHER_MAPPING, EXPORTER_MAPPING

__version__ = "0.47.0"
__version__ = "0.47.1"

__plugin_meta__ = PluginMetadata(
name="Universal Segment 插件",
Expand Down
25 changes: 13 additions & 12 deletions src/nonebot_plugin_alconna/uniseg/adapters/satori/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,33 +22,34 @@ def __init__(self):
if tuple(map(int, version.split(".")[:2])) < (0, 12):
raise ImportError("nonebot-adapter-satori>=0.12 is required.")

def get_adapter(self) -> SupportAdapter:
return SupportAdapter.satori

def get_builder(self):
from nonebot.adapters.satori.message import Custom
from nonebot.adapters.satori import Message, MessageSegment

from .builder import SatoriMessageBuilder

@custom_register(Emoji, "chronocat:face")
def fbuild(builder: MessageBuilder, seg: BaseMessageSegment):
if not isinstance(seg, Custom):
raise ValueError("Emoji can only be built from Satori Message")
return Emoji(seg.data["id"], seg.data.get("name"))(*builder.generate(seg.children))

return SatoriMessageBuilder()

def get_exporter(self):
from nonebot.adapters.satori import Message, MessageSegment

from .exporter import SatoriMessageExporter

@custom_handler(Emoji)
async def fexport(exporter: MessageExporter, seg: Emoji, bot, fallback):
if exporter.get_message_type() is Message:
return MessageSegment("chronocat:face", seg.data)(
await exporter.export(seg.children, bot, fallback) # type: ignore
)

def get_adapter(self) -> SupportAdapter:
return SupportAdapter.satori

def get_builder(self):
from .builder import SatoriMessageBuilder

return SatoriMessageBuilder()

def get_exporter(self):
from .exporter import SatoriMessageExporter

return SatoriMessageExporter()

def get_fetcher(self):
Expand Down

0 comments on commit 311a06f

Please sign in to comment.