<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
using DSharpPlus.CommandsNext;
using DSharpPlus.CommandsNext.Exceptions;
//using DSharpPlus.VoiceNext;
using DSharpPlus.Interactivity;

namespace DSharpPlus.Test
{
    internal sealed class TestBot
    {
        private TestBotConfig Config { get; }
        public DiscordClient Discord;
        private TestBotCommands Commands { get; }
        //private VoiceNextClient VoiceService { get; }
        private CommandsNextModule CommandsNextService { get; }
        private InteractivityModule InteractivityService { get; }
        private Timer GameGuard { get; set; }

        public TestBot(TestBotConfig cfg, int shardid)
        {
            // global bot config
            this.Config = cfg;

            // discord instance config and the instance itself
            var dcfg = new DiscordConfig
            {
                AutoReconnect = true,
                DiscordBranch = Branch.Stable,
                LargeThreshold = 250, 
                LogLevel = LogLevel.Unnecessary,
                Token = this.Config.Token,
                TokenType = TokenType.Bot,
                UseInternalLogHandler = false,
                ShardId = shardid,
                ShardCount = this.Config.ShardCount,
                GatewayVersion = 5
            };
            Discord = new DiscordClient(dcfg);

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

            // voice config and the voice service itself
            /*var vcfg = new VoiceNextConfiguration
            {
                VoiceApplication = VoiceNext.Codec.VoiceApplication.Music
            };
            this.VoiceService = this.Discord.UseVoiceNext(vcfg);*/

            // commandsnext config and the commandsnext service itself
            var cncfg = new CommandsNextConfiguration
            {
                Prefix = this.Config.CommandPrefix,
                EnableDms = true,
                EnableMentionPrefix = true
            };
            this.CommandsNextService = Discord.UseCommandsNext(cncfg);
            this.CommandsNextService.CommandErrored += this.CommandsNextService_CommandErrored;
            this.CommandsNextService.CommandExecuted += this.CommandsNextService_CommandExecuted;<commit_msg>Fixed missing voice activation in test bot.<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using DSharpPlus.CommandsNext;
using DSharpPlus.CommandsNext.Exceptions;
using DSharpPlus.Interactivity;
using DSharpPlus.VoiceNext;

namespace DSharpPlus.Test
{
    internal sealed class TestBot
    {
        private TestBotConfig Config { get; }
        public DiscordClient Discord;
        private TestBotCommands Commands { get; }
        private VoiceNextClient VoiceService { get; }
        private CommandsNextModule CommandsNextService { get; }
        private InteractivityModule InteractivityService { get; }
        private Timer GameGuard { get; set; }

        public TestBot(TestBotConfig cfg, int shardid)
        {
            // global bot config
            this.Config = cfg;

            // discord instance config and the instance itself
            var dcfg = new DiscordConfig
            {
                AutoReconnect = true,
                DiscordBranch = Branch.Stable,
                LargeThreshold = 250, 
                LogLevel = LogLevel.Unnecessary,
                Token = this.Config.Token,
                TokenType = TokenType.Bot,
                UseInternalLogHandler = false,
                ShardId = shardid,
                ShardCount = this.Config.ShardCount,
                GatewayVersion = 5
            };
            Discord = new DiscordClient(dcfg);

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

            // voice config and the voice service itself
            var vcfg = new VoiceNextConfiguration
            {
                VoiceApplication = VoiceNext.Codec.VoiceApplication.Music
            };
            this.VoiceService = this.Discord.UseVoiceNext(vcfg);

            // commandsnext config and the commandsnext service itself
            var cncfg = new CommandsNextConfiguration
            {
                Prefix = this.Config.CommandPrefix,
                EnableDms = true,
                EnableMentionPrefix = true
            };
            this.CommandsNextService = Discord.UseCommandsNext(cncfg);
            this.CommandsNextService.CommandErrored += this.CommandsNextService_CommandErrored;
            this.CommandsNextService.CommandExecuted += this.CommandsNextService_CommandExecuted;
{'fraction_non_alphanumeric': 0.06522485410230003, 'fraction_numerical': 0.0013731548232063166, 'mean_word_length': 2.1412398921832883, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6243059', 'n_tokens_mistral': 1472, 'n_tokens_neox': 1419, 'n_words': 311}