Options
All
  • Public
  • Public/Protected
  • All
Menu

Class MenuCommand

Class of menu command. You should initialize with params: code, trigger, help, apps(array of AppCommand).

export
param
param
param
template

extends BaseData

Hierarchy

  • MenuCommand

Implements

  • BaseCommand

Index

Constructors

constructor

Properties

client

client: undefined | KBotify

此命令绑定的bot实例

code

code: string = 'code'

commandMap

commandMap: Map<string, AppCommand> = ...

help

help: string = 'help'

帮助文字。当发送(菜单触发文字) 帮助时返回的提示。

menu

menu: string | CardObject[] = ...

菜单文字。如果设置useCardMenu=true,此处应为json样式的字符串。

Abstract trigger

trigger: string

Readonly type

type: MENU = ...

useCardMenu

useCardMenu: boolean = true

是否使用cardmessage作为菜单,默认为否。如果为是,则菜单文字内容必须为cardmessage。

useTempMenu

useTempMenu: boolean = true

Methods

addAlias

  • addAlias(app: AppCommand, ...aliases: string[]): void
  • Add alias for a certain app to this menu. 与初始化菜单时添加App不同,不会添加App的触发文字到菜单内,只添加作为参数输入的Alias。 Note that this will NOT add trigger to menu. menu.addCommand(app, alias1, alias2, ...)

    memberof

    MenuCommand

    Parameters

    • app: AppCommand

      instance of AppCommand

    • Rest ...aliases: string[]

    Returns void

exec

  • If you want to have something done before executing app command, please overwrite this. 默认情况下直接调用菜单的func功能。

    memberof

    MenuCommand

    Parameters

    Returns Promise<void | ResultTypes>

func

  • 菜单的主体功能。

    • 如果参数为空,返回菜单。
    • 如果第一个参数为帮助,返回帮助。
    • 如果未找到对应命令,返回如何触发菜单的提示。
    • 如果找到对应命令,则调用。
    memberof

    MenuCommand

    Parameters

    Returns Promise<void | ResultTypes>

    {(Promise<ResultTypes | void>)}

init

Generated using TypeDoc