예제 #1
0
        public Task StopRadioCommand(CommandEventArgs e)
        {
            if (_stream != null)
            {
                _stream.Stop();
                _stream = null;
            }

            return Task.CompletedTask;
        }
예제 #2
0
        void IModule.Install(ModuleManager manager)
        {
            _manager = manager;
            _client = _manager.Client;
            _stream = null;

            manager.CreateCommands("radio", group =>
            {
                //register radio start command.
                group.CreateCommand("start").
                     Description("Starts the radio.").
                     Do(StartRadioCommand);

                //register radio stop command.
                group.CreateCommand("stop").
                     Description("Stops the radio.").
                     Do(StopRadioCommand);
            });
        }
예제 #3
0
        public async Task StartRadioCommand(CommandEventArgs e)
        {
            if (_stream != null)
            {
                _stream.Stop();
            }

            _stream = new RadioStream(DisConfig.ShoutCast.URL);

            foreach (Server server in Disco.Bot.Client.Servers)
            {
                IAudioClient voiceClient = Disco.Bot.Client.GetService<AudioService>().GetClient(server);

                if (voiceClient != null)
                {
                    _stream.Start(voiceClient);
                    Disco.Bot.Client.SetGame("Radio");
                }
            }

            await e.Channel.SendMessage("Starting radio stream.");
        }