示例#1
0
        public DiscordWrapper(IOptions <DiscordConfig> options, IServiceProvider services,
                              CommandConfigurator configurator, ILoggerFactory loggerFactory)
        {
            DiscordConfig optionsConfig = options.Value;
            var           config        = new DiscordConfiguration()
            {
                LoggerFactory = loggerFactory,
                Token         = optionsConfig.Token,
                TokenType     = TokenType.Bot,
                Intents       = DiscordIntents.All
            };

            Client = new DiscordClient(config);

            CommandsNextConfiguration cConfig = new()
            {
                Services = services, StringPrefixes = optionsConfig.Prefixes, EnableDms = true
            };

            Commands = Client.UseCommandsNext(cConfig);

            InteractivityConfiguration iConfig = new InteractivityConfiguration()
            {
                PollBehaviour = PollBehaviour.KeepEmojis, Timeout = TimeSpan.FromSeconds(30)
            };

            Interactivity = Client.UseInteractivity(iConfig);

            Client.Logger.LogInformation("Starting with secret: {0}", options.Value.Token);
        }
    }
示例#2
0
 public DiscordBot(DiscordWrapper discordWrapper, ReactionHandler reactionHandler,
                   CommandConfigurator configurator, IVoiceManager voiceManager)
 {
     _discordWrapper  = discordWrapper;
     _reactionHandler = reactionHandler;
     _configurator    = configurator;
     _voiceManager    = voiceManager;
 }
示例#3
0
 public DiscordBot(DiscordWrapper discordWrapper, EventHandler.EventHandler eventHandler,
                   CommandConfigurator configurator, IVoiceManager voiceManager)
 {
     _discordWrapper = discordWrapper;
     _eventHandler   = eventHandler;
     _configurator   = configurator;
     _voiceManager   = voiceManager;
 }