started work on !m pls
This commit is contained in:
parent
9c4da557c7
commit
99f3d74fd3
29
NadekoBot/Classes/_DataModels/MusicPlaylist.cs
Normal file
29
NadekoBot/Classes/_DataModels/MusicPlaylist.cs
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
using SQLite;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace NadekoBot.Classes._DataModels
|
||||||
|
{
|
||||||
|
internal class MusicPlaylist : IDataModel
|
||||||
|
{
|
||||||
|
[Unique]
|
||||||
|
public string Name { get; set; }
|
||||||
|
public long CreatorId { get; set; }
|
||||||
|
public string CreatorName { get; set; }
|
||||||
|
public List<SongInfo> Songs { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
[System.Serializable]
|
||||||
|
internal class SongInfo
|
||||||
|
{
|
||||||
|
public string Name { get; set; }
|
||||||
|
public string Link { get; set; }
|
||||||
|
public SongType Type { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
internal enum SongType
|
||||||
|
{
|
||||||
|
Local,
|
||||||
|
Radio,
|
||||||
|
Query
|
||||||
|
}
|
||||||
|
}
|
@ -7,6 +7,7 @@ using NadekoBot.Classes.Permissions;
|
|||||||
using NadekoBot.Extensions;
|
using NadekoBot.Extensions;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Timer = System.Timers.Timer;
|
using Timer = System.Timers.Timer;
|
||||||
@ -416,6 +417,32 @@ namespace NadekoBot.Modules
|
|||||||
var currentValue = musicPlayer.ToggleRepeatPlaylist();
|
var currentValue = musicPlayer.ToggleRepeatPlaylist();
|
||||||
await e.Channel.SendMessage($"🎵🔁`Repeat playlist {(currentValue ? "enabled" : "disabled")}`");
|
await e.Channel.SendMessage($"🎵🔁`Repeat playlist {(currentValue ? "enabled" : "disabled")}`");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
cgb.CreateCommand("pls")
|
||||||
|
.Alias("playlistsave")
|
||||||
|
.Description("Saves a playlist under a certain name. Name must be no longer than 20 characters and mustn't contain dashes.\n**Usage**: `!m pls classical1`")
|
||||||
|
.Parameter("name", ParameterType.Unparsed)
|
||||||
|
.Do(async e =>
|
||||||
|
{
|
||||||
|
var name = e.GetArg("name")?.Trim();
|
||||||
|
|
||||||
|
if (string.IsNullOrWhiteSpace(name) ||
|
||||||
|
name.Length > 20 ||
|
||||||
|
name.Contains("-"))
|
||||||
|
return;
|
||||||
|
|
||||||
|
MusicPlayer musicPlayer;
|
||||||
|
if (!MusicPlayers.TryGetValue(e.Server, out musicPlayer))
|
||||||
|
return;
|
||||||
|
|
||||||
|
//to avoid concurrency issues
|
||||||
|
var currentPlaylist = new List<Song>(musicPlayer.Playlist);
|
||||||
|
|
||||||
|
if (!currentPlaylist.Any())
|
||||||
|
return;
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
//cgb.CreateCommand("debug")
|
//cgb.CreateCommand("debug")
|
||||||
// .Description("Does something magical. **BOT OWNER ONLY**")
|
// .Description("Does something magical. **BOT OWNER ONLY**")
|
||||||
// .AddCheck(Classes.Permissions.SimpleCheckers.OwnerOnly())
|
// .AddCheck(Classes.Permissions.SimpleCheckers.OwnerOnly())
|
||||||
|
@ -151,6 +151,7 @@
|
|||||||
<Compile Include="Classes\_DataModels\CurrencyTransactionModel.cs" />
|
<Compile Include="Classes\_DataModels\CurrencyTransactionModel.cs" />
|
||||||
<Compile Include="Classes\_DataModels\Donator.cs" />
|
<Compile Include="Classes\_DataModels\Donator.cs" />
|
||||||
<Compile Include="Classes\_DataModels\IDataModel.cs" />
|
<Compile Include="Classes\_DataModels\IDataModel.cs" />
|
||||||
|
<Compile Include="Classes\_DataModels\MusicPlaylist.cs" />
|
||||||
<Compile Include="Classes\_DataModels\PokeTypes.cs" />
|
<Compile Include="Classes\_DataModels\PokeTypes.cs" />
|
||||||
<Compile Include="Classes\_DataModels\Reminder.cs" />
|
<Compile Include="Classes\_DataModels\Reminder.cs" />
|
||||||
<Compile Include="Classes\_DataModels\RequestModel.cs" />
|
<Compile Include="Classes\_DataModels\RequestModel.cs" />
|
||||||
|
Loading…
Reference in New Issue
Block a user