mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-10-30 20:35:22 +08:00
31 lines
980 B
Python
31 lines
980 B
Python
# Auto generated by LangBot Plugin SDK.
|
|
# Please refer to https://langbot.app/docs/en/plugin/dev/tutor.html for more details.
|
|
from __future__ import annotations
|
|
|
|
from typing import Any, AsyncGenerator
|
|
|
|
from langbot_plugin.api.definition.components.command.command import Command, Subcommand
|
|
from langbot_plugin.api.entities.builtin.command.context import ExecuteContext, CommandReturn
|
|
|
|
from i18n import get_text
|
|
|
|
|
|
class Version(Command):
|
|
|
|
async def initialize(self):
|
|
await super().initialize()
|
|
|
|
@self.subcommand(
|
|
name="",
|
|
help="Show the version of the plugin",
|
|
usage="version",
|
|
)
|
|
async def _(self: Version, context: ExecuteContext) -> AsyncGenerator[CommandReturn, None]:
|
|
|
|
version = await self.plugin.get_langbot_version()
|
|
language = self.plugin.get_language()
|
|
|
|
yield CommandReturn(
|
|
text=get_text(language, "version.output", version=version)
|
|
)
|