/// <summary> /// Creates a new instance of playback data. /// </summary> /// <param name="guild">Guild to track data for.</param> /// <param name="rng">Cryptographically-secure random number generator implementation.</param> /// <param name="lavalink">Lavalink service.</param> /// <param name="redis">Redis service.</param> public GuildMusicData(DiscordGuild guild, CSPRNG rng, LavalinkService lavalink) { this.Guild = guild; this.RNG = rng; this.Lavalink = lavalink; this.Identifier = this.Guild.Id.ToString(CultureInfo.InvariantCulture); this.QueueInternal = new List <MusicItem>(); this.Queue = new ReadOnlyCollection <MusicItem>(this.QueueInternal); }
public void GenerateNonce(Span <byte> target) { if (target.Length != Interop.SodiumNonceSize) { throw new ArgumentException($"Invalid nonce buffer size. Target buffer for the nonce needs to have a capacity of {Interop.SodiumNonceSize} bytes.", nameof(target)); } CSPRNG.GetBytes(Buffer); Buffer.AsSpan().CopyTo(target); }
public FunCommandsModule(CSPRNG rng) { this.RNG = rng; }
/// <summary> /// Creates a new shuffler. /// </summary> /// <param name="rng">Cryptographically-secure random number generator.</param> public Shuffler(CSPRNG rng) { this.RNG = rng; }