Пример #1
0
        // Public members

        public LoggingService(DiscordSocketClient discordClient, global::Discord.Commands.CommandService commands, ILoggerFactory loggerFactory)
        {
            _loggerFactory = loggerFactory;

            discordClient.Log += LogDiscordAsync;
            commands.Log      += LogCommandAsync;
        }
Пример #2
0
        // Public members

        public HelpService(
            IBotConfiguration botConfiguration,
            IServiceProvider serviceProvider,
            global::Discord.Commands.CommandService commandService
            )
        {
            _botConfiguration = botConfiguration;
            _serviceProvider  = serviceProvider;
            _commandService   = commandService;
        }
        // Public members

        public OurFoodChainBotCommandHandlingService(
            IOfcBotConfiguration configuration,
            IServiceProvider serviceProvider,
            IHelpService helpService,
            IResponsiveMessageService responsiveMessageService,
            DiscordSocketClient discordClient,
            global::Discord.Commands.CommandService commandService
            ) :
            base(configuration, serviceProvider, helpService, responsiveMessageService, discordClient, commandService)
        {
            botConfiguration = configuration;
        }
Пример #4
0
        public CommandService(
            IBotConfiguration configuration,
            IServiceProvider serviceProvider,
            IHelpService helpService,
            IResponsiveMessageService responsiveMessageService,
            DiscordSocketClient discordClient,
            global::Discord.Commands.CommandService commandService
            )
        {
            this.configuration            = configuration;
            this.serviceProvider          = serviceProvider;
            this.helpService              = helpService;
            this.responsiveMessageService = responsiveMessageService;
            this.discordClient            = discordClient;
            DiscordCommandService         = commandService;

            this.discordClient.MessageReceived    += OnMessageReceivedAsync;
            DiscordCommandService.CommandExecuted += OnCommandExecutedAsync;
        }
Пример #5
0
        protected virtual async Task InitializeServicesAsync(IServiceProvider serviceProvider)
        {
            serviceProvider.GetRequiredService <ILoggingService>(); // instantiate the logging service

            global::Discord.Commands.CommandService discordCommandService = serviceProvider.GetRequiredService <global::Discord.Commands.CommandService>();

            if (discordCommandService != null)
            {
                discordCommandService.Log += OnLogAsync;
            }

            ICommandService commandService = serviceProvider.GetRequiredService <ICommandService>();

            if (commandService != null)
            {
                commandService.Log += OnLogAsync;

                await commandService.InitializeAsync(serviceProvider);
            }
        }