コード例 #1
0
        private async Task Run(string[] args)
        {
            var cfg  = new TestBotConfig();
            var json = string.Empty;

            if (!File.Exists("config.json"))
            {
                json = JsonConvert.SerializeObject(cfg);
                File.WriteAllText("config.json", json, new UTF8Encoding(false));
                Console.WriteLine("Config file was not found, a new one was generated. Fill it with proper values and rerun this program");
                Console.ReadKey();

                return;
            }

            json = File.ReadAllText("config.json", new UTF8Encoding(false));
            cfg  = JsonConvert.DeserializeObject <TestBotConfig>(json);

            var tskl = new List <Task>();

            for (var i = 0; i < cfg.ShardCount; i++)
            {
                var bot = new TestBot(cfg, i);
                tskl.Add(bot.RunAsync());
                await Task.Delay(7500);
            }

            await Task.WhenAll(tskl);

            await Task.Delay(-1);
        }
コード例 #2
0
        public static async Task MainAsync(string[] args)
        {
            Console.CancelKeyPress += Console_CancelKeyPress;

            var cfg  = new TestBotConfig();
            var json = string.Empty;

            if (!File.Exists("config.json"))
            {
                json = JsonConvert.SerializeObject(cfg);
                File.WriteAllText("config.json", json, new UTF8Encoding(false));
                Console.WriteLine("Config file was not found, a new one was generated. Fill it with proper values and rerun this program");
                Console.ReadKey();

                return;
            }

            json = File.ReadAllText("config.json", new UTF8Encoding(false));
            cfg  = JsonConvert.DeserializeObject <TestBotConfig>(json);

            var tskl = new List <Task>();

            for (var i = 0; i < cfg.ShardCount; i++)
            {
                var bot = new TestBot(cfg, i);
                Shards.Add(bot);
                tskl.Add(bot.RunAsync());
                await Task.Delay(7500).ConfigureAwait(false);
            }

            await Task.WhenAll(tskl).ConfigureAwait(false);

            try
            {
                await Task.Delay(-1, CancelToken).ConfigureAwait(false);
            }
            catch (Exception) { /* shush */ }
        }
