Class BotContext

Hierarchy

Constructors

Properties

#member: any
_client: Evogram
_source: IUser & {
    chat_id?: string | number;
}

Accessors

  • get appeal(): string
  • Returns the user's appeal, which is either their username or full name.

    Returns string

  • get isPremium(): undefined | true
  • Returns whether the user is a premium user.

    Returns undefined | true

  • get language(): undefined | {
        code: string;
        country: undefined | string;
    }
  • Returns the user's language code and country.

    Returns undefined | {
        code: string;
        country: undefined | string;
    }

Methods

  • Deletes the bot's commands.

    Parameters

    Returns Promise<true>

    A Promise that resolves to true if the operation succeeded.

  • Sets the bot's menu button for a chat.

    Parameters

    Returns Promise<true>

    A Promise that resolves to true if the operation succeeded.

  • Sets the bot's commands.

    Parameters

    • commands: IBotCommand[]

      An array of IBotCommand objects representing the new list of the bot's commands.

    • Optional params: Partial<ISetMyCommandsParams>

      Optional parameters to customize the behavior of the method.

    Returns Promise<true>

    A Promise that resolves to true if the operation succeeded.

  • Sets the bot's commands.

    Parameters

    Returns Promise<true>

    A Promise that resolves to true if the operation succeeded.

  • Converts the source object to a context object of a given type.

    Example

    client.updates.on("message", message => {
    const user = message.user.toContext<CustomUserContext>();
    // Now user works correctly with your context
    })

    Type Parameters

    • TContext extends object

      Generic type parameter for the context object.

    Returns TContext

    The context object.

Generated using TypeDoc