Exemplo n.º 1
0
 /// <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);
 }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
 public FunCommandsModule(CSPRNG rng)
 {
     this.RNG = rng;
 }
Exemplo n.º 4
0
 /// <summary>
 /// Creates a new shuffler.
 /// </summary>
 /// <param name="rng">Cryptographically-secure random number generator.</param>
 public Shuffler(CSPRNG rng)
 {
     this.RNG = rng;
 }