Example #1
0
 /// <summary>
 ///     Changes the current volume and updates <see cref="Volume" />.
 /// </summary>
 public async Task UpdateVolumeAsync(ushort volume)
 {
     Volume = volume;
     var payload = new VolumePayload(VoiceChannel.GuildId, volume);
     await _lavaSocket.SendAsync(payload)
     .ConfigureAwait(false);
 }
Example #2
0
        /// <summary>
        /// Updates <see cref="LavaPlayer"/> volume and updates <see cref="CurrentVolume"/>.
        /// </summary>
        /// <param name="volume">Volume may range from 0 to 1000. 100 is default.</param>
        public Task SetVolumeAsync(int volume)
        {
            if (volume > 1000)
            {
                throw new ArgumentOutOfRangeException($"{nameof(volume)} was greater than max limit which is 1000.");
            }

            this.CurrentVolume = volume;
            var payload = new VolumePayload(this.VoiceChannel.GuildId, volume);

            return(this._socketHelper.SendPayloadAsync(payload));
        }
Example #3
0
        /// <summary>
        /// Updates <see cref="LavaPlayer"/> volume and updates <see cref="CurrentVolume"/>.
        /// </summary>
        /// <param name="volume">Volume may range from 0 to 1000. 100 is default.</param>
        public Task SetVolumeAsync(int volume)
        {
            if (!IsPlaying)
            {
                throw new InvalidOperationException(InvalidOp);
            }

            if (volume > 1000)
            {
                throw new ArgumentOutOfRangeException($"{nameof(volume)} was greater than max limit which is 1000.");
            }

            CurrentVolume = volume;
            var payload = new VolumePayload(VoiceChannel.GuildId, volume);

            return(_socketHelper.SendPayloadAsync(payload));
        }