Beispiel #1
0
        public async Task TestInitialize()
        {
            _context.WriteLine("Initializing.");

            _random = new Random();

            _hostBot     = new DiscordSocketClient(_hostToken);
            _targetBot   = new DiscordSocketClient(_targetToken);
            _observerBot = new DiscordSocketClient(_observerToken);

            await _hostBot.Login();

            await Task.Delay(3000);

            //Cleanup existing Guilds
            (await _hostBot.GetGuilds()).Select(x => x.Owner.Id == _hostBot.CurrentUser.Id ? x.Delete() : x.Leave());

            //Create new Guild and invite the other bots to it

            _testGuild = await _hostBot.CreateGuild("Discord.Net Testing", _hostBot.GetOptimalVoiceRegion());

            await Task.Delay(1000);

            PublicInvite invite = await _testGuild.CreateInvite(60, 3, false, false);

            _testGuildInvite = invite;

            _context.WriteLine($"Host: {_hostBot.CurrentUser.Username} in {(await _hostBot.GetGuilds()).Count()}");
        }