Start() private method

private Start ( ) : void
return void
        public async Task <(bool res, string output)> Play(CommandContext?ctx = null)
        {
            if (!_discordManager.VoiceChannelJoined())
            {
                if (_discordSettings.Autojoin)
                {
                    await AutoJoin(ctx);
                }
                else
                {
                    return(false, "I can't play, when I'm not in a channel. Please join a channel first, or enable autojoin.");
                }
            }

            var voiceConnection = _discordManager.GetVoiceConnection();

            if (voiceConnection != null)
            {
                _soundPlayer.Start(voiceConnection);
                return(true, "Now playing.");
            }
            else
            {
                _log.Error("Failed to get voice stream, even though Bot should be in voice channel.");
                return(false, "Failed to get Voice output, so I can't play");
            }
        }
Exemplo n.º 2
0
 public void Play(string file)
 {
     player.Stop();
     player.SoundLocation = file;
     player.Start();
 }