Class ChatContext

Hierarchy

Constructors

Properties

#detailedChat: any
_client: Evogram
_source: IChat

Accessors

  • get title(): string
  • The title of the chat, or its username, or the concatenation of its first_name and last_name.

    Returns string

  • get type(): "channel" | "private" | "group" | "supergroup"
  • The type of the chat.

    Returns "channel" | "private" | "group" | "supergroup"

Methods

  • Calls the exportChatInviteLink method of the api object to export an invite link for the chat.

    Returns Promise<string>

    A Promise that resolves to the invite link.

  • Calls the leaveChat method of the api object to leave the chat.

    Returns Promise<true>

    A Promise that resolves to true if the chat was successfully left.

  • Calls the setChatDescription method of the api object to set the chat description.

    Parameters

    • Optional description: string

      Optional new description of the chat.

    Returns Promise<true>

    A Promise that resolves to true if the description was successfully set.

  • Calls the setChatPhoto method of the api object to set the chat photo.

    Parameters

    • photo: IInputFile

      The photo to set, represented as a URL or Buffer object.

    Returns Promise<true>

    A Promise that resolves to true if the photo was successfully set.

  • Calls the setChatTitle method of the api object to set the chat title.

    Parameters

    • title: string

      The new title of the chat.

    Returns Promise<true>

    A Promise that resolves to true if the title was successfully set.

  • 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