Exemple #1
0
        public Bot(IServiceProvider serviceProvider)
        {
            _serviceProvider = serviceProvider;

            _client               = _serviceProvider.GetService <DiscordSocketClient>();
            _commands             = _serviceProvider.GetService <CommandService>();
            _logEventHandler      = _serviceProvider.GetService <ILogEventHandler>();
            _messageEventHandler  = _serviceProvider.GetService <IMessageEventHandler>();
            _reactionEventHandler = _serviceProvider.GetService <IReactionEventHandler>();

            AttachEventHandlers();
            RegisterCommandModules();
        }
 public ILogEventHandlerContractToViewHostAdapter(ILogEventHandler contract)
 {
     _contract = contract;
     _handle = new ContractHandle(contract);
 }
Exemple #3
0
 /// <inheritdoc />
 public void UnRegister(ILogEventHandler eventHandler)
 {
     lock (_syncObject) {
         _logHandlers.Remove(eventHandler);
     }
 }
Exemple #4
0
 /// <inheritdoc />
 public void Register(ILogEventHandler eventHandler)
 {
     lock (_syncObject) {
         _logHandlers.Add(eventHandler);
     }
 }