Files
LangBot/plugins/misc/EssentialCommands/components/commands/reset.py

31 lines
932 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 Reset(Command):
async def initialize(self):
await super().initialize()
@self.subcommand(
name="",
help="Reset the plugin",
usage="reset",
)
async def _(self: Reset, context: ExecuteContext) -> AsyncGenerator[CommandReturn, None]:
await context.create_new_conversation()
language = self.plugin.get_language()
yield CommandReturn(
text=get_text(language, "reset.success")
)