コード例 #3
0
ファイル: TestBot.cs プロジェクト: DSharpPlus/DSharpPlus
        public TestBot(TestBotConfig cfg, int shardid)
        {
            // global bot config
            this.Config = cfg;

            // discord instance config and the instance itself
            var dcfg = new DiscordConfiguration
            {
                AutoReconnect      = true,
                LargeThreshold     = 250,
                MinimumLogLevel    = LogLevel.Trace,
                Token              = this.Config.Token,
                TokenType          = TokenType.Bot,
                ShardId            = shardid,
                ShardCount         = this.Config.ShardCount,
                MessageCacheSize   = 2048,
                LogTimestampFormat = "dd-MM-yyyy HH:mm:ss zzz",
                Intents            = DiscordIntents.All // if 4013 is received, change to DiscordIntents.AllUnprivileged
            };

            this.Discord = new DiscordClient(dcfg);

            // events
            this.Discord.Ready += this.Discord_Ready;
            this.Discord.GuildStickersUpdated += this.Discord_StickersUpdated;
            this.Discord.GuildAvailable       += this.Discord_GuildAvailable;
            //Discord.PresenceUpdated += this.Discord_PresenceUpdated;
            //Discord.ClientErrored += this.Discord_ClientErrored;
            this.Discord.SocketErrored          += this.Discord_SocketError;
            this.Discord.GuildCreated           += this.Discord_GuildCreated;
            this.Discord.VoiceStateUpdated      += this.Discord_VoiceStateUpdated;
            this.Discord.GuildDownloadCompleted += this.Discord_GuildDownloadCompleted;
            this.Discord.GuildUpdated           += this.Discord_GuildUpdated;
            this.Discord.ChannelDeleted         += this.Discord_ChannelDeleted;

            this.Discord.InteractionCreated          += this.Discord_InteractionCreated;
            this.Discord.ComponentInteractionCreated += this.Discord_ModalCheck;
            this.Discord.ModalSubmitted += this.Discord_ModalSubmitted;
            //this.Discord.ComponentInteractionCreated += this.RoleMenu;
            //this.Discord.ComponentInteractionCreated += this.DiscordComponentInteractionCreated;
            //this.Discord.InteractionCreated += this.SendButton;
            // For event timeout testing
            //Discord.GuildDownloadCompleted += async (s, e) =>
            //{
            //    await Task.Delay(TimeSpan.FromSeconds(2)).ConfigureAwait(false);
            //    throw new Exception("Flippin' tables");
            //};

            this.Discord.ThreadCreated        += this.Discord_ThreadCreated;
            this.Discord.ThreadUpdated        += this.Discord_ThreadUpdated;
            this.Discord.ThreadDeleted        += this.Discord_ThreadDeleted;
            this.Discord.ThreadListSynced     += this.Discord_ThreadListSynced;
            this.Discord.ThreadMemberUpdated  += this.Discord_ThreadMemberUpdated;
            this.Discord.ThreadMembersUpdated += this.Discord_ThreadMembersUpdated;

            // voice config and the voice service itself
            var vcfg = new VoiceNextConfiguration
            {
                AudioFormat    = AudioFormat.Default,
                EnableIncoming = true
            };

            this.VoiceService = this.Discord.UseVoiceNext(vcfg);

            // build a dependency collection for commandsnext
            var depco = new ServiceCollection();

            // commandsnext config and the commandsnext service itself
            var cncfg = new CommandsNextConfiguration
            {
                StringPrefixes           = this.Config.CommandPrefixes,
                EnableDms                = true,
                EnableMentionPrefix      = true,
                CaseSensitive            = false,
                Services                 = depco.BuildServiceProvider(true),
                IgnoreExtraArguments     = false,
                UseDefaultCommandHandler = true,
                DefaultParserCulture     = CultureInfo.InvariantCulture,
                //CommandExecutor = new ParallelQueuedCommandExecutor(2),
            };

            this.CommandsNextService = this.Discord.UseCommandsNext(cncfg);
            this.CommandsNextService.CommandErrored  += this.CommandsNextService_CommandErrored;
            this.CommandsNextService.CommandExecuted += this.CommandsNextService_CommandExecuted;
            this.CommandsNextService.RegisterCommands(typeof(TestBot).GetTypeInfo().Assembly);
            this.CommandsNextService.SetHelpFormatter <TestBotHelpFormatter>();

            // interactivity service
            var icfg = new InteractivityConfiguration()
            {
                Timeout = TimeSpan.FromSeconds(10),
                AckPaginationButtons = true,
                ResponseBehavior     = InteractionResponseBehavior.Respond,
                PaginationBehaviour  = PaginationBehaviour.Ignore,
                ResponseMessage      = "Sorry, but this wasn't a valid option, or does not belong to you!",
                PaginationButtons    = new PaginationButtons()
                {
                    Stop      = new DiscordButtonComponent(ButtonStyle.Danger, "stop", null, false, new DiscordComponentEmoji(862259725785497620)),
                    Left      = new DiscordButtonComponent(ButtonStyle.Secondary, "left", null, false, new DiscordComponentEmoji(862259522478800916)),
                    Right     = new DiscordButtonComponent(ButtonStyle.Secondary, "right", null, false, new DiscordComponentEmoji(862259691212242974)),
                    SkipLeft  = new DiscordButtonComponent(ButtonStyle.Primary, "skipl", null, false, new DiscordComponentEmoji(862259605464023060)),
                    SkipRight = new DiscordButtonComponent(ButtonStyle.Primary, "skipr", null, false, new DiscordComponentEmoji(862259654403031050))
                }
            };

            this.InteractivityService = this.Discord.UseInteractivity(icfg);
            this.LavalinkService      = this.Discord.UseLavalink();

            this.SlashCommandService = this.Discord.UseSlashCommands();
            this.SlashCommandService.SlashCommandErrored  += this.SlashCommandService_CommandErrored;
            this.SlashCommandService.SlashCommandInvoked  += this.SlashCommandService_CommandReceived;
            this.SlashCommandService.SlashCommandExecuted += this.SlashCommandService_CommandExecuted;

            if (this.Config.SlashCommandGuild != 0)
            {
                this.SlashCommandService.RegisterCommands(typeof(TestBot).GetTypeInfo().Assembly, this.Config.SlashCommandGuild);
            }

            //this.Discord.MessageCreated += async e =>
            //{
            //    if (e.Message.Author.IsBot)
            //        return;

            //    _ = Task.Run(async () => await e.Message.RespondAsync(e.Message.Content)).ConfigureAwait(false);
            //};
        }
