Example #1
0
        public SoundboardBot(SoundboardBotConfiguration cfg)
        {
            Configuration         = cfg ?? new SoundboardBotConfiguration();
            SoundEffectRepository = new SoundboardEffectRepository();
            SoundEffectRepository.LoadFromDirectory(Configuration.EffectsPath);

            Database = new SoundboardDatabase(new SoundboardDatabaseConfiguration()
            {
                Path = Configuration.DatabasePath
            });

            Statistics = new SoundboardStatistics(Database);

            sending = new ManualResetEvent(true);
            save    = CreateSaveTask();

            client = new DiscordClient(x =>
            {
                x.AppName               = Configuration.Name;
                x.MessageCacheSize      = 0;
                x.UsePermissionsCache   = false;
                x.EnablePreUpdateEvents = true;
                x.LogLevel              = LogSeverity.Info;
            });

            client.MessageReceived += OnMessageReceived;
            client.UsingModules();
            client.UsingAudio(x =>
            {
                x.Mode              = AudioMode.Outgoing;
                x.EnableEncryption  = false;
                x.EnableMultiserver = false;
                x.Bitrate           = 128;
                x.BufferLength      = 10000;
            });
        }
Example #2
0
 public SoundboardStatistics(SoundboardDatabase db)
 {
     Database = db;
 }