-
Notifications
You must be signed in to change notification settings - Fork 4
Public API overview
Caution
This page was generated using hand-writen compiler's XML-Summaries output parser If you find any missing syntax, errors in structure, mis-formats or empty sections, please contact owner or open an issue
Provides usefull helper methods for abstract handler containers
Methods:
-
React(IAbstractHandlerContainer<Message>, ReactionType, Boolean, CancellationToken)Changes bot's reaction to message
-
React(IAbstractHandlerContainer<Message>, IEnumerable<ReactionType>, Boolean, CancellationToken)Changes bot's reaction to message
-
Reply(IAbstractHandlerContainer<Message>, String, ParseMode, ReplyMarkup, LinkPreviewOptions, Nullable<Int32>, IEnumerable<MessageEntity>, Boolean, Boolean, String, String, Boolean, Nullable<Int32>, SuggestedPostParameters, CancellationToken)Sends a reply message to the current message.
-
Responce(IAbstractHandlerContainer<Message>, String, ParseMode, ReplyParameters, ReplyMarkup, LinkPreviewOptions, Nullable<Int32>, IEnumerable<MessageEntity>, Boolean, Boolean, String, String, Boolean, Nullable<Int32>, SuggestedPostParameters, CancellationToken)Sends a response message to the current chat.
-
Responce(IAbstractHandlerContainer<CallbackQuery>, String, ParseMode, ReplyParameters, ReplyMarkup, LinkPreviewOptions, Nullable<Int32>, IEnumerable<MessageEntity>, Boolean, Boolean, String, String, Boolean, Nullable<Int32>, SuggestedPostParameters, CancellationToken)Responnces to message that this CallbackQuery was originated from
-
EditMessage(IAbstractHandlerContainer<CallbackQuery>, String, ParseMode, InlineKeyboardMarkup, IEnumerable<MessageEntity>, LinkPreviewOptions, CancellationToken)Edits message text that this CallbackQuery was originated from
-
AnswerCallbackQuery(IAbstractHandlerContainer<CallbackQuery>, String, Boolean, String, Int32, CancellationToken)Use this method to send answers to callback queries sent from inline keyboards. The answer will be displayed to the user as a notification at the top of the chat screen or as an alert
-
AnswerInlineQuery(IAbstractHandlerContainer<InlineQuery>, IEnumerable<InlineQueryResult>, Nullable<Int32>, Boolean, String, InlineQueryResultsButton, CancellationToken)Answers inline query
Extensions methods for Awaiter Handler Builders
Methods:
-
ByChatId<TUpdate>(IAwaiterHandlerBuilder<TUpdate>, CancellationToken)Awaits an update using the chat id key resolver and cancellation token.
-
BySenderId<TUpdate>(IAwaiterHandlerBuilder<TUpdate>, CancellationToken)Awaits an update using the sender id key resolver and cancellation token.
Extensions methods for awaiting providers Provides convenient methods for creating awaiter builders.
Methods:
-
CreateAbstract<TUpdate>(IAwaitingProvider, UpdateType, Update)Creates an awaiter handler builder for a specific update type.
-
AwaitAny(IAwaitingProvider, Update)Creates an awaiter builder for any update type.
-
AwaitMessage(IAwaitingProvider, Update)Creates an awaiter builder for message updates.
-
AwaitCallbackQuery(IAwaitingProvider, Update)Creates an awaiter builder for callback query updates.
Flags version of Type of the , from which the message or inline query was sent
Values:
-
Private— Normal one-to-one chat with a user or bot -
Group— Normal group chat -
Channel— A channel -
Supergroup— A supergroup -
Sender— Value possible only in : private chat with the inline query sender
Exception thrown when attempting to modify a frozen collection.
Constructors:
-
CollectionFrozenException()Initializes a new instance of the class.
Provides extension methods for working with collections.
Methods:
-
ToReadOnlyDictionary<TKey, TValue>(IEnumerable<TValue>, Func<TValue, TKey>)Creates a from an according to a specified key selector function.
-
ForEach<TValue>(IEnumerable<TValue>, Action<TValue>)Enumerates objects in a and executes an on each one
-
Set<TKey, TValue>(IDictionary<TKey, TValue>, TKey, TValue)Sets the value of a key in a dictionary, or if the key does not exist, adds it
-
Set<TKey, TValue>(IDictionary<TKey, TValue>, TKey, TValue, TValue)Sets the value of a key in a dictionary, or if the key does not exist, adds its default value.
-
Random<TSource>(IEnumerable<TSource>)Return the random object from
-
Random<TSource>(IEnumerable<TSource>, Random)Return the random object from
-
Union<TSource>(IList<TSource>, IEnumerable<TSource>)Adds a range of elements to collection if they dont already exist using default equality comparer
Enumeration of dice types supported by Telegram. Used for filtering dice messages and determining dice emoji representations.
Values:
-
Dice— Standard dice (🎲). -
Darts— Darts (🎯). -
Bowling— Bowling (🎳). -
Basketball— Basketball (🏀). -
Football— Football (⚽). -
Casino— Casino slot machine (🎰).
Extension methods for handler builders. Provides convenient methods for creating handlers and setting state keepers.
Methods:
-
SetUpdateValidating<TBuilder>(TBuilder, UpdateValidateAction) -
SetConcurreny<TBuilder>(TBuilder, Int32) -
SetPriority<TBuilder>(TBuilder, Int32) -
SetIndexer<TBuilder>(TBuilder, Int32, Int32) -
AddFilter<TBuilder>(TBuilder, IFilter<Update>) -
AddFilters<TBuilder>(TBuilder) -
SetStateKeeper<TBuilder, TKey, TState, TKeeper>(TBuilder, TState, IStateKeyResolver<TKey>) -
SetStateKeeper<TBuilder, TKey, TState, TKeeper>(TBuilder, SpecialState, IStateKeyResolver<TKey>) -
AddTargetedFilter<TBuilder, TFilterTarget>(TBuilder, Func<Update, TFilterTarget>, IFilter<TFilterTarget>)Adds a targeted filter for a specific filter target type.
-
AddTargetedFilters<TBuilder, TFilterTarget>(TBuilder, Func<Update, TFilterTarget>)Adds multiple targeted filters for a specific filter target type.
-
SetNumericState<TBuilder>(TBuilder, Int32, IStateKeyResolver<Int64>)Sets a numeric state keeper with a custom key resolver.
-
SetNumericState<TBuilder>(TBuilder, SpecialState, IStateKeyResolver<Int64>)Sets a numeric state keeper with a special state and custom key resolver.
-
SetNumericState<TBuilder>(TBuilder, Int32)Sets a numeric state keeper with the default sender ID resolver.
-
SetNumericState<TBuilder>(TBuilder, SpecialState)Sets a numeric state keeper with a special state and the default sender ID resolver.
-
SetEnumState<TBuilder, TEnum>(TBuilder, TEnum, IStateKeyResolver<Int64>)Sets an enum state keeper with a custom key resolver.
-
SetEnumState<TBuilder, TEnum>(TBuilder, SpecialState, IStateKeyResolver<Int64>)Sets an enum state keeper with a special state and custom key resolver.
-
SetEnumState<TBuilder, TEnum>(TBuilder, TEnum)Sets an enum state keeper with the default sender ID resolver.
-
SetEnumState<TBuilder, TEnum>(TBuilder, SpecialState)Sets an enum state keeper with a special state and the default sender ID resolver.
Extension methods for handler containers. Provides convenient methods for creating awaiter builders and state keeping.
Methods:
-
AwaitUpdate<TUpdate>(IHandlerContainer, UpdateType)Creates an awaiter builder for a specific update type.
-
AwaitAny(IHandlerContainer)Creates an awaiter builder for any update type.
-
AwaitMessage(IHandlerContainer)Creates an awaiter builder for message updates.
-
AwaitCallbackQuery(IHandlerContainer)Creates an awaiter builder for callback query updates.
-
GetStateKeeper<TKey, TState, TKeeper>(IHandlerContainer)Gets a state keeper instance for the specified types.
Exception thrown when a handler execution fails. Contains information about the handler and the inner exception.
Constructors:
-
HandlerFaultedException(DescribedHandlerInfo, Exception)Initializes a new instance of the class.
Extension methods for handlers collections. Provides convenient methods for creating implicit handlers.
Methods:
-
CollectHandlersDomainWide(IHandlersCollection)Collects all handlers from the current app domain. Scans for types that implement handlers and adds them to the collection.
-
CollectHandlersAssemblyWide(IHandlersCollection)Collects all handlers from the calling this function assembly. Scans for types that implement handlers and adds them to the collection.
-
CreateHandler<TUpdate>(IHandlersCollection, UpdateType)Creates a handler builder for a specific update type.
-
CreateAny(IHandlersCollection)Creates a handler builder for any update type.
-
CreateMessage(IHandlersCollection)Creates a handler builder for message updates.
-
CreateCallbackQuery(IHandlersCollection)Creates a handler builder for callback query updates.
-
AddMethod<TUpdate>(IHandlersCollection, AbstractHandlerAction<TUpdate>)Creates implicit handler from method
Extesions method for handlers providers
Methods:
-
GetBotCommands(IHandlersProvider, CancellationToken)Gets the list of bot commands supported by the provider.
Interface for reactive Telegram bot implementations. Defines the core properties and capabilities of a reactive bot.
Properties:
-
UpdateRouterGets the update router for handling incoming updates.
Provides usefull helper methods for messages
Methods:
-
SubstringEntity(Message, MessageEntity)Substrings entity content from text
-
IsCommand(Message, String)Checkes if sent contains command. Automatically cuts bot name from it
-
SplitArgs(Message)Split message text into arguments, ignoring command instance. Splits by space character
-
TrySplitArgs(Message)Tries to split message text into arguments, ignoring command instance. Splits by space character. Exception-free version of
Exception thrown when a type is not a valid filter type.
Constructors:
-
NotFilterTypeException(Type)Initializes a new instance of the class.
Contains extension method for number types
Methods:
-
HasFlag(Int32, Int32)Check if int value has int flag using bit compare
-
HasFlag<T>(Int32, T)Check if int value has enum flag using bit compare
Provides extension methods for reflection and type inspection.
Methods:
-
IsCustomDescriptorsProvider(Type)Checks if a type implements the interface.
-
IsFilterType(Type)Checks if is a
-
IsHandlerAbstract(Type)Checks if is a descendant of class
-
IsHandlerRealization(Type)Checks if is an implementation of class or its descendants
-
HasParameterlessCtor(Type)Checks if has a parameterless constructor
-
HasPublicProperties(Type)Checks is has public properties
-
IsAssignableToGenericType(Type, Type)Determines whether an instance of a specified type can be assigned to an instance of the current type
Represents handler results, allowing to communicate with router and control aspect execution
Properties:
-
PositiveIs result positive
-
RouteNextShould router search for next matching handler
-
NextTypeExact type that router should search
Methods:
-
Ok()Represents 'success' Inside - let handler's main block be executedInside - tells that he can stop describing, as needed handler was foundInside - let continue describing
-
Fault()Represents 'fault' or 'error'. Use cases: Inside - interupts execution of handler, main block and wont be executedInside - interupts 's describing sequence
-
Next()Represents 'continue'. Use cases: Inside - let continue describingInside - Tells to continue describing handlers
-
Next<T>()Represents 'chain'. Use cases: Inside - Tells to continue describing handlers and execute only handlers of exact type
Provides extension methods for string manipulation.
Methods:
-
SliceBy(String, Int32)Slices a string into a array of substrings of fixed
Implementation of that provides bot information. Contains metadata about the Telegram bot including user details.
Constructors:
-
TelegramBotInfo(User)Implementation of that provides bot information. Contains metadata about the Telegram bot including user details.
Properties:
-
UserGets the user information for the bot.
Main client class for the Telegrator library. Extends TelegramBotClient with reactive capabilities for handling updates.
Constructors:
-
TelegratorClient(String, HttpClient, CancellationToken)Initializes a new instance of the class with a bot token.
-
TelegratorClient(TelegramBotClientOptions, HttpClient, CancellationToken)Initializes a new instance of the class with bot options.
-
TelegratorClient(TelegramBotClientOptions, TelegratorOptions, HttpClient, CancellationToken)Initializes a new instance of the class with bot options and Telegrator options.
Properties:
-
Options -
Handlers -
BotInfo -
UpdateRouter
Methods:
-
StartReceiving(ReceiverOptions, CancellationToken)Starts receiving updates from Telegram. Initializes the update router and begins polling for updates.
Configuration options for Telegram bot behavior and execution settings. Controls various aspects of bot operation including concurrency, routing, and execution policies.
Constructors:
TelegratorOptions()
Properties:
-
MaximumParallelWorkingHandlers -
ExclusiveAwaitingHandlerRouting -
ExceptIntersectingCommandAliases -
GlobalCancellationToken
Provides extension methods for working with Telegram Update objects.
Methods:
-
GetSenderId(Update)Selects from Update an object from which you can get the sender's ID
-
GetChatId(Update)Selects from Update an object from which you can get the chat's ID
-
GetActualUpdateObject(Update)Selects from an object that contains information about the update
-
GetAllowedUpdateTypes(Type)Selecting corresponding s for 's sub-type
-
GetAllowedUpdateTypes<T>()Selecting corresponding s for 's sub-type
-
GetActualUpdateObject<T>(Update)Selects from an that contains information about the update
Provides extension methods for working with UpdateType enums.
Methods:
-
IsUpdateObjectAllowed<T>()Checks if matches one of the 's give on
-
IsValidUpdateObject<TUpdate>(UpdateType)Checks if matches the given
-
ReflectUpdateObject(UpdateType)Returns an update object corresponding to the .
Attribute for filtering messages where a command argument contains the specified content.
Constructors:
-
ArgumentContainsAttribute(String, StringComparison, Int32)Attribute for filtering messages where a command argument contains the specified content.
Attribute for filtering messages where a command argument ends with the specified content.
Constructors:
-
ArgumentEndsWithAttribute(String, StringComparison, Int32)Attribute for filtering messages where a command argument ends with the specified content.
Attribute for filtering messages where a command argument equals the specified content.
Constructors:
-
ArgumentEqualsAttribute(String, StringComparison, Int32)Attribute for filtering messages where a command argument equals the specified content.
Attribute for filtering messages where a command argument matches a regular expression pattern.
Constructors:
-
ArgumentRegexAttribute(String, RegexOptions, TimeSpan, Int32)Attribute for filtering messages where a command argument matches a regular expression pattern.
Attribute for filtering messages where a command argument starts with the specified content.
Constructors:
-
ArgumentStartsWithAttribute(String, StringComparison, Int32)Attribute for filtering messages where a command argument starts with the specified content.
Attribute for filtering 's data
Constructors:
-
CallbackDataAttribute(String)Attribute for filtering 's data
Attribute to check if belongs to a specific message by its ID
Constructors:
-
CallbackInlineIdAttribute(String)Attribute to check if belongs to a specific message by its ID
Abstract base attribute for filtering callback-based updates. Supports various message types including regular messages, edited messages, channel posts, and business messages.
Properties:
-
AllowedTypesGets the allowed update types that this filter can process.
Methods:
-
GetFilterringTarget(Update)Extracts the message from various types of updates.
Attribute for filtering messages sent in a specific chat by ID.
Constructors:
-
ChatIdAttribute(Int64)Attribute for filtering messages sent in a specific chat by ID.
Attribute for filtering messages sent in forum chats.
Constructors:
-
ChatIsForumAttribute()Attribute for filtering messages sent in forum chats.
Attribute for filtering messages based on the chat name (first name and optionally last name).
Constructors:
-
ChatNameAttribute(String, String, StringComparison)Initializes the attribute to filter messages from chats with specific first and last names.
-
ChatNameAttribute(String, String)Initializes the attribute to filter messages from chats with specific first and last names.
Attribute for filtering messages based on the chat title.
Constructors:
-
ChatTitleAttribute(String, StringComparison)Initializes the attribute to filter messages from chats with a specific title and comparison method.
-
ChatTitleAttribute(String)Initializes the attribute to filter messages from chats with a specific title.
Attribute for filtering messages sent in chats of a specific type.
Constructors:
-
ChatTypeAttribute(ChatType)Initialize new instance of to filter messages from chat from specific chats
-
ChatTypeAttribute(ChatTypeFlags)Initialize new instance of to filter messages from chat from specific chats (with flags)
Attribute for filtering messages based on the chat username.
Constructors:
-
ChatUsernameAttribute(String, StringComparison)Initializes the attribute to filter messages from chats with a specific username and comparison method.
-
ChatUsernameAttribute(String)Initializes the attribute to filter messages from chats with a specific username.
Attribute for filtering messages based on command aliases. Allows handlers to respond to multiple command variations using a single attribute.
Constructors:
-
CommandAlliasAttribute()Initializes a new instance of the CommandAlliasAttribute with the specified command aliases.
Properties:
-
AllowedTypesGets the allowed update types for this filter.
-
AlliasesGets the array of command aliases that this filter will match.
-
DescriptionGets or sets the description of the command. Must be between 0 and 256 characters in length.
Methods:
-
GetFilterringTarget(Update)Gets the filtering target (Message) from the update.
Attribute for filtering messages that contain dice throws with specific values.
Constructors:
-
DiceThrowedAttribute(Int32)Initializes the attribute to filter dice throws with a specific value.
-
DiceThrowedAttribute(DiceType, Int32)Initializes the attribute to filter dice throws with a specific type and value.
Abstract base attribute for filtering updates based on environment conditions. Can process all types of updates and provides environment-specific filtering logic.
Properties:
-
AllowedTypesGets the allowed update types that this filter can process. Environment filters can process all update types.
Methods:
-
GetFilterringTarget(Update)Gets the update as the filtering target. Environment filters work with the entire update object.
Attribute for filtering updates based on environment variable values.
Constructors:
-
EnvironmentVariableAttribute(String, String, StringComparison)Initializes the attribute to filter based on an environment variable with a specific value and comparison method.
-
EnvironmentVariableAttribute(String, String)Initializes the attribute to filter based on an environment variable with a specific value.
-
EnvironmentVariableAttribute(String)Initializes the attribute to filter based on the existence of an environment variable.
-
EnvironmentVariableAttribute(String, StringComparison)Initializes the attribute to filter based on an environment variable with a specific comparison method.
Attribute for filtering messages sent by bots.
Constructors:
-
FromBotAttribute()Attribute for filtering messages sent by bots.
Attribute for filtering messages sent by premium users.
Constructors:
-
FromPremiumUserAttribute()Attribute for filtering messages sent by premium users.
Helper filter class for filters that operate on replied messages. Provides functionality to traverse reply chains and access replied message content.
Constructors:
-
FromReplyChainAttribute(Int32)Helper filter class for filters that operate on replied messages. Provides functionality to traverse reply chains and access replied message content.
Attribute for filtering messages based on the sender's name (first name and optionally last name).
Constructors:
-
FromUserAttribute(String, String, StringComparison)Initializes the attribute to filter messages from a user with specific first and last names.
-
FromUserAttribute(String, String)Initializes the attribute to filter messages from a user with specific first and last names.
-
FromUserAttribute(String)Initializes the attribute to filter messages from a user with a specific first name.
-
FromUserAttribute(String, StringComparison)Initializes the attribute to filter messages from a user with a specific first name and custom comparison.
Attribute for filtering messages from a specific user ID.
Constructors:
-
FromUserIdAttribute(Int64)Attribute for filtering messages from a specific user ID.
Attribute for filtering messages based on the sender's username.
Constructors:
-
FromUsernameAttribute(String)Initializes the attribute to filter messages from a specific username.
-
FromUsernameAttribute(String, StringComparison)Initializes the attribute to filter messages from a specific username with custom comparison.
Attribute for checking message's reply chain.
Constructors:
-
HasReplyAttribute(Int32)Attribute for checking message's reply chain.
Attribute for filtering messages that contain any non-empty text.
Constructors:
-
HasTextAttribute()Attribute for filtering messages that contain any non-empty text.
Attribute for filtering messages that are automatically forwarded.
Constructors:
-
IsAutomaticFormwardMessageAttribute()Attribute for filtering messages that are automatically forwarded.
Attribute for filtering updates that occur in debug environment. Only allows updates when the application is running in debug mode.
Constructors:
-
IsDebugEnvironmentAttribute()Attribute for filtering updates that occur in debug environment. Only allows updates when the application is running in debug mode.
Attribute for filtering messages sent while the user was offline.
Constructors:
-
IsFromOfflineMessageAttribute()Attribute for filtering messages sent while the user was offline.
Attribute for filtering updates that occur in release environment. Only allows updates when the application is running in release mode.
Constructors:
-
IsReleaseEnvironmentAttribute()Attribute for filtering updates that occur in release environment. Only allows updates when the application is running in release mode.
Attribute for filtering service messages (e.g., user joined, left, etc.).
Constructors:
-
IsServiceMessageMessageAttribute()Attribute for filtering service messages (e.g., user joined, left, etc.).
Attribute for filtering topic messages in forum chats.
Constructors:
-
IsTopicMessageMessageAttribute()Attribute for filtering topic messages in forum chats.
Attribute for filtering messages that contain mentions. Allows handlers to respond only to messages that mention the bot or specific users.
Constructors:
-
MentionedAttribute()Initializes a new instance of the MentionedAttribute that matches any mention.
-
MentionedAttribute(Int32)Initializes a new instance of the MentionedAttribute that matches mentions at a specific offset.
-
MentionedAttribute(String)Initializes a new instance of the MentionedAttribute that matches a specific mention.
-
MentionedAttribute(String, Int32)Initializes a new instance of the MentionedAttribute that matches a specific mention at a specific offset.
Attribute for filtering messages with reply to messages of this bot.
Constructors:
-
MeRepliedAttribute()Attribute for filtering messages with reply to messages of this bot.
Abstract base attribute for filtering message-based updates. Supports various message types including regular messages, edited messages, channel posts, and business messages.
Properties:
-
AllowedTypesGets the allowed update types that this filter can process.
Methods:
-
GetFilterringTarget(Update)Extracts the message from various types of updates.
Attribute for filtering messages based on their entities (mentions, links, etc.).
Constructors:
-
MessageHasEntityAttribute(MessageEntityType)Initializes the attribute to filter messages with a specific entity type.
-
MessageHasEntityAttribute(MessageEntityType, Int32, Nullable<Int32>)Initializes the attribute to filter messages with a specific entity type at a specific position.
-
MessageHasEntityAttribute(MessageEntityType, String, StringComparison)Initializes the attribute to filter messages with a specific entity type and content.
-
MessageHasEntityAttribute(MessageEntityType, Int32, Nullable<Int32>, String, StringComparison)Initializes the attribute to filter messages with a specific entity type, position, and content.
Attribute for filtering messages based on regular expression patterns.
Constructors:
-
MessageRegexAttribute(String, RegexOptions)Initializes the attribute with a regex pattern and options.
-
MessageRegexAttribute(Regex)Initializes the attribute with a precompiled regex.
Attribute for filtering messages sent by not bots (users).
Constructors:
-
NotFromBotAttribute()Attribute for filtering messages sent by not bots (users).
Attribute for filtering messages where the text contains the specified content.
Constructors:
-
TextContainsAttribute(String, StringComparison)Attribute for filtering messages where the text contains the specified content.
Attribute for filtering messages where the text ends with the specified content.
Constructors:
-
TextEndsWithAttribute(String, StringComparison)Attribute for filtering messages where the text ends with the specified content.
Attribute for filtering messages where the text equals the specified content.
Constructors:
-
TextEqualsAttribute(String, StringComparison)Attribute for filtering messages where the text equals the specified content.
Attribute for filtering messages where the text starts with the specified content.
Constructors:
-
TextStartsWithAttribute(String, StringComparison)Attribute for filtering messages where the text starts with the specified content.
Attribute for managing enum-based states in Telegram bot handlers. Provides a convenient way to associate enum values with state management functionality.
Constructors:
-
EnumStateAttribute<TEnum>(SpecialState, IStateKeyResolver<Int64>)Initializes a new instance of the EnumStateAttribute with a special state and custom key resolver.
-
EnumStateAttribute<TEnum>(TEnum, IStateKeyResolver<Int64>)Initializes a new instance of the EnumStateAttribute with a specific enum state and custom key resolver.
-
EnumStateAttribute<TEnum>(SpecialState)Initializes a new instance of the EnumStateAttribute with a special state and default sender ID resolver.
-
EnumStateAttribute<TEnum>(TEnum)Initializes a new instance of the EnumStateAttribute with a specific enum state and default sender ID resolver.
Attribute for associating a handler or method with a numeric (integer) state keeper. Provides constructors for flexible state and key resolver configuration.
Constructors:
-
NumericStateAttribute(SpecialState, IStateKeyResolver<Int64>)Initializes the attribute with a special state and a custom key resolver.
-
NumericStateAttribute(Int32, IStateKeyResolver<Int64>)Initializes the attribute with a specific numeric state and a custom key resolver.
-
NumericStateAttribute(SpecialState)Initializes the attribute with a special state and the default sender ID resolver.
-
NumericStateAttribute(Int32)Initializes the attribute with a specific numeric state and the default sender ID resolver.
Represents special states for state keeping logic.
Values:
-
None— No special state. -
NoState— Indicates that no state is present. -
AnyState— Indicates that any state is acceptable.
Attribute for associating a handler or method with a string-based state keeper. Provides various constructors for flexible state and key resolver configuration.
Constructors:
-
StringStateAttribute(SpecialState, IStateKeyResolver<Int64>)Initializes the attribute with a special state and a custom key resolver.
-
StringStateAttribute(String, IStateKeyResolver<Int64>)Initializes the attribute with a specific state and a custom key resolver.
-
StringStateAttribute(SpecialState)Initializes the attribute with a special state and the default sender ID resolver.
-
StringStateAttribute(String)Initializes the attribute with a specific state and the default sender ID resolver.
Attribute for filtering message with command "start" in bot's private chats. Allows handlers to respond to "welcome" bot commands.
Constructors:
-
WelcomeAttribute(Boolean)Creates new instance of
Attribute that specifies a post-execution processor to be executed after the handler. The processor type must implement interface.
Constructors:
AfterExecutionAttribute<T>()
Properties:
-
ProcessorTypeGets the type of the post-processor.
Attribute that specifies a pre-execution processor to be executed before the handler. The processor type must implement interface.
Constructors:
BeforeExecutionAttribute<T>()
Properties:
-
ProcessorTypeGets the type of the pre-processor.
Interface for post-execution processors that are executed after handler execution. Implement this interface to add cross-cutting concerns like logging, cleanup, or metrics collection.
Methods:
-
AfterExecution(IHandlerContainer, CancellationToken)Executes after the handler's main execution logic.
Interface for pre-execution processors that are executed before handler execution. Implement this interface to add cross-cutting concerns like validation, logging, or authorization.
Methods:
-
BeforeExecution(IHandlerContainer, CancellationToken)Executes before the handler's main execution logic.
Attribute that prevents a class from being automatically collected by the handler collection system. When applied to a class, it will be excluded from domain-wide handler collection operations.
Constructors:
DontCollectAttribute()
Reactive way to implement a new of type
Constructors:
-
FilterAnnotation<T>()Initializes new instance of
Properties:
-
IsCollectible -
AllowedTypes
Methods:
-
GetFilterringTarget(Update) -
CanPass(FilterExecutionContext<T>)
Enumeration of filter modifiers that can be applied to update filters. Defines how filters should be combined and applied in filter chains.
Values:
-
None— No modifier applied. Filter is applied as-is. -
OrNext— OR modifier. This filter or the next filter in the chain should match. -
Not— NOT modifier. The inverse of this filter should match.
Attribute that says if this handler can await some of await types, that is not listed by its handler base. Used for automatic collecting allowed to receiving 's. If you don't use it, you won't be able to await the updates inside handler.
Constructors:
-
MightAwaitAttribute()main ctor of
Properties:
-
UpdateTypesUpdate types that may be awaited
Abstract attribute for associating a handler or method with a state keeper. Provides logic for state-based filtering and state management.
Properties:
-
SharedGets or sets the singleton instance of the state keeper for this attribute type.
-
DefaultStateGets the default state value of this statekeeper.
-
MyStateGets the state value associated with this attribute instance.
-
SpecialStateGets the special state mode for this attribute instance.
Methods:
-
CanPass(FilterExecutionContext<Update>)Determines whether the current update context passes the state filter.
Abstract base attribute for defining update filters for a specific type of update target. Provides logic for filter composition, modifier processing, and target extraction.
Properties:
-
AnonymousFilterGets the compiled anonymous filter for this attribute.
-
UpdateFilterGets the compiled filter logic for the update target.
Methods:
-
ProcessModifiers(UpdateFilterAttributeBase)Processes filter modifiers and combines this filter with the previous one if needed.
-
GetFilterringTarget(Update)Extracts the filtering target of type from the given update.
Abstract base attribute for marking update handler classes. Provides a type-safe way to associate handler types with specific update types and importance settings.
Sets the state in which the can be executed
Properties:
IsCollectible
Methods:
-
CanPass(FilterExecutionContext<Update>)Realizes a for validation of the current in the polling routing
Defines the to validation for entry into execution of the
Properties:
-
AllowedTypesGets the 's that processing
-
AnonymousFilterGets the that processing
-
ModifiersGets or sets the filter modifiers that affect how this filter is combined with others.
Methods:
-
ProcessModifiers(UpdateFilterAttributeBase)Determines the logic of filter modifiers. Exceptionally internal implementation
Defines the 's and validator () of the that will process
Properties:
-
IsCollectible -
ExpectingHandlerTypeGets an array of that this attribute can be attached to
-
TypeGets an that handlers processes
-
ImportanceGets or sets importance of this in same pool
-
PriorityGets or sets priority of this in same type handlers pool
-
FormReportGets or sets a value indicating whether to form a fallback report.
Methods:
-
GetIndexer()Gets an of this from and
-
CanPass(FilterExecutionContext<Update>)Validator () of the that will process
Interface for providing bot information and metadata. Contains information about the bot user and provides initialization capabilities.
Properties:
-
UserGets the representing the bot.
Interface for configuring Telegram bot behavior and execution settings. Controls various aspects of bot operation including concurrency, routing, collecting, and execution policies.
Properties:
-
MaximumParallelWorkingHandlersGets or sets the maximum number of parallel working handlers. Null means no limit.
-
ExclusiveAwaitingHandlerRoutingGets or sets a value indicating whether awaiting handlers should be routed separately from regular handlers.
-
ExceptIntersectingCommandAliasesGets or sets a value indicating whether to exclude intersecting command aliases.
-
GlobalCancellationTokenGets or sets the global cancellation token for all bot operations.
A filter that passes only if both joined filters pass.
Constructors:
-
AndFilter<T>(IFilter<T>, IFilter<T>)Initializes a new instance of the class.
Methods:
CanPass(FilterExecutionContext<T>)
A filter that always passes.
Constructors:
AnyFilter<T>()
Methods:
CanPass(FilterExecutionContext<T>)
Filter that checks if a command argument contains a specified content.
Constructors:
-
ArgumentContainsFilter(String, StringComparison, Int32)Filter that checks if a command argument contains a specified content.
Filter that checks if a command argument ends with a specified content.
Constructors:
-
ArgumentEndsWithFilter(String, StringComparison, Int32)Filter that checks if a command argument ends with a specified content.
Filter that checks if a command argument equals a specified content.
Constructors:
-
ArgumentEqualsFilter(String, StringComparison, Int32)Filter that checks if a command argument equals a specified content.
Filter that checks if a command argument matches a regular expression pattern.
Constructors:
-
ArgumentRegexFilter(Regex, Int32)Filter that checks if a command argument matches a regular expression pattern.
-
ArgumentRegexFilter(String, RegexOptions, TimeSpan, Int32)Initializes a new instance of with a regex pattern.
Properties:
-
MatchGets the match found by the regex.
Filter that checks if a command argument starts with a specified content.
Constructors:
-
ArgumentStartsWithFilter(String, StringComparison, Int32)Filter that checks if a command argument starts with a specified content.
Filter thet checks 's data
Constructors:
-
CallbackDataFilter(String)Initialize new instance of
Methods:
CanPass(FilterExecutionContext<CallbackQuery>)
Filter that checks if belongs to a specific message
Constructors:
-
CallbackInlineIdFilter(String)Initialize new instance of
Methods:
CanPass(FilterExecutionContext<CallbackQuery>)
Filters callback queries by matching their data with a regular expression.
Constructors:
-
CallbackRegexFilter(String, RegexOptions)Initializes a new instance of the class with a pattern and options.
-
CallbackRegexFilter(Regex)Initializes a new instance of the class with a regex object.
Filter that checks if a command matches any of the specified aliases. Requires a to be applied first to extract the command.
Constructors:
-
CommandAlliasFilter()Filter that checks if a command matches any of the specified aliases. Requires a to be applied first to extract the command.
Properties:
-
ReceivedCommandGets the command that was received and extracted by the .
Methods:
-
CanPass(FilterExecutionContext<Message>)Checks if the received command matches any of the specified aliases. This filter requires a to be applied first to extract the command from the message.
Abstract base class for filters that operate on command arguments. Provides functionality to extract and validate command arguments from message text.
Methods:
-
CanPass(FilterExecutionContext<Message>)Determines whether the filter can pass by extracting the command argument and validating it.
Filters messages by dice throw value and optionally by dice type.
Constructors:
-
DiceThrowedFilter(Int32)Initializes a new instance of the class for a specific value.
-
DiceThrowedFilter(DiceType, Int32)Initializes a new instance of the class for a specific dice type and value.
Abstract base class for filters that operate based on the current environment. Provides functionality to detect debug vs release environments.
Filter that checks environment variable values.
Constructors:
-
EnvironmentVariableFilter(String, String, StringComparison)Filter that checks environment variable values.
-
EnvironmentVariableFilter(String, String)Initializes a new instance of the class with a specific value.
-
EnvironmentVariableFilter(String)Initializes a new instance of the class that checks for non-null values.
-
EnvironmentVariableFilter(String, StringComparison)Initializes a new instance of the class with custom comparison.
Methods:
-
CanPass(FilterExecutionContext<Update>)Checks if the environment variable matches the expected criteria.
Base class for filters, providing logical operations and collectability.
Properties:
-
IsCollectibleGets a value indicating whether this filter is collectible.
Methods:
-
If(Func<FilterExecutionContext<T>, Boolean>)Creates a filter from a function.
-
Any()Creates a filter that always passes.
-
Not()Creates a filter that inverts the result of this filter.
-
Not<Q>(IFilter<Q>)Creates a filter that inverts the result of this filter.
-
And(IFilter<T>)Creates a filter that passes only if both this and the specified filter pass.
-
Or(IFilter<T>)Creates a filter that passes if either this or the specified filter pass.
-
Or<Q>(IFilter<Q>, IFilter<Q>)Creates a filter that passes if either this or the specified filter pass.
-
CanPass(FilterExecutionContext<T>)Determines whether the filter can pass for the given context.
Filter that checks if the message was sent by a bot.
Constructors:
-
FromBotFilter()Filter that checks if the message was sent by a bot.
Filter that checks if the message was sent by a premium user.
Constructors:
-
FromPremiumUserFilter()Filter that checks if the message was sent by a premium user.
Helper filter class for filters that operate on replied messages. Provides functionality to traverse reply chains and access replied message content and shifts any next message filter to filter the content of found reply.
Constructors:
-
FromReplyChainFilter(Int32)Helper filter class for filters that operate on replied messages. Provides functionality to traverse reply chains and access replied message content and shifts any next message filter to filter the content of found reply.
Properties:
-
ReplyGets the replied message at the specified depth in the reply chain.
-
ReplyDepthGets the depth of reply chain traversal.
Methods:
-
CanPass(FilterExecutionContext<Message>)Determines if the message can pass through the filter by first validating the reply chain and then applying specific filter logic.
Filter that checks if the message sender has specific first and/or last name.
Constructors:
-
FromUserFilter(String, String, StringComparison)Filter that checks if the message sender has specific first and/or last name.
-
FromUserFilter(String, String)Initializes a new instance of the class with first and last name.
-
FromUserFilter(String)Initializes a new instance of the class with first name only.
-
FromUserFilter(String, StringComparison)Initializes a new instance of the class with first name and custom comparison.
Filter that checks if the message sender has a specific user ID.
Constructors:
-
FromUserIdFilter(Int64)Filter that checks if the message sender has a specific user ID.
Filter that checks if the message sender has a specific username.
Constructors:
-
FromUsernameFilter(String)Filter that checks if the message sender has a specific username.
-
FromUsernameFilter(String, StringComparison)Initializes a new instance of the class with custom string comparison.
A filter that uses a function to determine if it passes.
Constructors:
-
FunctionFilter<T>(Func<FilterExecutionContext<T>, Boolean>)Initializes a new instance of the class.
Methods:
CanPass(FilterExecutionContext<T>)
Filters messages that are automatic forwards.
Constructors:
IsAutomaticFormwardMessageFilter()
Filter that only passes in debug environment builds.
Constructors:
-
IsDebugEnvironmentFilter()Filter that only passes in debug environment builds.
Methods:
-
CanPass(FilterExecutionContext<Update>)Checks if the current environment is debug mode.
Filters messages that are sent from offline.
Constructors:
IsFromOfflineMessageFilter()
Filter that only passes in release environment builds.
Constructors:
-
IsReleaseEnvironmentFilter()Filter that only passes in release environment builds.
Methods:
-
CanPass(FilterExecutionContext<Update>)Checks if the current environment is release mode.
Filters service messages (e.g., chat events).
Constructors:
IsServiceMessageMessageFilter()
Filters messages that are topic messages.
Constructors:
IsTopicMessageMessageFilter()
Base class for filters that join multiple filters together.
Properties:
-
FiltersGets the array of joined filters.
Filter that checks if a message contains a mention of the bot or a specific user. Requires a to be applied first to identify mention entities.
Constructors:
-
MentionedFilter()Initializes a new instance of the class that checks for bot mentions.
-
MentionedFilter(String)Initializes a new instance of the class that checks for specific user mentions.
Filter that checks if the replied message was sent by the bot itself. ( ! ): REQUIRES before
Constructors:
MeRepliedFilter()
Methods:
-
CanPass(FilterExecutionContext<Message>)Checks if the replied message was sent by the bot.
Base class for filters that operate on the chat of the message being processed.
Properties:
-
ChatGets the chat of the message being processed.
Filters messages whose chat ID matches the specified value.
Constructors:
-
MessageChatIdFilter(Int64)Filters messages whose chat ID matches the specified value.
Filters messages whose chat is a forum.
Constructors:
MessageChatIsForumFilter()
Filters messages whose chat first and/or last name matches the specified values.
Constructors:
-
MessageChatNameFilter(String, String)Initializes a new instance of the class.
-
MessageChatNameFilter(String, String, StringComparison)Initializes a new instance of the class with a specific string comparison.
Filters messages whose chat title matches the specified value.
Constructors:
-
MessageChatTitleFilter(String)Initializes a new instance of the class.
-
MessageChatTitleFilter(String, StringComparison)Initializes a new instance of the class with a specific string comparison.
Filters messages whose chat type matches the specified value.
Constructors:
-
MessageChatTypeFilter(ChatType)Initialize new instance of
-
MessageChatTypeFilter(ChatTypeFlags)Initialize new instance of with
Filters messages whose chat username matches the specified value.
Constructors:
-
MessageChatUsernameFilter(String)Initializes a new instance of the class.
-
MessageChatUsernameFilter(String, StringComparison)Initializes a new instance of the class with a specific string comparison.
Base abstract class for all filter of updates
Methods:
CanPass(FilterExecutionContext<Message>)
Filters messages that contain a specific entity type, content, offset, or length.
Constructors:
-
MessageHasEntityFilter(MessageEntityType)Initializes a new instance of the class for a specific entity type.
-
MessageHasEntityFilter(MessageEntityType, Nullable<Int32>, Nullable<Int32>)Initializes a new instance of the class for a specific entity type, offset, and length.
-
MessageHasEntityFilter(MessageEntityType, String, StringComparison)Initializes a new instance of the class for a specific entity type and content.
-
MessageHasEntityFilter(MessageEntityType, Nullable<Int32>, Nullable<Int32>, String, StringComparison)Initializes a new instance of the class for a specific entity type, offset, length, and content.
Properties:
-
FoundEntitiesGets the entities found in the message that match the filter.
Filter that checks if message has appropriate reply chain. DOES NOT SHiFT MESSAGE FILTERS TARGET
Constructors:
-
MessageHasReplyFilter(Int32)Filter that checks if message has appropriate reply chain. DOES NOT SHiFT MESSAGE FILTERS TARGET
Properties:
-
ReplyGets the replied message at the specified depth in the reply chain.
-
ReplyDepthGets the depth of reply chain traversal.
Methods:
-
CanPass(FilterExecutionContext<Message>)Determines if the message can pass through the filter by first validating the reply chain and then applying specific filter logic.
Filters messages by matching their text with a regular expression.
Constructors:
-
MessageRegexFilter(String, RegexOptions)Initializes a new instance of the class with a pattern and options.
-
MessageRegexFilter(Regex)Initializes a new instance of the class with a regex object.
Abstract base class for filters that operate on message senders. Provides functionality to access and validate the user who sent the message.
Properties:
-
UserGets the user who sent the message.
Methods:
-
CanPass(FilterExecutionContext<Message>)Determines if the message can pass through the filter by validating that the message has a valid sender.
Abstract base class for filters that operate on message text content. Provides common functionality for extracting and validating message text.
Properties:
-
MessageGets the current message being processed by the filter.
-
TextGets the extracted text content from the current message.
Methods:
-
CanPass(FilterExecutionContext<Message>)Determines if the message can pass through the filter by validating the message and extracting its text content for further processing.
Filters messages by their .
Constructors:
-
MessageTypeFilter(MessageType)Initializes a new instance of the class.
A filter that passes if at least one of the joined filters passes.
Constructors:
-
OrFilter<T>(IFilter<T>, IFilter<T>)Initializes a new instance of the class.
Methods:
CanPass(FilterExecutionContext<T>)
Base class for filters that use regular expressions to match text in updates.
Properties:
-
MatchesGets the collection of matches found by the regex.
Methods:
-
CanPass(FilterExecutionContext<T>)Determines whether the regex matches the text extracted from the input.
A filter that inverts the result of another filter.
Constructors:
-
ReverseFilter<T>(IFilter<T>)Initializes a new instance of the class.
Methods:
CanPass(FilterExecutionContext<T>)
Filters updates by comparing a resolved state key with a target key.
Constructors:
-
StateKeyFilter<TKey>(IStateKeyResolver<TKey>, TKey)Initializes a new instance of the class.
Methods:
CanPass(FilterExecutionContext<Update>)
Filter that checks if the message text contains a specified content.
Constructors:
-
TextContainsFilter(String, StringComparison)Filter that checks if the message text contains a specified content.
Filter that checks if the message text ends with a specified content.
Constructors:
-
TextEndsWithFilter(String, StringComparison)Filter that checks if the message text ends with a specified content.
Filter that checks if the message text equals a specified content.
Constructors:
-
TextEqualsFilter(String, StringComparison)Filter that checks if the message text equals a specified content.
Filter that checks if the message text is not null or empty.
Constructors:
-
TextNotNullOrEmptyFilter()Filter that checks if the message text is not null or empty.
Filter that checks if the message text starts with a specified content.
Constructors:
-
TextStartsWithFilter(String, StringComparison)Filter that checks if the message text starts with a specified content.
Represents a compiled filter that applies a set of filters to an anonymous target type.
Properties:
-
NameGets the name of this compiled filter.
Methods:
-
Compile<T>(IEnumerable<IFilter<T>>, Func<Update, Object>)Compiles a set of filters into an for a specific target type.
-
Compile<T>(String, IEnumerable<IFilter<T>>, Func<Update, Object>)Compiles a set of filters into an for a specific target type with a custom name.
CanPass(FilterExecutionContext<Update>)
Represents a filter that applies a filter action to an anonymous target type extracted from an update.
Constructors:
-
AnonymousTypeFilter(String, Func<Update, Object>, Func<FilterExecutionContext<Update>, Object, Boolean>)Initializes a new instance of the class.
Properties:
-
NameGets the name of this filter.
Methods:
-
Compile<T>(IFilter<T>, Func<Update, T>)Compiles a filter for a specific target type.
-
Compile<T>(String, IFilter<T>, Func<Update, T>)Compiles a filter for a specific target type with a custom name.
-
CanPass(FilterExecutionContext<Update>)Determines whether the filter can pass for the given context by extracting the filtering target and applying the filter action.
Represents a filter that composes multiple filters and passes only if all of them pass.
Constructors:
-
CompiledFilter<T>()Initializes a new instance of the class.
-
CompiledFilter<T>(String, )Initializes a new instance of the class with a custom name.
Properties:
-
NameGets the name of this compiled filter.
Methods:
-
CanPass(FilterExecutionContext<T>)Determines whether all composed filters pass for the given context.
The list containing filters worked out during Polling to further obtain additional filtering information
Constructors:
CompletedFiltersList()
Methods:
-
Add<TUpdate>(IFilter<TUpdate>)Adds the completed filter to the list.
-
AddRange<TUpdate>(IEnumerable<IFilter<TUpdate>>)Adds many completed filters to the list.
-
Get<TFilter>()Looks for filters of a given type in the list.
-
Get<TFilter>(Int32)Looks for a filter of a given type at the specified index in the list.
-
GetOrDefault<TFilter>(Int32)Returns a filter of a given type at the specified index, or null if it does not exist.
GetEnumerator()
Represents the context for filter execution, including update, input, and additional data.
Constructors:
-
FilterExecutionContext<T>(ITelegramBotInfo, Update, T, Dictionary<String, Object>, CompletedFiltersList)Initializes a new instance of the class with all parameters.
-
FilterExecutionContext<T>(ITelegramBotInfo, Update, T)Initializes a new instance of the class with default data and filters.
Properties:
-
BotInfoGets the for the current context.
-
DataGets the additional data dictionary for the context.
-
CompletedFiltersGets the list of completed filters for the context.
-
UpdateGets the being processed.
-
TypeGets the of the update.
-
InputGets the input object for the filter.
Methods:
-
CreateChild<C>(C)Creates a child context for a different input type, sharing the same data and completed filters.
Represents a filter for a specific update type.
Methods:
-
CanPass(FilterExecutionContext<T>)Determines whether the filter can pass for the given context.
Interface for filters that can be collected into a completed filters list. Provides information about whether a filter should be tracked during execution.
Properties:
-
IsCollectibleGets if filter can be collected to
Represents a filter that joins multiple filters together.
Properties:
-
FiltersGets the array of joined filters.
Interface for filters that have a name for identification and debugging purposes.
Properties:
-
NameGets the name of the filter.
Container class that holds the context and data for handler execution. Provides access to the update, client, filters, and other execution context.
Constructors:
-
AbstractHandlerContainer<TUpdate>(DescribedHandlerInfo)Initializes new instance of
-
AbstractHandlerContainer<TUpdate>(TUpdate, Update, ITelegramBotClient, Dictionary<String, Object>, CompletedFiltersList, IAwaitingProvider)Initializes new instance of
Properties:
-
ActualUpdateGets the actual update object of type TUpdate.
-
HandlingUpdate -
Client -
ExtraData -
CompletedFilters -
AwaitingProvider
Methods:
-
CreateChild<QUpdate>()Creates new container of specific update type from thos contatiner
-
From<QUpdate>(IAbstractHandlerContainer<QUpdate>)Creates new container of specific update type from existing container
Abstract base class for handlers that can process any type of update. Provides a foundation for creating handlers that respond to all incoming updates.
Attribute that marks a handler to process any type of update. This handler will be triggered for all incoming updates regardless of their type.
Constructors:
-
AnyUpdateHandlerAttribute(Int32)Attribute that marks a handler to process any type of update. This handler will be triggered for all incoming updates regardless of their type.
Methods:
-
CanPass(FilterExecutionContext<Update>)Always returns true, allowing any update to pass through this filter.
Abstract base class for branching handlers that process command messages. Provides functionality to extract and parse command arguments for branching scenarios.
Abstract base class for branching handlers that process message updates. Provides convenient methods for sending replies and responses to messages in branching scenarios.
Abstract base class for handlers that process callback query updates. Provides a foundation for creating handlers that respond to user interactions with inline keyboards.
Attribute that marks a handler to process callback query updates. This handler will be triggered when users interact with inline keyboards or other callback mechanisms.
Constructors:
-
CallbackQueryHandlerAttribute(Int32)Attribute that marks a handler to process callback query updates. This handler will be triggered when users interact with inline keyboards or other callback mechanisms.
Methods:
-
CanPass(FilterExecutionContext<Update>)Always returns true, allowing any callback query update to pass through this filter.
Abstract base class for handlers that process command messages. Provides functionality to extract and parse command arguments.
Attribute that marks a handler to process command messages. This handler will be triggered when users send bot commands (messages starting with '/').
Constructors:
-
CommandHandlerAttribute(Int32)Attribute that marks a handler to process command messages. This handler will be triggered when users send bot commands (messages starting with '/').
Properties:
-
ReceivedCommandGets the command that was extracted from the message (without the '/' prefix and bot username).
-
ArgumentsMessage text splited by space characters
Methods:
-
CanPass(FilterExecutionContext<Update>)Checks if the update contains a valid bot command and extracts the command text.
Represents a handler container for a specific update type.
Properties:
-
ActualUpdateGets the actual update object of type .
Abstract base class for handlers that process inline queries. IMPORTANT! You can have only ONE instance of this handler.
Methods:
-
Execute(IAbstractHandlerContainer<Update>, CancellationToken) -
Requested(IAbstractHandlerContainer<InlineQuery>, CancellationToken)Executes handler logic if received update is
-
Chosen(IAbstractHandlerContainer<ChosenInlineResult>, CancellationToken)Executes handler logic if received update is
Attribute that marks a handler to process inline queries. IMPORTANT! You can have only ONE instance of this handler.
Constructors:
-
InlineQueryHandlerAttribute(Int32)Attribute that marks a handler to process inline queries. IMPORTANT! You can have only ONE instance of this handler.
Methods:
CanPass(FilterExecutionContext<Update>)
Abstract base class for handlers that process message updates. Provides convenient methods for sending replies and responses to messages.
Attribute that marks a handler to process message updates. This handler will be triggered when users send messages in chats.
Constructors:
-
MessageHandlerAttribute(Int32)Attribute that marks a handler to process message updates. This handler will be triggered when users send messages in chats.
Methods:
-
CanPass(FilterExecutionContext<Update>)Checks if the update contains a valid message.
Builder class for creating awaiter handlers that can wait for specific update types. Provides fluent API for configuring filters, state keepers, and other handler properties.
Constructors:
-
AwaiterHandlerBuilder<TUpdate>(UpdateType, Update, IAwaitingProvider)Initializes a new instance of the class.
Methods:
-
Await(CancellationToken)Awaits for an update of the specified type using the default sender ID resolver.
-
Await(IStateKeyResolver<Int64>, CancellationToken)Awaits for an update of the specified type using a custom state key resolver.
Builder class for creating regular handlers that can process updates. Provides fluent API for configuring filters, state keepers, and other handler properties.
Constructors:
-
HandlerBuilder<TUpdate>(UpdateType, IHandlersCollection)Initializes a new instance of the class.
Methods:
-
Build(AbstractHandlerAction<TUpdate>)Builds an abstract handler with the specified execution action.
Base class for building handler descriptors and managing handler filters.
Methods:
-
GetImplicitHandlerServiceKey(Type)Gets a unique service key for an implicit handler type.
-
SetUpdateValidating(UpdateValidateAction)Sets the update validating action for the handler.
-
SetConcurreny(Int32)Sets the concurrency level for the handler.
-
SetPriority(Int32)Sets the priority for the handler.
-
SetIndexer(Int32, Int32)Sets both concurrency and priority for the handler.
-
AddFilter(IFilter<Update>)Adds a filter to the handler.
-
AddFilters()Adds multiple filters to the handler.
-
SetStateKeeper<TKey, TState, TKeeper>(TState, IStateKeyResolver<TKey>)Sets a state keeper for the handler using a specific state and key resolver.
-
SetStateKeeper<TKey, TState, TKeeper>(SpecialState, IStateKeyResolver<TKey>)Sets a state keeper for the handler using a special state and key resolver.
-
AddTargetedFilter<TFilterTarget>(Func<Update, TFilterTarget>, IFilter<TFilterTarget>)Adds a targeted filter for a specific filter target type.
-
AddTargetedFilters<TFilterTarget>(Func<Update, TFilterTarget>)Adds multiple targeted filters for a specific filter target type.
Defines a builder for awaiting handler logic for a specific update type.
Methods:
-
Await(IStateKeyResolver<Int64>, CancellationToken)Awaits an update using the specified key resolver and cancellation token.
Defines builder actions for configuring handler builders.
Methods:
-
SetUpdateValidating(UpdateValidateAction)Sets the update validating action for the handler.
-
SetConcurreny(Int32)Sets the concurrency level for the handler.
-
SetPriority(Int32)Sets the priority for the handler.
-
SetIndexer(Int32, Int32)Sets both concurrency and priority for the handler.
-
AddFilter(IFilter<Update>)Adds a filter to the handler.
-
AddFilters()Adds multiple filters to the handler.
-
SetStateKeeper<TKey, TState, TKeeper>(TState, IStateKeyResolver<TKey>)Sets a state keeper for the handler using a specific state and key resolver.
-
SetStateKeeper<TKey, TState, TKeeper>(SpecialState, IStateKeyResolver<TKey>)Sets a state keeper for the handler using a special state and key resolver.
-
AddTargetedFilter<TFilterTarget>(Func<Update, TFilterTarget>, IFilter<TFilterTarget>)Adds a targeted filter for a specific filter target type.
-
AddTargetedFilters<TFilterTarget>(Func<Update, TFilterTarget>)Adds multiple targeted filters for a specific filter target type.
Defines a builder for regular handler logic for a specific update type.
Methods:
-
Build(AbstractHandlerAction<TUpdate>)Builds the handler logic using the specified execution delegate.
Filter for state keeping logic, allowing filtering based on state and special state conditions.
Constructors:
-
StateKeepFilter<TKey, TState, TKeeper>(TState, IStateKeyResolver<TKey>)Initializes a new instance of the class with a specific state.
-
StateKeepFilter<TKey, TState, TKeeper>(SpecialState, IStateKeyResolver<TKey>)Initializes a new instance of the class with a special state.
Properties:
-
StateKeeperGets or sets the state keeper instance.
-
MyStateGets the state value for this filter.
-
SpecialStateGets the special state value for this filter.
Methods:
-
CanPass(FilterExecutionContext<Update>)Determines whether the filter can pass for the given context based on state logic.
Filter that uses a delegate to validate updates.
Constructors:
-
UpdateValidateFilter(UpdateValidateAction)Initializes a new instance of the class.
Properties:
-
IsCollectibleGets a value indicating whether this filter is collectable. Always false for this filter.
Methods:
-
CanPass(FilterExecutionContext<Update>)Determines whether the filter can pass for the given context using the validation delegate.
Abstract handler for Telegram updates of type .
Methods:
-
CreateContainer(DescribedHandlerInfo)Creates a handler container for the specified awaiting provider and handler info.
-
Execute(IAbstractHandlerContainer<TUpdate>, CancellationToken)Abstract method to execute the update handling logic.
Abstract base class for handlers that support branching execution based on different methods. Allows multiple handler methods to be defined in a single class, each with its own filters.
Methods:
-
DescribeHandlers()Describes all handler branches in this class.
-
CreateContainer(DescribedHandlerInfo)Creates a handler container for this branching handler.
-
Execute(IAbstractHandlerContainer<TUpdate>, CancellationToken)Executes the current branch method.
Represents an empty handler container that throws for all members.
Constructors:
EmptyHandlerContainer()
Properties:
-
HandlingUpdate -
Client -
ExtraData -
CompletedFilters -
AwaitingProvider
Specifies the reason for a filter fallback.
Values:
-
NullTarget— The filter target was null. -
FailedFilter— The filter failed to pass.
Contains information about a filter that failed during execution. Provides details about the filter, its failure status, and any associated exception.
Constructors:
-
FilterFallbackInfo(String, IFilter<Update>, Boolean, Exception)Contains information about a filter that failed during execution. Provides details about the filter, its failure status, and any associated exception.
Properties:
-
NameGets the name of the filter.
-
FilterGets the filter instance that failed.
-
FailedGets a value indicating whether the filter failed.
-
ExceptionGets the exception that occurred during filter execution, if any.
Represents a report of filter fallback information for debugging and error handling. Contains detailed information about which filters failed and why during handler execution.
Constructors:
-
FiltersFallbackReport(HandlerDescriptor, FilterExecutionContext<Update>)Represents a report of filter fallback information for debugging and error handling. Contains detailed information about which filters failed and why during handler execution.
Properties:
-
DescriptorGets the handler descriptor associated with this fallback report.
-
ContextGets the filter execution context that generated this report.
-
UpdateValidatorGets or sets the fallback information for the update validator filter.
-
StateKeeperValidatorGets or sets the fallback information for the state keeper validator filter.
-
UpdateFiltersGets the list of fallback information for update filters that failed.
Methods:
-
ExceptAttribute<T>(Int32)Checks if the failure is due to a specific attribute type, excluding other failures.
Represents a token that tracks the lifetime of a handler instance.
Constructors:
HandlerLifetimeToken()
Properties:
-
IsEndedGets a value indicating whether the handler's lifetime has ended.
Methods:
-
LifetimeEnded()Marks the handler's lifetime as ended and triggers the event.
Interface for handler containers that provide context and resources for update handlers. Contains all necessary information and services that handlers need during execution.
Properties:
-
HandlingUpdateGets the being handled.
-
ClientGets the used for this handler.
-
ExtraDataGets the extra data associated with the handler execution.
-
CompletedFiltersGets the for this handler.
-
AwaitingProviderGets the for awaiting operations.
Factory interface for creating handler containers. Provides a way to create handler containers with specific providers and handler information.
Methods:
-
CreateContainer(DescribedHandlerInfo)Creates a new for the specified awaiting provider and handler info.
Base class for update handlers, providing execution and lifetime management for Telegram updates.
Properties:
-
HandlingUpdateTypeGets the that this handler processes.
-
LifetimeTokenGets the associated with this handler instance.
Methods:
-
Execute(DescribedHandlerInfo, CancellationToken)Executes the handler logic and marks the lifetime as ended after execution.
-
FiltersFallback(FiltersFallbackReport, ITelegramBotClient, CancellationToken)Handles failed filters during handler describing. Use to control how router should treat this fail. to silently continue decribing. to stop\break desribing sequence.
Dispose()
Centralized logging system for Telegrator. Provides static access to logging functionality with adapter support.
Properties:
-
AdaptersCountGets the current adapters count.
-
MinimalLevelMinimal level of logging messages. Any messages below thi value will not be writen!
Methods:
-
AddAdapter(ITelegratorLogger)Adds a logger adapter to the centralized logging system.
-
RemoveAdapter(ITelegratorLogger)Removes a logger adapter from the centralized logging system.
-
ClearAdapters()Clears all logger adapters.
-
Log(LogLevel, String, Exception)Logs a message to all registered adapters.
-
LogTrace(String)Logs a trace message to all registered adapters.
-
LogTrace(String)Logs a trace message to all registered adapters.
-
LogDebug(String)Logs a debug message to all registered adapters.
-
LogDebug(String)Logs a debug message to all registered adapters.
-
LogInformation(String)Logs an information message to all registered adapters.
-
LogInformation(String)Logs an information message to all registered adapters.
-
LogWarning(String)Logs a warning message to all registered adapters.
-
LogWarning(String)Logs a warning message to all registered adapters.
-
LogError(String, Exception)Logs an error message to all registered adapters.
-
LogError(String)Logs an error message to all registered adapters.
-
LogError(Exception)Logs an error message with exception only to all registered adapters.
-
LogError(String, Exception)Logs an error message to all registered adapters.
Console logger implementation that writes to System.Console. This logger is optional and can be used for simple console output.
Constructors:
-
ConsoleLogger(LogLevel, Boolean)Initializes a new instance of ConsoleLogger.
Methods:
Log(LogLevel, String, Exception)
Interface for Telegrator logging system. Provides abstraction for logging without external dependencies.
Methods:
-
Log(LogLevel, String, Exception)Logs a message with specified level.
Log levels for Telegrator logging system.
Values:
-
Trace— Trace level - most detailed logging. -
Debug— Debug level - detailed debugging information. -
Information— Information level - general information. -
Warning— Warning level - warning messages. -
Error— Error level - error messages.
Null logger implementation that does nothing. Used when logging is not required or disabled.
Methods:
Log(LogLevel, String, Exception)
Provider for managing awaiting handlers that can wait for specific update types.
Methods:
-
UseHandler(HandlerDescriptor)Registers the usage of a handler and returns a disposable object to manage its lifetime.
Interface for providers that collect and manage handler collections. Provides access to a collection of handlers for various processing operations.
Properties:
-
HandlersGets the collection of handlers managed by this provider.
Collection class for managing handler descriptors organized by update type. Provides functionality for collecting, adding, and organizing handlers.
Properties:
-
AllowedTypesGets the collection of 's allowed by registered handlers
-
KeysGets the collection of keys for the handler lists.
-
ValuesGets the collection of values.
-
this[]Gets the for the specified .
Methods:
-
AddDescriptor(HandlerDescriptor)Adds a to the collection and returns the updated collection.
-
AddHandler<THandler>()Adds a handler of the specified type to the collection and returns the updated collection.
-
AddHandler(Type)Adds a handler of the specified type to the collection and returns the updated collection.
-
GetDescriptorList(HandlerDescriptor)Gets the for the specified .
Provides methods to retrieve and describe handler information for updates.
Properties:
-
AllowedTypesGets the collection of 's allowed by registered handlers
Methods:
-
TryGetDescriptorList(UpdateType, HandlerDescriptorList) -
GetHandlerInstance(HandlerDescriptor, CancellationToken)Instantiates a handler for the given descriptor, using the appropriate creation strategy based on descriptor type. Supports singleton, implicit, keyed, and general descriptor types with different instantiation patterns.
-
IsEmpty()Determines whether the provider contains any handlers.
Interface for polling providers that manage both regular and awaiting handlers. Provides access to handlers for different types of update processing during polling operations.
Properties:
-
HandlersProviderGets the that manages handlers for polling.
-
AwaitingProviderGets the that manages awaiting handlers for polling.
Interface for handling exceptions that occur during update routing operations. Provides a centralized way to handle and log errors that occur during bot operation.
Methods:
-
HandleException(ITelegramBotClient, Exception, HandleErrorSource, CancellationToken)Handles exceptions that occur during update routing.
Provides a pool for managing the execution and queuing of update handlers.
Methods:
-
Enqueue(IEnumerable<DescribedHandlerInfo>)Enqueues a collection of handlers for execution.
Interface for update routers that handle incoming updates and manage handler execution. Combines update handling capabilities with polling provider functionality and exception handling.
Properties:
-
OptionsGets the for the router.
-
HandlersPoolGets the that manages handler execution.
-
ExceptionHandlerGets or sets the for handling exceptions.
-
DefaultContainerFactoryDefault hand;er container factory
Contains information about a described handler, including its context, client, and execution logic.
Constructors:
-
DescribedHandlerInfo(HandlerDescriptor, IUpdateRouter, IAwaitingProvider, ITelegramBotClient, UpdateHandlerBase, FilterExecutionContext<Update>, String)Initializes a new instance of the class.
Properties:
-
HandlerLifetimeLifetime token for the handler instance.
-
DisplayStringDisplay string for the handler (for debugging or logging).
Methods:
ToString()
Manages the execution of pre and post-execution aspects for a handler. This class coordinates between self-processing (handler implements interfaces) and typed processing (external processor classes).
Constructors:
-
DescriptorAspectsSet(Boolean, Type, Boolean, Type)Initializes a new instance of the class.
Properties:
-
SelfPreGets a value indicating whether the handler implements .
-
SelfPostGets a value indicating whether the handler implements .
-
TypedPreGets the type of the external pre-processor, if specified via .
-
TypedPostGets the type of the external post-processor, if specified via .
Methods:
-
ExecutePre(UpdateHandlerBase, IHandlerContainer, CancellationToken)Executes the pre-execution aspect for the handler.
-
ExecutePost(UpdateHandlerBase, IHandlerContainer, CancellationToken)Executes the post-execution aspect for the handler.
Represents a set of filters for a handler descriptor, including update and state keeper validators.
Constructors:
-
DescriptorFiltersSet(IFilter<Update>, IFilter<Update>, )Initializes a new instance of the class.
Properties:
-
UpdateValidatorValidator for the update object.
-
StateKeeperValidatorValidator for the state keeper.
-
UpdateFiltersArray of update filters.
Methods:
-
Validate(FilterExecutionContext<Update>, Boolean, FiltersFallbackReport)Validates the filter context using all filters in the set.
Represents an indexer for handler descriptors, containing importance and priority information.
Constructors:
-
DescriptorIndexer(Int32, Int32, Int32)Represents an indexer for handler descriptors, containing importance and priority information.
-
DescriptorIndexer(Int32, UpdateHandlerAttributeBase)Initializes a new instance of the struct from a handler attribute.
DescriptorIndexer()
Methods:
-
UpdatePriority(Int32)Returns a new with updated priority.
-
UpdateImportance(Int32)Returns a new with updated importance.
-
UpdateIndex(Int32)Returns a new with updated RouterIndex.
-
CompareTo(DescriptorIndexer)Compares this instance to another .
-
ToString()Returns a string representation of the indexer.
Specifies the type of handler descriptor.
Values:
-
General— General handler descriptor. -
Keyed— Keyed handler descriptor (uses a service key). -
Implicit— Implicit handler descriptor. -
Singleton— Singleton handler descriptor (single instance).
Describes a handler, its type, filters, and instantiation logic.
Constructors:
-
HandlerDescriptor(DescriptorType, Type, Boolean)Initializes a new instance of the class with the specified descriptor type and handler type. Automatically inspects the handler type to extract attributes, filters, and configuration.
-
HandlerDescriptor(Type, Object)Initializes a new instance of the class as a keyed handler with the specified service key.
-
HandlerDescriptor(DescriptorType, Type, UpdateType, DescriptorIndexer, DescriptorFiltersSet)Initializes a new instance of the class with all basic properties.
-
HandlerDescriptor(DescriptorType, Type, UpdateType, DescriptorIndexer, DescriptorFiltersSet, Object, UpdateHandlerBase)Initializes a new instance of the class with singleton instance support.
-
HandlerDescriptor(DescriptorType, Type, UpdateType, DescriptorIndexer, DescriptorFiltersSet, Func<UpdateHandlerBase>)Initializes a new instance of the class with instance factory support.
-
HandlerDescriptor(DescriptorType, Type, UpdateType, DescriptorIndexer, DescriptorFiltersSet, Object, Func<UpdateHandlerBase>)Initializes a new instance of the class with service key and instance factory support.
-
HandlerDescriptor(DescriptorType, Type, UpdateHandlerAttributeBase, , IFilter<Update>)Initializes a new instance of the class with polling handler attribute and filters.
-
HandlerDescriptor(DescriptorType, Type, UpdateHandlerAttributeBase, , IFilter<Update>, Object, UpdateHandlerBase)Initializes a new instance of the class with polling handler attribute, filters, and singleton instance.
-
HandlerDescriptor(DescriptorType, Type, UpdateHandlerAttributeBase, , IFilter<Update>, Func<UpdateHandlerBase>)Initializes a new instance of the class with polling handler attribute, filters, and instance factory.
-
HandlerDescriptor(DescriptorType, Type, UpdateHandlerAttributeBase, , IFilter<Update>, Object, Func<UpdateHandlerBase>)Initializes a new instance of the class with polling handler attribute, filters, service key, and instance factory.
-
HandlerDescriptor(DescriptorType, Type, UpdateType, DescriptorIndexer, IFilter<Update>, , IFilter<Update>)Initializes a new instance of the class with validation filter support.
-
HandlerDescriptor(DescriptorType, Type, UpdateType, DescriptorIndexer, IFilter<Update>, , IFilter<Update>, Object, UpdateHandlerBase)Initializes a new instance of the class with validation filter and singleton instance support.
-
HandlerDescriptor(DescriptorType, Type, UpdateType, DescriptorIndexer, IFilter<Update>, , IFilter<Update>, Func<UpdateHandlerBase>)Initializes a new instance of the class with validation filter and instance factory support.
-
HandlerDescriptor(DescriptorType, Type, UpdateType, DescriptorIndexer, IFilter<Update>, , IFilter<Update>, Object, Func<UpdateHandlerBase>)Initializes a new instance of the class with validation filter, service key, and instance factory support.
Properties:
-
TypeThe type of the descriptor.
-
HandlerTypeThe type of the handler.
-
UpdateTypeThe update type handled by this handler.
-
IndexerThe indexer for handler concurrency and priority.
-
FormReportGets or sets a value indicating whether to form a fallback report.
-
FiltersThe set of filters associated with this handler.
-
AspectsGets or sets the aspects configuration for this handler. Contains pre and post-execution processors if the handler uses the aspect system.
-
ServiceKeyThe service key for keyed handlers.
-
InstanceFactoryFactory for creating handler instances.
-
SingletonInstanceSingleton instance of the handler, if applicable.
-
DisplayStringDisplay string for the handler (for debugging or logging).
-
LazyInitializationGets or sets a function for 'lazy' handlers initialization
Methods:
-
SetInstance(UpdateHandlerBase)Sets singleton instance of this descriptor Throws exception if instance already set
-
TrySetInstance(UpdateHandlerBase)Tries to set singleton instance of this descriptor
ToString()
The collection containing the 's. Used to route 's in
Constructors:
-
HandlerDescriptorList()Initializes a new instance of the class without a specific .
-
HandlerDescriptorList(UpdateType, ITelegratorOptions)Initializes a new instance of the class.
Properties:
-
IsReadOnlyGets a value indicating whether the collection is read-only.
-
HandlingTypeGets the of handlers in this collection.
-
CountGets count of registered handlers in list
-
this[]Gets or sets the at the specified index.
Methods:
-
Add(HandlerDescriptor)Adds a new to the collection.
-
ContainsKey(DescriptorIndexer)Checks if the collection contains a with the specified .
-
Remove(DescriptorIndexer)Removes the with the specified from the collection.
-
Remove(HandlerDescriptor)Removes the from the collection.
-
Clear()Removes all descriptos from the
-
Freeze()Freezes the and prohibits adding new elements to it.
GetEnumerator()
Provides methods for inspecting handler types and retrieving their attributes and filters.
Methods:
-
GetDisplayName(MemberInfo)Gets handler's display name
-
GetHandlerAttribute(MemberInfo)Gets the handler attribute from the specified member info.
-
GetStateKeeperAttribute(MemberInfo)Gets the state keeper attribute from the specified member info, if present.
-
GetFilterAttributes(MemberInfo, UpdateType)Gets all filter attributes for the specified handler type and update type.
-
GetAspects(Type)Gets the aspects configuration for the specified handler type. Inspects the handler for both self-processing (implements interfaces) and typed processing (uses attributes).
Descriptor for creating handlers from methods
Constructors:
-
MethodHandlerDescriptor<TUpdate>(AbstractHandlerAction<TUpdate>)Initializes new instance of
Constructors:
CallbackButtonAttribute(String, String)
Properties:
-
NameName of button
-
DataData that will be send to bot
Constructors:
CopyTextButtonAttribute(String, CopyTextButton)
Properties:
-
NameName of button
-
CopyTextText to copy
Constructors:
GameButtonAttribute(String, String)
Properties:
-
NameName of button
-
GameGame to open
Constructors:
LoginButtonAttribute(String, LoginUrl)
Properties:
-
NameName of button
-
UrlUrl of app to login to
Constructors:
PayRequestButtonAttribute(String)
Properties:
-
NameName of button
Constructors:
QueryCurrentButtonAttribute(String, String)
Properties:
-
NameName of button
-
QueryQuery
Constructors:
SwitchQueryButtonAttribute(String, String)
Properties:
-
NameName of button
-
QueryQuery
Constructors:
UrlRedirectButtonAttribute(String, String)
Properties:
-
NameName of button
-
UrlUrl to redirect user
Constructors:
WebAppButtonAttribute(String, WebAppInfo)
Properties:
-
NameName of button
-
AppInfoInfo about mini app to open
Realizes using function delegate
Constructors:
-
DefaultRouterExceptionHandler(RouterExceptionHandler)Realizes using function delegate
Methods:
HandleException(ITelegramBotClient, Exception, HandleErrorSource, CancellationToken)
Represents a dictionayr with limited number of slots, if trying to overflow, will block calling thread until one of slots will be free
Constructors:
-
LimitedDictionary<TKey, TValue>(Nullable<Int32>)Initializes new instance of
Methods:
-
Add(TKey, TValue, CancellationToken)Tries to add new element to dictioanry. If all slots are occupied, blocks calling thread.
-
Remove(TKey, TValue)Tries to remove element from dictionay. Frees slot on success.
-
GetEnumerator() -
Dispose()
Reactive implementation of for polling updates from Telegram. Provides custom update receiving logic with error handling and configuration options.
Constructors:
-
ReactiveUpdateReceiver(ITelegramBotClient, ReceiverOptions)Reactive implementation of for polling updates from Telegram. Provides custom update receiving logic with error handling and configuration options.
Methods:
-
ReceiveAsync(IUpdateHandler, CancellationToken)Receives updates from Telegram using long polling. Handles update processing, error handling, and cancellation.
Implementation of that manages the execution of handlers. Provides thread-safe queuing and execution of handlers with configurable concurrency limits.
Constructors:
-
UpdateHandlersPool(TelegratorOptions, CancellationToken)Initializes a new instance of the class.
Methods:
-
Enqueue(IEnumerable<DescribedHandlerInfo>) -
Dispose()Disposes of the handlers pool and releases all resources.
Implementation of that routes updates to appropriate handlers. Manages the distribution of updates between regular handlers and awaiting handlers.
Constructors:
-
UpdateRouter(IHandlersProvider, IAwaitingProvider, TelegratorOptions, ITelegramBotInfo)Initializes a new instance of the class.
-
UpdateRouter(IHandlersProvider, IAwaitingProvider, TelegratorOptions, IUpdateHandlersPool, ITelegramBotInfo)Initializes a new instance of the class with a custom handlers pool.
Properties:
-
HandlersProvider -
AwaitingProvider -
Options -
HandlersPool -
ExceptionHandler -
DefaultContainerFactory
Methods:
-
HandleErrorAsync(ITelegramBotClient, Exception, HandleErrorSource, CancellationToken)Handles errors that occur during update processing.
-
HandleUpdateAsync(ITelegramBotClient, Update, CancellationToken)Handles incoming updates by routing them to appropriate handlers.
-
DescribeHandler(IHandlersProvider, HandlerDescriptor, ITelegramBotClient, Update, Boolean, CancellationToken)Describes a single handler descriptor for a given update context. Validates the handler's filters against the update and creates a handler instance if validation passes.
Provider for managing awaiting handlers that can wait for specific update types. Extends HandlersProvider to provide functionality for creating and managing awaiter handlers.
Constructors:
-
AwaitingProvider(TelegratorOptions)Provider for managing awaiting handlers that can wait for specific update types. Extends HandlersProvider to provide functionality for creating and managing awaiter handlers.
Methods:
-
TryGetDescriptorList(UpdateType, HandlerDescriptorList) -
UseHandler(HandlerDescriptor)
Collection class for managing handler descriptors organized by update type. Provides functionality for collecting, adding, and organizing handlers.
Constructors:
-
HandlersCollection(ITelegratorOptions)Collection class for managing handler descriptors organized by update type. Provides functionality for collecting, adding, and organizing handlers.
Properties:
-
AllowedTypes -
Keys -
Values -
this[]
Methods:
-
AddDescriptor(HandlerDescriptor)Adds a handler descriptor to the collection.
-
AddHandler<THandler>()Adds a handler type to the collection.
-
AddHandler(Type)Adds a handler type to the collection.
-
GetDescriptorList(HandlerDescriptor)Gets or creates a descriptor list for the specified update type.
Provides handler resolution and instantiation logic for Telegram bot updates. Responsible for mapping update types to handler descriptors, filtering handlers based on update context, and creating handler instances with appropriate lifecycle management.
Constructors:
-
HandlersProvider(IHandlersCollection, TelegratorOptions)Initializes a new instance of with the specified handler collections and configuration.
-
HandlersProvider(IEnumerable<HandlerDescriptorList>, TelegratorOptions)Initializes a new instance of with the specified handler collections and configuration.
Properties:
AllowedTypes
Methods:
-
GetHandlerInstance(HandlerDescriptor, CancellationToken) -
TryGetDescriptorList(UpdateType, HandlerDescriptorList) -
IsEmpty()
Interface for classes that can provide custom handler descriptors. Allows classes to define their own handler description logic beyond the standard reflection-based approach.
Methods:
-
DescribeHandlers()Describes the handlers provided by this class.
Resolves chat ID from Telegram updates for state management purposes. Extracts the chat identifier from various types of updates to provide a consistent key for state operations.
Constructors:
ChatIdResolver()
Methods:
-
ResolveKey(Update)Resolves the chat ID from a Telegram update.
State keeper implementation for enum-based states. Automatically creates an array of all enum values for state navigation.
Constructors:
-
EnumStateKeeper<TEnum>()State keeper implementation for enum-based states. Automatically creates an array of all enum values for state navigation.
Properties:
-
DefaultStateGets the default state, which is the first value in the enum.
State keeper that manages numeric (integer) states for chat sessions. Inherits from with long keys and int states. Provides automatic increment/decrement functionality for state transitions.
Constructors:
NumericStateKeeper()
Properties:
-
DefaultStateGets the default state value, which is 1.
Resolves sender ID from Telegram updates for state management purposes. Extracts the sender identifier from various types of updates to provide a consistent key for state operations.
Constructors:
SenderIdResolver()
Methods:
-
ResolveKey(Update)Resolves the sender ID from a Telegram update.
Provides extension methods for managing numeric states in handler containers.
Methods:
-
NumericStateKeeper(IHandlerContainer)Gets the numeric state keeper instance associated with the handler container.
-
CreateNumericState(IHandlerContainer)Creates a new numeric state for the current update being handled.
-
DeleteNumericState(IHandlerContainer)Deletes the numeric state for the current update being handled.
-
SetNumericState(IHandlerContainer, Nullable<Int32>)Sets the numeric state for the current update being handled. If the new state is null, uses the default state from the state keeper.
-
ForwardNumericState(IHandlerContainer)Moves the numeric state forward by incrementing the current value.
-
BackwardNumericState(IHandlerContainer)Moves the numeric state backward by decrementing the current value.
-
StringStateKeeper(IHandlerContainer)Gets the string state keeper instance associated with the handler container.
-
CreateStringState(IHandlerContainer)Creates a new string state for the current update being handled.
-
DeleteStringState(IHandlerContainer)Deletes the string state for the current update being handled.
-
SetStringState(IHandlerContainer, String)Sets the string state for the current update being handled. If the new state is null, uses the default state from the state keeper.
-
EnumStateKeeper<TEnum>(IHandlerContainer)Gets the enum state keeper for the specified enum type.
-
CreateEnumState<TEnum>(IHandlerContainer)Creates a new enum state for the current update.
-
DeleteEnumState<TEnum>(IHandlerContainer)Deletes the enum state for the current update.
-
SetEnumState<TEnum>(IHandlerContainer, TEnum)Sets the enum state to a specific value for the current update.
-
ForwardEnumState<TEnum>(IHandlerContainer)Moves the enum state forward to the next value in the enum sequence.
-
BackwardEnumState<TEnum>(IHandlerContainer)Moves the enum state backward to the previous value in the enum sequence.
Provides extension methods for managing numeric states in handler containers.
Methods:
-
NumericStateKeeper(IHandlerContainer)Gets the numeric state keeper instance associated with the handler container.
-
CreateNumericState(IHandlerContainer)Creates a new numeric state for the current update being handled.
-
DeleteNumericState(IHandlerContainer)Deletes the numeric state for the current update being handled.
-
SetNumericState(IHandlerContainer, Nullable<Int32>)Sets the numeric state for the current update being handled. If the new state is null, uses the default state from the state keeper.
-
ForwardNumericState(IHandlerContainer)Moves the numeric state forward by incrementing the current value.
-
BackwardNumericState(IHandlerContainer)Moves the numeric state backward by decrementing the current value.
-
StringStateKeeper(IHandlerContainer)Gets the string state keeper instance associated with the handler container.
-
CreateStringState(IHandlerContainer)Creates a new string state for the current update being handled.
-
DeleteStringState(IHandlerContainer)Deletes the string state for the current update being handled.
-
SetStringState(IHandlerContainer, String)Sets the string state for the current update being handled. If the new state is null, uses the default state from the state keeper.
-
EnumStateKeeper<TEnum>(IHandlerContainer)Gets the enum state keeper for the specified enum type.
-
CreateEnumState<TEnum>(IHandlerContainer)Creates a new enum state for the current update.
-
DeleteEnumState<TEnum>(IHandlerContainer)Deletes the enum state for the current update.
-
SetEnumState<TEnum>(IHandlerContainer, TEnum)Sets the enum state to a specific value for the current update.
-
ForwardEnumState<TEnum>(IHandlerContainer)Moves the enum state forward to the next value in the enum sequence.
-
BackwardEnumState<TEnum>(IHandlerContainer)Moves the enum state backward to the previous value in the enum sequence.
Provides extension methods for managing numeric states in handler containers.
Methods:
-
NumericStateKeeper(IHandlerContainer)Gets the numeric state keeper instance associated with the handler container.
-
CreateNumericState(IHandlerContainer)Creates a new numeric state for the current update being handled.
-
DeleteNumericState(IHandlerContainer)Deletes the numeric state for the current update being handled.
-
SetNumericState(IHandlerContainer, Nullable<Int32>)Sets the numeric state for the current update being handled. If the new state is null, uses the default state from the state keeper.
-
ForwardNumericState(IHandlerContainer)Moves the numeric state forward by incrementing the current value.
-
BackwardNumericState(IHandlerContainer)Moves the numeric state backward by decrementing the current value.
-
StringStateKeeper(IHandlerContainer)Gets the string state keeper instance associated with the handler container.
-
CreateStringState(IHandlerContainer)Creates a new string state for the current update being handled.
-
DeleteStringState(IHandlerContainer)Deletes the string state for the current update being handled.
-
SetStringState(IHandlerContainer, String)Sets the string state for the current update being handled. If the new state is null, uses the default state from the state keeper.
-
EnumStateKeeper<TEnum>(IHandlerContainer)Gets the enum state keeper for the specified enum type.
-
CreateEnumState<TEnum>(IHandlerContainer)Creates a new enum state for the current update.
-
DeleteEnumState<TEnum>(IHandlerContainer)Deletes the enum state for the current update.
-
SetEnumState<TEnum>(IHandlerContainer, TEnum)Sets the enum state to a specific value for the current update.
-
ForwardEnumState<TEnum>(IHandlerContainer)Moves the enum state forward to the next value in the enum sequence.
-
BackwardEnumState<TEnum>(IHandlerContainer)Moves the enum state backward to the previous value in the enum sequence.
State keeper that manages string-based states for chat sessions.
Constructors:
-
StringStateKeeper()State keeper that manages string-based states for chat sessions.
Properties:
-
DefaultStateGets the default state value, which is an empty string.
Abstract base class for state keepers that manage state transitions using an array of predefined states. Provides forward and backward navigation through a fixed sequence of states.
Base class for managing state associated with updates and keys.
Properties:
-
KeyResolverGets or sets the key resolver used to resolve keys from updates.
-
DefaultStateGets the default state value.
Methods:
-
SetState(Update, TState)Sets the state for the specified update.
-
GetState(Update)Gets the state for the specified update.
-
TryGetState(Update, TState)Tries to get the state for the specified update.
-
HasState(Update)Determines whether a state exists for the specified update.
-
CreateState(Update)Creates a state for the specified update using the default state value.
-
DeleteState(Update)Deletes the state for the specified update.
-
MoveForward(Update)Moves the state forward for the specified update.
-
MoveBackward(Update)Moves the state backward for the specified update.
Defines a resolver for extracting a key from an update for state keeping purposes.
Methods:
-
ResolveKey(Update)Resolves a key from the specified .