コード例 #4
0
        public TestBot(TestBotConfig cfg, int shardid)
        {
            // global bot config
            this.Config = cfg;

            // discord instance config and the instance itself
            var dcfg = new DiscordConfiguration
            {
                AutoReconnect         = true,
                LargeThreshold        = 250,
                LogLevel              = LogLevel.Debug,
                Token                 = this.Config.Token,
                TokenType             = this.Config.UseUserToken ? TokenType.User : TokenType.Bot,
                UseInternalLogHandler = false,
                ShardId               = shardid,
                ShardCount            = this.Config.ShardCount,
                EnableCompression     = true,
                MessageCacheSize      = 50,
                AutomaticGuildSync    = !this.Config.UseUserToken,
                DateTimeFormat        = "dd-MM-yyyy HH:mm:ss zzz"
            };

            Discord = new DiscordClient(dcfg);

            // events
            Discord.DebugLogger.LogMessageReceived += this.DebugLogger_LogMessageReceived;
            Discord.Ready                   += this.Discord_Ready;
            Discord.GuildAvailable          += this.Discord_GuildAvailable;
            Discord.GuildBanAdded           += this.Discord_GuildBanAdd;
            Discord.MessageCreated          += this.Discord_MessageCreated;
            Discord.MessageReactionAdded    += this.Discord_MessageReactionAdd;
            Discord.MessageReactionsCleared += this.Discord_MessageReactionRemoveAll;
            Discord.PresenceUpdated         += this.Discord_PresenceUpdate;
            Discord.ClientErrored           += this.Discord_ClientErrored;
            Discord.SocketErrored           += this.Discord_SocketError;
            Discord.GuildCreated            += this.Discord_GuildCreated;

            // voice config and the voice service itself
            var vcfg = new VoiceNextConfiguration
            {
                VoiceApplication = VoiceNext.Codec.VoiceApplication.Music,
                EnableIncoming   = false
            };

            this.VoiceService = this.Discord.UseVoiceNext(vcfg);

            // build a dependency collection for commandsnext
            var depco = new DependencyCollectionBuilder();

            depco.AddInstance("This is a dependency string.");
            depco.Add <TestDependency>();

            // commandsnext config and the commandsnext service itself
            var cncfg = new CommandsNextConfiguration
            {
                StringPrefix          = this.Config.CommandPrefix,
                CustomPrefixPredicate = msg =>
                {
                    if (TestBotNextCommands.Prefixes.ContainsKey(msg.Channel.Id) && TestBotNextCommands.Prefixes.TryGetValue(msg.Channel.Id, out var pfix))
                    {
                        return(Task.FromResult(msg.GetStringPrefixLength(pfix)));
                    }
                    return(Task.FromResult(-1));
                },
                EnableDms            = true,
                EnableMentionPrefix  = true,
                CaseSensitive        = true,
                Dependencies         = depco.Build(),
                SelfBot              = this.Config.UseUserToken,
                IgnoreExtraArguments = false
                                       //DefaultHelpChecks = new List<CheckBaseAttribute>() { new RequireOwnerAttribute() }
            };

            this.CommandsNextService = Discord.UseCommandsNext(cncfg);
            this.CommandsNextService.CommandErrored  += this.CommandsNextService_CommandErrored;
            this.CommandsNextService.CommandExecuted += this.CommandsNextService_CommandExecuted;
            //this.CommandsNextService.RegisterCommands<TestBotCommands>();
            //this.CommandsNextService.RegisterCommands<TestBotNextCommands>();
            //this.CommandsNextService.RegisterCommands<TestBotEvalCommands>();
            //this.CommandsNextService.RegisterCommands<TestBotDependentCommands>();
            //this.CommandsNextService.RegisterCommands<TestBotGroupInheritedChecksCommands>();
            this.CommandsNextService.RegisterCommands(typeof(TestBot).GetTypeInfo().Assembly);
            this.CommandsNextService.SetHelpFormatter <TestBotHelpFormatter>();

            // interactivity service
            var icfg = new InteractivityConfiguration()
            {
                PaginationBehaviour = TimeoutBehaviour.Delete,
                PaginationTimeout   = TimeSpan.FromSeconds(30),
                Timeout             = TimeSpan.FromSeconds(30)
            };

            this.InteractivityService = Discord.UseInteractivity(icfg);
        }
