Beispiel #1
0
            public async Task <bool> RemoveSong(IMessageChannel chan, List <int> indexs)
            {
                int didRemove = 0;

                indexs = indexs.OrderByDescending(x => x).ToList();
                string songName = null;

                foreach (int i in indexs)
                {
                    if (i == 0)
                    {
                        songName = m_musics[0].title;
                        await Skip(null);

                        didRemove++;
                    }
                    if (i > 0 && i < m_musics.Count)
                    {
                        songName = m_musics[i].title;
                        m_musics.RemoveAt(i);
                        didRemove++;
                    }
                }
                if (didRemove == 1)
                {
                    await chan.SendMessageAsync(Sentences.SongSkipped((chan as ITextChannel).Guild, songName));
                }
                else if (didRemove > 1)
                {
                    await chan.SendMessageAsync(Sentences.SongsSkipped((chan as ITextChannel).Guild, didRemove));
                }
                return(didRemove > 0);
            }
Beispiel #2
0
            public async Task <bool> Skip(IMessageChannel chan)
            {
                if (m_process == null)
                {
                    return(false);
                }
                await chan.SendMessageAsync(Sentences.SongSkipped((chan as ITextChannel).GuildId, m_musics[0].title));

                m_process.Kill();
                return(true);
            }
Beispiel #3
0
 public async Task <bool> RemoveSong(IMessageChannel chan, string name)
 {
     if (m_musics.Any(x => x.title == name))
     {
         int index = m_musics.IndexOf(m_musics.Where(x => x.title == name).First());
         if (index == 0)
         {
             return(await Skip(chan));
         }
         else
         {
             string musicTitle = m_musics[index].title;
             m_musics.RemoveAt(index);
             await chan.SendMessageAsync(Sentences.SongSkipped((chan as ITextChannel).Guild, musicTitle));
         }
         return(true);
     }
     return(false);
 }