コード例 #1
0
        public async Task JoinAudioChannel(IGuild guild, IVoiceChannel target)
        {
            //TODO: Throw exceptions beside returns.
            IAudioClient client;

            if (ConnectedChannels.TryGetValue(guild.Id, out client))
            {
                return;
            }
            if (target.Guild.Id != guild.Id)
            {
                return;
            }

            var audioClient = await target.ConnectAsync();

            if (ConnectedChannels.TryAdd(guild.Id, audioClient))
            {
                LogMessage logMessage = new LogMessage(LogSeverity.Info, "Audio", $"Connected to voice on {guild.Name}.");
                await _logHandler.Handle(logMessage);

                return;
            }
            else
            {
                //Something went wrong
                return;
            }
        }
コード例 #2
0
 private async Task Log(LogMessage log)
 {
     await _logHandler.Handle(log);
 }