コード例 #5
0
        public TestBot(TestBotConfig cfg, int shardid)
        {
            // global bot config
            this.Config = cfg;

            // discord instance config and the instance itself
            var dcfg = new DiscordConfiguration
            {
                AutoReconnect         = true,
                LargeThreshold        = 250,
                LogLevel              = LogLevel.Debug,
                Token                 = this.Config.Token,
                TokenType             = this.Config.UseUserToken ? TokenType.User : TokenType.Bot,
                UseInternalLogHandler = false,
                ShardId               = shardid,
                ShardCount            = this.Config.ShardCount,
                //GatewayCompressionLevel = GatewayCompressionLevel.Stream,
                MessageCacheSize   = 2048,
                AutomaticGuildSync = !this.Config.UseUserToken,
                DateTimeFormat     = "dd-MM-yyyy HH:mm:ss zzz"
            };

            Discord = new DiscordClient(dcfg);

            // events
            Discord.DebugLogger.LogMessageReceived += this.DebugLogger_LogMessageReceived;
            Discord.Ready                  += this.Discord_Ready;
            Discord.GuildAvailable         += this.Discord_GuildAvailable;
            Discord.ClientErrored          += this.Discord_ClientErrored;
            Discord.SocketErrored          += this.Discord_SocketError;
            Discord.GuildCreated           += this.Discord_GuildCreated;
            Discord.VoiceStateUpdated      += this.Discord_VoiceStateUpdated;
            Discord.GuildDownloadCompleted += this.Discord_GuildDownloadCompleted;
            Discord.GuildUpdated           += this.Discord_GuildUpdated;
            Discord.ChannelDeleted         += this.Discord_ChannelDeleted;

            // voice config and the voice service itself
            var vcfg = new VoiceNextConfiguration
            {
                VoiceApplication = VoiceNext.Codec.VoiceApplication.Music,
                EnableIncoming   = false
            };

            this.VoiceService = this.Discord.UseVoiceNext(vcfg);

            // build a dependency collection for commandsnext
            var depco = new ServiceCollection()
                        .AddSingleton(new TestBotService())
                        .AddScoped <TestBotScopedService>();

            // commandsnext config and the commandsnext service itself
            var cncfg = new CommandsNextConfiguration
            {
                StringPrefixes = this.Config.CommandPrefixes,
                //PrefixResolver = msg =>
                //{
                //    if (TestBotCommands.PrefixSettings.ContainsKey(msg.Channel.Id) && TestBotCommands.PrefixSettings.TryGetValue(msg.Channel.Id, out var pfix))
                //        return Task.FromResult(msg.GetStringPrefixLength(pfix));
                //    return Task.FromResult(-1);
                //},
                EnableDms                = true,
                EnableMentionPrefix      = true,
                CaseSensitive            = false,
                Services                 = depco.BuildServiceProvider(true),
                IgnoreExtraArguments     = false,
                UseDefaultCommandHandler = true,
                //DefaultHelpChecks = new List<CheckBaseAttribute>() { new RequireOwnerAttribute() }
            };

            this.CommandsNextService = Discord.UseCommandsNext(cncfg);
            this.CommandsNextService.CommandErrored  += this.CommandsNextService_CommandErrored;
            this.CommandsNextService.CommandExecuted += this.CommandsNextService_CommandExecuted;
            this.CommandsNextService.RegisterCommands(typeof(TestBot).GetTypeInfo().Assembly);
            this.CommandsNextService.SetHelpFormatter <TestBotHelpFormatter>();

            // hook command handler
            //this.Discord.MessageCreated += this.Discord_MessageCreated;

            // interactivity service
            var icfg = new InteractivityConfiguration()
            {
                PaginationBehavior = TimeoutBehaviour.DeleteMessage,
                PaginationTimeout  = TimeSpan.FromSeconds(30),
                Timeout            = TimeSpan.FromSeconds(30)
            };

            this.InteractivityService = Discord.UseInteractivity(icfg);
            this.LavalinkService      = Discord.UseLavalink();
        }
