Skip to content

GramIO API Reference / @gramio/contexts/dist / SubscriptionContext

Class: SubscriptionContext<Bot>

Defined in: contexts/index.d.ts:7274

This object contains information about changes to a user payment subscription toward the current bot.

Extends

Type Parameters

Type Parameter
Bot extends BotLike

Constructors

Constructor

new SubscriptionContext<Bot>(options): SubscriptionContext<Bot>

Defined in: contexts/index.d.ts:7277

Parameters

ParameterType
optionsSubscriptionContextOptions<Bot>

Returns

SubscriptionContext<Bot>

Overrides

Context.constructor


Constructor

new SubscriptionContext(...args): SubscriptionContext

Defined in: contexts/index.d.ts:7274

Parameters

ParameterType
...argsany[]

Returns

SubscriptionContext

Overrides

Context<Bot>.constructor

Properties

PropertyModifierTypeDescriptionInherited fromDefined in
botpublicBot-Context.botcontexts/index.d.ts:5240
payloadpublicTelegramBotSubscriptionUpdatedThe raw data that is used for this ContextCloneMixin.payloadcontexts/index.d.ts:7276
update?publicTelegramUpdate-Context.updatecontexts/index.d.ts:5242
updateId?publicnumber-Context.updateIdcontexts/index.d.ts:5241
updateTypeprotectedUpdateName-Context.updateTypecontexts/index.d.ts:5243

Accessors

[toStringTag]

Get Signature

get [toStringTag](): string

Defined in: contexts/index.d.ts:5246

MDN

Returns

string

Inherited from

Context.[toStringTag]


invoicePayload

Get Signature

get invoicePayload(): string

Defined in: contexts/index.d.ts:7281

Bot-specified invoice payload

Returns

string


isActive

Get Signature

get isActive(): boolean

Defined in: contexts/index.d.ts:7292

Whether the subscription is active (re-enabled after a previous cancellation)

Returns

boolean


isCanceled

Get Signature

get isCanceled(): boolean

Defined in: contexts/index.d.ts:7290

Whether the subscription was canceled by the user

Returns

boolean


isFailed

Get Signature

get isFailed(): boolean

Defined in: contexts/index.d.ts:7294

Whether payment for the subscription failed

Returns

boolean


state

Get Signature

get state(): TelegramBotSubscriptionUpdatedState

Defined in: contexts/index.d.ts:7288

The new state of the subscription. Currently, it can be one of canceled if the user canceled the subscription, active if the user re-enabled a previously canceled subscription, or failed if payment for the subscription failed.

Returns

TelegramBotSubscriptionUpdatedState


user

Get Signature

get user(): User

Defined in: contexts/index.d.ts:7279

User who subscribed for payments toward the bot

Returns

User

Methods

clone()

clone(options?): SubscriptionContext

Defined in: contexts/index.d.ts:5934

Parameters

ParameterType
options?SubscriptionContextOptions

Returns

SubscriptionContext

Inherited from

CloneMixin.clone


is()

is<T>(rawTypes): this is InstanceType<ContextsMapping<Bot>[T]> & GetDerives<Bot, T> & (IsAny<Bot["__Derives"]> extends true ? {} : Bot["__Derives"] extends {} ? Bot["__Derives"]["global"] & Bot["__Derives"][T] : {})

Defined in: contexts/index.d.ts:5249

Type Parameters

Type Parameter
T extends UpdateName

Parameters

ParameterType
rawTypesMaybeArray<SoftString<T>>

Returns

this is InstanceType<ContextsMapping<Bot>[T]> & GetDerives<Bot, T> & (IsAny<Bot["__Derives"]> extends true ? {} : Bot["__Derives"] extends {} ? Bot["__Derives"]["global"] & Bot["__Derives"][T] : {})

Inherited from

Context.is