Class TelegramModule
Base class for all modules
Inheritance
Inherited Members
Namespace: TelegramModularFramework.Modules
Assembly: TelegramModularFramework.dll
Syntax
[UsedImplicitly(ImplicitUseTargetFlags.WithMembers | ImplicitUseTargetFlags.WithInheritors)]
public abstract class TelegramModule
Properties
| Improve this Doc View SourceContext
Current context with client, update object and etc
Declaration
public ModuleContext Context { get; set; }
Property Value
Type | Description |
---|---|
ModuleContext |
Methods
| Improve this Doc View SourceChangeStateAsync(String)
Changes state of current chat
Declaration
public Task ChangeStateAsync(string path)
Parameters
Type | Name | Description |
---|---|---|
System.String | path | Relative or absolute path |
Returns
Type | Description |
---|---|
Task |
EditInlineMessageTextAsync(String, Nullable<ParseMode>, Nullable<IEnumerable<MessageEntity>>, Nullable<Boolean>, InlineKeyboardMarkup, CancellationToken)
Use this method to edit text and game messages.
Declaration
public Task EditInlineMessageTextAsync(string text, ParseMode? parseMode = null, IEnumerable<MessageEntity>? entities = null, bool? disableWebPagePreview = null, InlineKeyboardMarkup replyMarkup = null, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | text | New text of the message, 1-4096 characters after entities parsing |
System.Nullable<Telegram.Bot.Types.Enums.ParseMode> | parseMode | Mode for parsing entities in the new caption. See formatting options for more details |
System.Nullable<IEnumerable<Telegram.Bot.Types.MessageEntity>> | entities | List of special entities that appear in message text, which can be specified instead of Telegram.Bot.Types.Enums.ParseMode |
System.Nullable<System.Boolean> | disableWebPagePreview | Disables link previews for links in this message |
Telegram.Bot.Types.ReplyMarkups.InlineKeyboardMarkup | replyMarkup | Additional interface options. An Telegram.Bot.Types.ReplyMarkups.InlineKeyboardMarkup, Telegram.Bot.Types.ReplyMarkups.ReplyKeyboardMarkup, instructions to Telegram.Bot.Types.ReplyMarkups.ReplyKeyboardRemove or to Telegram.Bot.Types.ReplyMarkups.ForceReplyMarkup from the user |
CancellationToken | cancellationToken | A cancellation token that can be used by other objects or threads to receive notice of cancellation |
Returns
Type | Description |
---|---|
Task |
EditMessageTextAsync(String, Nullable<ParseMode>, Nullable<IEnumerable<MessageEntity>>, Nullable<Boolean>, InlineKeyboardMarkup, CancellationToken)
Use this method to edit text and game messages.
Declaration
public Task<Message> EditMessageTextAsync(string text, ParseMode? parseMode = null, IEnumerable<MessageEntity>? entities = null, bool? disableWebPagePreview = null, InlineKeyboardMarkup replyMarkup = null, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | text | New text of the message, 1-4096 characters after entities parsing |
System.Nullable<Telegram.Bot.Types.Enums.ParseMode> | parseMode | Mode for parsing entities in the new caption. See formatting options for more details |
System.Nullable<IEnumerable<Telegram.Bot.Types.MessageEntity>> | entities | List of special entities that appear in message text, which can be specified instead of Telegram.Bot.Types.Enums.ParseMode |
System.Nullable<System.Boolean> | disableWebPagePreview | Disables link previews for links in this message |
Telegram.Bot.Types.ReplyMarkups.InlineKeyboardMarkup | replyMarkup | Additional interface options. An Telegram.Bot.Types.ReplyMarkups.InlineKeyboardMarkup, Telegram.Bot.Types.ReplyMarkups.ReplyKeyboardMarkup, instructions to Telegram.Bot.Types.ReplyMarkups.ReplyKeyboardRemove or to Telegram.Bot.Types.ReplyMarkups.ForceReplyMarkup from the user |
CancellationToken | cancellationToken | A cancellation token that can be used by other objects or threads to receive notice of cancellation |
Returns
Type | Description |
---|---|
Task<Telegram.Bot.Types.Message> | On success the edited Telegram.Bot.Types.Message is returned. |
ExitFromStateAsync()
Declaration
public Task ExitFromStateAsync()
Returns
Type | Description |
---|---|
Task |
HandlePreExecution(HandlerInfoBase)
Method calls before handler called
Declaration
public virtual Task HandlePreExecution(HandlerInfoBase info)
Parameters
Type | Name | Description |
---|---|---|
HandlerInfoBase | info | CommandInfo, ActionInfo, StateInfo or CallbackQueryHandlerInfo instance |
Returns
Type | Description |
---|---|
Task |
ReplyAsync(String, Nullable<Int32>, Nullable<ParseMode>, Nullable<IEnumerable<MessageEntity>>, Nullable<Boolean>, Nullable<Boolean>, Nullable<Boolean>, Nullable<Int32>, Nullable<Boolean>, IReplyMarkup, CancellationToken)
Replays with message to the chat from context
Declaration
public Task<Message> ReplyAsync(string text, int? messageThreadId = null, ParseMode? parseMode = null, IEnumerable<MessageEntity>? entities = null, bool? disableWebPagePreview = null, bool? disableNotification = null, bool? protectContent = null, int? replyToMessageId = null, bool? allowSendingWithoutReply = null, IReplyMarkup replyMarkup = null, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | text | Text of the message to be sent, 1-4096 characters after entities parsing |
System.Nullable<System.Int32> | messageThreadId | Unique identifier for the target message thread (topic) of the forum; for forum supergroups only |
System.Nullable<Telegram.Bot.Types.Enums.ParseMode> | parseMode | Mode for parsing entities in the new caption. See formatting options for more details |
System.Nullable<IEnumerable<Telegram.Bot.Types.MessageEntity>> | entities | List of special entities that appear in message text, which can be specified instead of Telegram.Bot.Types.Enums.ParseMode |
System.Nullable<System.Boolean> | disableWebPagePreview | Disables link previews for links in this message |
System.Nullable<System.Boolean> | disableNotification | Sends the message silently. Users will receive a notification with no sound |
System.Nullable<System.Boolean> | protectContent | Protects the contents of sent messages from forwarding and saving |
System.Nullable<System.Int32> | replyToMessageId | If the message is a reply, ID of the original message |
System.Nullable<System.Boolean> | allowSendingWithoutReply | Pass |
Telegram.Bot.Types.ReplyMarkups.IReplyMarkup | replyMarkup | Additional interface options. An Telegram.Bot.Types.ReplyMarkups.InlineKeyboardMarkup, Telegram.Bot.Types.ReplyMarkups.ReplyKeyboardMarkup, instructions to Telegram.Bot.Types.ReplyMarkups.ReplyKeyboardRemove or to Telegram.Bot.Types.ReplyMarkups.ForceReplyMarkup from the user |
CancellationToken | cancellationToken | A cancellation token that can be used by other objects or threads to receive notice of cancellation |
Returns
Type | Description |
---|---|
Task<Telegram.Bot.Types.Message> | On success, the sent Telegram.Bot.Types.Message is returned. |
UrlFor(Object)
Declaration
public string UrlFor(object parameters = null)
Parameters
Type | Name | Description |
---|---|---|
System.Object | parameters |
Returns
Type | Description |
---|---|
System.String |
UrlFor(String, Object)
Declaration
public string UrlFor(string handler, object parameters = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | handler | |
System.Object | parameters |
Returns
Type | Description |
---|---|
System.String |
UrlFor<TModule>(Object)
Declaration
public string UrlFor<TModule>(object parameters = null)
where TModule : TelegramModule
Parameters
Type | Name | Description |
---|---|---|
System.Object | parameters |
Returns
Type | Description |
---|---|
System.String |
Type Parameters
Name | Description |
---|---|
TModule |
UrlFor<TModule>(String, Object)
Declaration
public string UrlFor<TModule>(string handler, object parameters = null)
where TModule : TelegramModule
Parameters
Type | Name | Description |
---|---|---|
System.String | handler | |
System.Object | parameters |
Returns
Type | Description |
---|---|
System.String |
Type Parameters
Name | Description |
---|---|
TModule |