コード例 #6
0
        public TestBot(TestBotConfig cfg, int shardid)
        {
            // global bot config
            this.Config = cfg;

            // discord instance config and the instance itself
            var dcfg = new DiscordConfiguration
            {
                AutoReconnect         = true,
                LargeThreshold        = 250,
                LogLevel              = LogLevel.Debug,
                Token                 = this.Config.Token,
                TokenType             = TokenType.Bot,
                UseInternalLogHandler = false,
                ShardId               = shardid,
                ShardCount            = this.Config.ShardCount,
                MessageCacheSize      = 2048,
                DateTimeFormat        = "dd-MM-yyyy HH:mm:ss zzz"
            };

            Discord = new DiscordClient(dcfg);

            // events
            Discord.DebugLogger.LogMessageReceived += this.DebugLogger_LogMessageReceived;
            Discord.Ready                  += this.Discord_Ready;
            Discord.GuildAvailable         += this.Discord_GuildAvailable;
            Discord.ClientErrored          += this.Discord_ClientErrored;
            Discord.SocketErrored          += this.Discord_SocketError;
            Discord.GuildCreated           += this.Discord_GuildCreated;
            Discord.VoiceStateUpdated      += this.Discord_VoiceStateUpdated;
            Discord.GuildDownloadCompleted += this.Discord_GuildDownloadCompleted;
            Discord.GuildUpdated           += this.Discord_GuildUpdated;
            Discord.ChannelDeleted         += this.Discord_ChannelDeleted;

            // voice config and the voice service itself
            var vcfg = new VoiceNextConfiguration
            {
                AudioFormat    = AudioFormat.Default,
                EnableIncoming = true
            };

            this.VoiceService = this.Discord.UseVoiceNext(vcfg);

            // build a dependency collection for commandsnext
            var depco = new ServiceCollection();

            // commandsnext config and the commandsnext service itself
            var cncfg = new CommandsNextConfiguration
            {
                StringPrefixes           = this.Config.CommandPrefixes,
                EnableDms                = true,
                EnableMentionPrefix      = true,
                CaseSensitive            = false,
                Services                 = depco.BuildServiceProvider(true),
                IgnoreExtraArguments     = false,
                UseDefaultCommandHandler = true,
            };

            this.CommandsNextService = Discord.UseCommandsNext(cncfg);
            this.CommandsNextService.CommandErrored  += this.CommandsNextService_CommandErrored;
            this.CommandsNextService.CommandExecuted += this.CommandsNextService_CommandExecuted;
            this.CommandsNextService.RegisterCommands(typeof(TestBot).GetTypeInfo().Assembly);
            this.CommandsNextService.SetHelpFormatter <TestBotHelpFormatter>();

            // interactivity service
            var icfg = new InteractivityConfiguration()
            {
                Timeout = TimeSpan.FromSeconds(3)
            };

            this.InteractivityService = Discord.UseInteractivity(icfg);
            this.LavalinkService      = Discord.UseLavalink();
        }
コード例 #7
0
ファイル: TestBot.cs プロジェクト: van800/DSharpPlus
        public TestBot(TestBotConfig cfg, int shardid)
        {
            // global bot config
            this.Config = cfg;

            // discord instance config and the instance itself
            var dcfg = new DiscordConfiguration
            {
                AutoReconnect      = true,
                LargeThreshold     = 250,
                MinimumLogLevel    = LogLevel.Debug,
                Token              = this.Config.Token,
                TokenType          = TokenType.Bot,
                ShardId            = shardid,
                ShardCount         = this.Config.ShardCount,
                MessageCacheSize   = 2048,
                LogTimestampFormat = "dd-MM-yyyy HH:mm:ss zzz",
                Intents            = DiscordIntents.All // if 4013 is received, change to DiscordIntents.AllUnprivileged
            };

            Discord = new DiscordClient(dcfg);

            // events
            Discord.Ready           += this.Discord_Ready;
            Discord.GuildAvailable  += this.Discord_GuildAvailable;
            Discord.PresenceUpdated += this.Discord_PresenceUpdated;
            //Discord.ClientErrored += this.Discord_ClientErrored;
            Discord.SocketErrored          += this.Discord_SocketError;
            Discord.GuildCreated           += this.Discord_GuildCreated;
            Discord.VoiceStateUpdated      += this.Discord_VoiceStateUpdated;
            Discord.GuildDownloadCompleted += this.Discord_GuildDownloadCompleted;
            Discord.GuildUpdated           += this.Discord_GuildUpdated;
            Discord.ChannelDeleted         += this.Discord_ChannelDeleted;

            // For event timeout testing
            //Discord.GuildDownloadCompleted += async (s, e) =>
            //{
            //    await Task.Delay(TimeSpan.FromSeconds(2)).ConfigureAwait(false);
            //    throw new Exception("Flippin' tables");
            //};

            // voice config and the voice service itself
            var vcfg = new VoiceNextConfiguration
            {
                AudioFormat    = AudioFormat.Default,
                EnableIncoming = true
            };

            this.VoiceService = this.Discord.UseVoiceNext(vcfg);

            // build a dependency collection for commandsnext
            var depco = new ServiceCollection();

            // commandsnext config and the commandsnext service itself
            var cncfg = new CommandsNextConfiguration
            {
                StringPrefixes           = this.Config.CommandPrefixes,
                EnableDms                = true,
                EnableMentionPrefix      = true,
                CaseSensitive            = false,
                Services                 = depco.BuildServiceProvider(true),
                IgnoreExtraArguments     = false,
                UseDefaultCommandHandler = true,
            };

            this.CommandsNextService = Discord.UseCommandsNext(cncfg);
            this.CommandsNextService.CommandErrored  += this.CommandsNextService_CommandErrored;
            this.CommandsNextService.CommandExecuted += this.CommandsNextService_CommandExecuted;
            this.CommandsNextService.RegisterCommands(typeof(TestBot).GetTypeInfo().Assembly);
            this.CommandsNextService.SetHelpFormatter <TestBotHelpFormatter>();

            // interactivity service
            var icfg = new InteractivityConfiguration()
            {
                Timeout = TimeSpan.FromSeconds(3)
            };

            this.InteractivityService = Discord.UseInteractivity(icfg);
            this.LavalinkService      = Discord.UseLavalink();

            //this.Discord.MessageCreated += async e =>
            //{
            //    if (e.Message.Author.IsBot)
            //        return;

            //    _ = Task.Run(async () => await e.Message.RespondAsync(e.Message.Content)).ConfigureAwait(false);
            //};
        }
