Beispiel #1
0
        public async Task StopRadio(params string[] _)
        {
            if (Context.Guild == null)
            {
                await ReplyAsync(Base.Sentences.CommandDontPm(Context.Guild));

                return;
            }
            Utilities.CheckAvailability(Context.Guild, Program.Module.Radio);
            await p.DoAction(Context.User, Program.Module.Radio);

            RadioChannel radio = p.radios.Find(x => x.m_guildId == Context.Guild.Id);

            if (radio == null)
            {
                await ReplyAsync(Sentences.RadioNotStarted(Context.Guild));
            }
            else
            {
                await radio.Stop();

                p.radios.Remove(radio);
                await ReplyAsync(Base.Sentences.DoneStr(Context.Guild));
            }
        }
Beispiel #2
0
        public async Task RemoveRadio(params string[] args)
        {
            if (Context.Guild == null)
            {
                await ReplyAsync(Base.Sentences.CommandDontPm(Context.Guild));

                return;
            }
            Utilities.CheckAvailability(Context.Guild, Program.Module.Radio);
            await p.DoAction(Context.User, Program.Module.Radio);

            RadioChannel radio = p.radios.Find(x => x.m_guildId == Context.Guild.Id);

            if (radio == null)
            {
                await ReplyAsync(Sentences.RadioNotStarted(Context.Guild));
            }
            else
            {
                string title = string.Join(" ", args);
                if (await radio.RemoveSong(Context.Channel, title))
                {
                    await ReplyAsync(Base.Sentences.DoneStr(Context.Guild));
                }
                else
                {
                    List <int> indexs = new List <int>();
                    foreach (var str in args)
                    {
                        if (int.TryParse(str, out int res))
                        {
                            if (!indexs.Contains(res))
                            {
                                indexs.Add(res);
                            }
                        }
                        else
                        {
                            indexs = null;
                            break;
                        }
                    }
                    if (indexs == null || !await radio.RemoveSong(Context.Channel, indexs))
                    {
                        await ReplyAsync(Sentences.InvalidSong(Context.Guild));
                    }
                    else
                    {
                        await ReplyAsync(Base.Sentences.DoneStr(Context.Guild));
                    }
                }
            }
        }
Beispiel #3
0
        public async Task ListRadio(params string[] words)
        {
            Utilities.CheckAvailability(Context.Guild.Id, Program.Module.Radio);
            await p.DoAction(Context.User, Context.Guild.Id, Program.Module.Radio);

            if (!p.radios.Any(x => x.m_guildId == Context.Guild.Id))
            {
                await ReplyAsync(Sentences.RadioNotStarted(Context.Guild.Id));
            }
            else
            {
                await ReplyAsync(p.radios.Find(x => x.m_guildId == Context.Guild.Id).GetPlaylist(Context.Guild.Id));
            }
        }
Beispiel #4
0
        public async Task ListRadio(params string[] _)
        {
            if (Context.Guild == null)
            {
                await ReplyAsync(Base.Sentences.CommandDontPm(Context.Guild));

                return;
            }
            Utilities.CheckAvailability(Context.Guild, Program.Module.Radio);
            await p.DoAction(Context.User, Program.Module.Radio);

            if (!p.radios.Any(x => x.m_guildId == Context.Guild.Id))
            {
                await ReplyAsync(Sentences.RadioNotStarted(Context.Guild));
            }
            else
            {
                await ReplyAsync(p.radios.Find(x => x.m_guildId == Context.Guild.Id).GetPlaylist(Context.Guild));
            }
        }
Beispiel #5
0
        public async Task SkipRadio(params string[] words)
        {
            Utilities.CheckAvailability(Context.Guild.Id, Program.Module.Radio);
            await p.DoAction(Context.User, Context.Guild.Id, Program.Module.Radio);

            RadioChannel radio = p.radios.Find(x => x.m_guildId == Context.Guild.Id);

            if (radio == null)
            {
                await ReplyAsync(Sentences.RadioNotStarted(Context.Guild.Id));
            }
            else
            {
                bool suceed = await radio.Skip(Context.Channel);

                if (!suceed)
                {
                    await ReplyAsync(Sentences.RadioNoSong(Context.Guild.Id));
                }
            }
        }