Esempio n. 1
0
 public BotManager(IBotApiProvider apiProvider, IServiceProvider provider, char prefix, bool sendErrorLogToUser)
 {
     _apiProvider        = apiProvider;
     _serviceProvider    = provider;
     _prefix             = prefix;
     _sendErrorLogToUser = sendErrorLogToUser;
     _commandParser      = new CommandParser();
 }
Esempio n. 2
0
        public BotManager Build(IBotApiProvider apiProvider)
        {
            ServiceCollection.AddSingleton(new CommandTypeProvider(_commandTypes, _caseSensitive));

            ServiceProvider serviceProvider = ServiceCollection.BuildServiceProvider();

            return(new BotManager(apiProvider, serviceProvider, _prefix, _sendErrorLogToUser));
        }
Esempio n. 3
0
 public BotManager(IBotApiProvider apiProvider, CommandHandler commandHandler, char prefix, bool sendErrorLogToUser)
 {
     _apiProvider        = apiProvider;
     _prefix             = prefix;
     _sendErrorLogToUser = sendErrorLogToUser;
     _commandParser      = new CommandParser();
     _commandHandler     = commandHandler;
 }
Esempio n. 4
0
        public BotManager Build(IBotApiProvider apiProvider)
        {
            ServiceProvider serviceProvider = ServiceCollection.BuildServiceProvider();
            var             commandHandler  = new CommandHandler(serviceProvider);

            _commands.ForEach(commandHandler.RegisterCommand);
            commandHandler.SetCaseSensitive(_caseSensitive);
            return(new BotManager(apiProvider, commandHandler, _prefix, _sendErrorLogToUser));
        }
Esempio n. 5
0
        public Bot(IBotApiProvider botProvider)
        {
            _botProvider = botProvider;

            _commandHandler = new CommandHandler(new CommandsList());

            _commandHandler.RegisterCommand(new PingCommand());
            _commandHandler.RegisterCommand(new HelpCommand(_commandHandler.GetCommands()));
            _commandHandler.RegisterCommand(new ScheduleCommand());
            _commandHandler.RegisterCommand(new SetGroupCommand());
        }
 public void Send(IBotApiProvider apiProvider, SenderInfo sender)
 {
     if (MediaFile is IBotOnlineFile onlineFile)
     {
         apiProvider.SendOnlineMedia(onlineFile, Text, sender);
     }
     else
     {
         apiProvider.SendMedia(MediaFile, Text, sender);
     }
 }
Esempio n. 7
0
        public QueBot(IBotApiProvider apiProvider /*, ILogger logger*/)
        {
            BotManagerBuilder builder = new BotManagerBuilder()
                                        //.AddLogger(logger)
                                        .SetPrefix('/')
                                        .AddCommand(new AddQueamQueserCommand.Descriptor())
                                        .AddCommand(new AddQueamQueserCommand.Descriptor())
                                        .AddCommand(new CreateQueamCommand.Descriptor())
                                        .AddCommand(new GetQueamsCommand.Descriptor())
                                        .AddCommand(new DeleteQueamCommand.Descriptor())
                                        .AddCommand(new RemoveQueamQueserCommand.Descriptor())
                                        .AddCommand(new CreateQueCommand.Descriptor())
                                        .AddCommand(new DeleteQueCommand.Descriptor())
                                        .AddCommand(new QuePopCommand.Descriptor())
                                        .AddCommand(new QuePushCommand.Descriptor())
                                        .AddCommand(new QueSwapCommand.Descriptor());

            builder.ServiceCollection
            .AddQuewerDatabase();

            _botInstance = builder.Build(apiProvider);
        }
 public void Send(IBotApiProvider apiProvider, SenderInfo sender)
 {
     apiProvider.SendMultipleMedia(MediaFiles, Text, sender);
 }
Esempio n. 9
0
 public void Send(IBotApiProvider apiProvider, SenderInfo sender)
 {
     apiProvider.SendText(Text, sender);
 }
Esempio n. 10
0
 public async Task SendAsync(IBotApiProvider apiProvider, SenderInfo sender)
 {
     await apiProvider.SendMediaAsync(MediaFile, Text, sender);
 }
Esempio n. 11
0
 public async Task SendAsync(IBotApiProvider apiProvider, SenderInfo sender)
 {
     await apiProvider.SendTextMessageAsync(Text, sender);
 }