コード例 #8
0
        public TestBot(TestBotConfig cfg)
        {
            // global bot config
            this.Config = cfg;

            // discord instance config and the instance itself
            var dcfg = new DiscordConfig
            {
                AutoReconnect  = true,
                DiscordBranch  = Branch.Stable,
                LargeThreshold = 250,
                // Use unnecessary instead of debug for more verbosity
                //LogLevel = LogLevel.Unnecessary,
                LogLevel              = LogLevel.Debug,
                Token                 = this.Config.Token,
                TokenType             = TokenType.Bot,
                UseInternalLogHandler = false,
            };

            this.Discord = new DiscordClient(dcfg);

            // events
            this.Discord.DebugLogger.LogMessageReceived += this.DebugLogger_LogMessageReceived;
            this.Discord.Ready                    += this.Discord_Ready;
            this.Discord.GuildAvailable           += this.Discord_GuildAvailable;
            this.Discord.GuildBanAdd              += this.Discord_GuildBanAdd;
            this.Discord.MessageCreated           += this.Discord_MessageCreated;
            this.Discord.MessageReactionAdd       += this.Discord_MessageReactionAdd;
            this.Discord.MessageReactionRemoveAll += this.Discord_MessageReactionRemoveAll;
            this.Discord.PresenceUpdate           += this.Discord_PresenceUpdate;

            // command config and the command service itself
            this.Commands = new TestBotCommands();
            var ccfg = new CommandConfig
            {
                Prefix  = this.Config.CommandPrefix,
                SelfBot = false
            };

            this.CommandService = this.Discord.UseCommands(ccfg);
            this.CommandService.CommandError += this.CommandService_CommandError;

            // register all commands dynamically
            var t  = new[] { typeof(TestBotCommands), typeof(Task), typeof(CommandEventArgs) };
            var cm = t[0].GetMethods(BindingFlags.Public | BindingFlags.Instance)
                     .Where(xm => this.IsCommandMethod(xm, t[1], t[2]));

            var expr_inst = Expression.Constant(this.Commands);
            var expr_arg0 = Expression.Parameter(t[2]);

            foreach (var xm in cm)
            {
                var expr_call = Expression.Call(expr_inst, xm, expr_arg0);
                var expr_anon = Expression.Lambda <Func <CommandEventArgs, Task> >(expr_call, expr_arg0);
                var cmcall    = expr_anon.Compile();

                this.Discord.AddCommand(xm.Name.ToLower(), cmcall);
                this.Discord.DebugLogger.LogMessage(LogLevel.Info, "DSPlus Test", $"Command {xm.Name.ToLower()} registered", DateTime.Now);
            }

            // voice config and the voice service itself
            var vcfg = new VoiceNextConfiguration
            {
                VoiceApplication = VoiceNext.Codec.VoiceApplication.Music
            };

            this.VoiceService = this.Discord.UseVoiceNext(vcfg);
        }