示例#1
0
        public SonequaDiscord(ILogger <SonequaDiscord> logger, SonequaSettings options)
        {
            _logger = logger;

            _discordClient = new DiscordClient(new DiscordConfiguration
            {
                Token                 = options.BotToken,
                TokenType             = TokenType.Bot,
                UseInternalLogHandler = true,
                LogLevel              = DSharpPlus.LogLevel.Debug
            });

            _commands = _discordClient.UseCommandsNext(new CommandsNextConfiguration
            {
                StringPrefix = "!"
            });

            _commands.RegisterCommands <SlapCommand>();

            _discordClient.ConnectAsync().GetAwaiter().GetResult();
            Task.Delay(-1).GetAwaiter().GetResult();
        }
示例#2
0
        public SonequaDiscord(ILogger <SonequaDiscord> logger, SonequaSettings options)
        {
            _logger = logger;

            _discordClient = new DiscordClient(new DiscordConfiguration
            {
                Token           = options.BotToken,
                TokenType       = TokenType.Bot,
                MinimumLogLevel = LogLevel.Debug
            });

            _commands = _discordClient.UseCommandsNext(new CommandsNextConfiguration()
            {
                UseDefaultCommandHandler = false
            });

            InitializeBotCommands();

            _discordClient.MessageCreated += CommandHandler;

            _discordClient.ConnectAsync().GetAwaiter().GetResult();
            Task.Delay(-1).GetAwaiter().GetResult();
        }