Пример #1
0
        public void Add(AudioProvider provider)
        {
            AudioProvider[] tmplt = new AudioProvider[_providers.Length + 1];
            for (int i = 0; i < _providers.Length; i++)
            {
                tmplt[i] = _providers[i];
            }
            tmplt[tmplt.Length - 1] = provider;

            _providers = tmplt;
        }
Пример #2
0
        public AudioPlugin(DezClient client) : base(client, "AudioClient")
        {
            Command = new Command[] { new Command("music", "Plays music", this, (m, args) =>
                {
                    if (m.User.VoiceChannel == null)
                    {
                        return("You have to be in a voice channel to use music commands... dumbo...");
                    }
                    AudioProvider dodis = apcol.GetByChannel(m.User.VoiceChannel, true, _client);
                    return(dodis.Parse(args));
                }) };
            Command[0].SetRequiredRole("DJ");
            apcol = new AudioProviderCollection();

            _client.UsingAudio(x =>
            {
                x.Mode = AudioMode.Outgoing;
            });
        }
Пример #3
0
 public AudioProvider GetByChannel(Channel vc, bool generateNew = false, DezClient client = null)
 {
     for (int i = 0; i < _providers.Length; i++)
     {
         if (_providers[i].channel == vc)
         {
             return(_providers[i]);
         }
     }
     if (generateNew)
     {
         if (client == null)
         {
             throw new ArgumentNullException();
         }
         AudioProvider pr = new AudioProvider(vc, client);
         this.Add(pr);
         return(pr);
     }
     else
     {
         return(null);
     }
 }