Class TelegramModulesService
Service for handling commands, actions and states from registered modules
Inheritance
System.Object
TelegramModulesService
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Assembly: TelegramModularFramework.dll
Syntax
public class TelegramModulesService
Constructors
|
Improve this Doc
View Source
TelegramModulesService(IServiceProvider, ILogger<TelegramModulesService>, TelegramBotUser, IStringSplitter, ITelegramBotClient, IOptions<TelegramModulesConfiguration>, IStateHolder, ICultureInfoUpdater)
Declaration
public TelegramModulesService(IServiceProvider provider, ILogger<TelegramModulesService> logger, TelegramBotUser telegramBotUser, IStringSplitter splitter, ITelegramBotClient client, IOptions<TelegramModulesConfiguration> config, IStateHolder stateHolder, ICultureInfoUpdater cultureInfoUpdater)
Parameters
Properties
|
Improve this Doc
View Source
Commands
Declaration
public Dictionary<string, CommandInfo> Commands { get; }
Property Value
Type |
Description |
Dictionary<System.String, CommandInfo> |
|
|
Improve this Doc
View Source
Modules
List of all loaded modules
Declaration
public List<ModuleInfo> Modules { get; }
Property Value
|
Improve this Doc
View Source
VisibleCommands
List of all visible commands
Declaration
public IEnumerable<CommandInfo> VisibleCommands { get; }
Property Value
Methods
|
Improve this Doc
View Source
AddModule(Type)
Declaration
public void AddModule(Type module)
Parameters
Type |
Name |
Description |
Type |
module |
Type of class inherited from TelegramModule
|
|
Improve this Doc
View Source
AddModule<T>()
Declaration
public void AddModule<T>()
where T : TelegramModule
Type Parameters
|
Improve this Doc
View Source
AddModules(Assembly)
Adds all modules from given assembly.
If assembly is null, the calling assembly is taken.
Declaration
public void AddModules(Assembly assembly = null)
Parameters
Type |
Name |
Description |
System.Reflection.Assembly |
assembly |
Assembly to get modules.
|
|
Improve this Doc
View Source
ChangeStateAsync(Int64, String)
Changes state of user by chatId and path
Declaration
public async Task ChangeStateAsync(long chatId, string path)
Parameters
Type |
Name |
Description |
System.Int64 |
chatId |
Chat Id
|
System.String |
path |
Relative or absolute path
|
Returns
|
Improve this Doc
View Source
HandleUpdateAsync(ITelegramBotClient, Update, CancellationToken)
Handle update from telegram bot api and executes modules
Declaration
public async Task<bool> HandleUpdateAsync(ITelegramBotClient botClient, Update update, CancellationToken cancellationToken)
Parameters
Type |
Name |
Description |
Telegram.Bot.ITelegramBotClient |
botClient |
BotClient from update event
|
Telegram.Bot.Types.Update |
update |
Update object from update event
|
CancellationToken |
cancellationToken |
CancellationToken from update event
|
Returns
Type |
Description |
Task<System.Boolean> |
true if update handled by framework otherwise returns false
|
|
Improve this Doc
View Source
InvokeCallbackHandler(CallbackQueryHandlerInfo, TelegramModule, String, IServiceProvider)
Declaration
public async Task InvokeCallbackHandler(CallbackQueryHandlerInfo callbackQueryHandlerInfo, TelegramModule module, string data, IServiceProvider scoped)
Parameters
Returns
|
Improve this Doc
View Source
SetMyCommands()
Sets list of commands via telegram bot api
See Telegram.Bot.TelegramBotClientExtensions.SetMyCommandsAsync(Telegram.Bot.ITelegramBotClient,System.Collections.Generic.IEnumerable{Telegram.Bot.Types.BotCommand},Telegram.Bot.Types.BotCommandScope,System.String,System.Threading.CancellationToken) for details
Declaration
public async Task SetMyCommands()
Returns
|
Improve this Doc
View Source
UrlFor(Type, Object)
Declaration
public string UrlFor(Type type, object parameters = null)
Parameters
Type |
Name |
Description |
Type |
type |
|
System.Object |
parameters |
|
Returns
Type |
Description |
System.String |
|
|
Improve this Doc
View Source
UrlFor(Type, String, Object)
Declaration
public string UrlFor(Type type, string handler, object parameters = null)
Parameters
Type |
Name |
Description |
Type |
type |
|
System.String |
handler |
|
System.Object |
parameters |
|
Returns
Type |
Description |
System.String |
|
|
Improve this Doc
View Source
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
|
Improve this Doc
View Source
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
Events
|
Improve this Doc
View Source
ActionExecuted
Async event that executes after action executed successfully or not
Declaration
public event Func<ActionInfo, ModuleContext, Result, Task>? ActionExecuted
Event Type
|
Improve this Doc
View Source
CallbackExecuted
Async event that executes after state executed successfully or not
Declaration
public event Func<CallbackQueryHandlerInfo, ModuleContext, Result, Task>? CallbackExecuted
Event Type
|
Improve this Doc
View Source
CommandExecuted
Async event that executes after command executed successfully or not
Declaration
public event Func<CommandInfo, ModuleContext, Result, Task>? CommandExecuted
Event Type
|
Improve this Doc
View Source
StateExecuted
Async event that executes after state executed successfully or not
Declaration
public event Func<StateInfo, ModuleContext, Result, Task>? StateExecuted
Event Type