Skip to content

BotConnection

Nill edited this page Sep 10, 2021 · 2 revisions

The BotConnection class manages the transport component of the Bot and is created at the same time as the Bot.

Properties

Property Type Description
ApiBaseUrl string Gets or sets the base URL used for the REST API methods. If null, TelegramSettings.ApiBase is used.
Bot Bot Reference to the Bot to which this connection is associated.
Health BotHealth Gets the health of the bot's connection based on success or failure or recent methods or polling
HttpOptions HttpClientHandler Gets the HttpClientHandler used to control the HTTP options for this connection's requests
LastPolledUpdate long The ID of the last update successfully polled (and acknowledged), if one was tracked.
Poller BotPoller Gets a reference to the associated when the Bot is using polling. This value is set to when the Bot is not polling.
RecvdBytes long Gets the number of bytes received from Telegram (excluding HTTP headers) since this instance of the bot was created
RecvdUpdates long Gets the number of updates processed since this instance of the bot was created
SentBytes long Gets the number of bytes sent to Telegram (excluding HTTP headers) since this instance of the bot was created
SentMessages long Gets the number of method calls/messages sent to Telegram since this instance of the bot was created
Status BotStatus Gets the status of the bot's ability to receive updates from Telegram

Methods

Name Arguments Return Type Description
StartPolling None Task Starts polling
StopPolling None void Cancels polling
Method<TResponse> Action<dynamic> configureData,
string methodName,
string verb = "POST",
bool throwOnError = true,
SendFile file = null,
int? timeout = null
TResponse Invokes an API call using a dynamic object to build the request body's data tree
Method<TResponse> string methodName,
string data = null,
string verb = "GET",
bool throwOnError = true,
SendFile file = null,
int? timeout = null
TResponse Invokes an API call using raw JSON data
MethodAdvanced<TResponse> string methodName,
string data = null,
string verb = "GET",
bool throwOnError = false,
SendFile file = null,
int? timeout = null
TelegramResponse<TResponse> Invokes an API call and preserves the response wrapper, which may contain error messages or other info.

Clone this wiki locally