Music errors. .byemsg added, better descriptions
This commit is contained in:
parent
205ea071ce
commit
aff95918e2
@ -374,6 +374,17 @@ namespace NadekoBot.Modules
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
cgb.CreateCommand(".greetmsg")
|
||||||
|
.Description("Sets a new announce message. Type %user% if you want to mention the new member.\n**Usage**: .greetmsg Welcome to the server, %user%.")
|
||||||
|
.Parameter("msg", ParameterType.Unparsed)
|
||||||
|
.Do(async e => {
|
||||||
|
if (e.User.Id != NadekoBot.OwnerID) return;
|
||||||
|
|
||||||
|
if (e.GetArg("msg") == null) return;
|
||||||
|
announceMsg = e.GetArg("msg");
|
||||||
|
await e.Send("New greet message set.");
|
||||||
|
});
|
||||||
|
|
||||||
cgb.CreateCommand(".bye")
|
cgb.CreateCommand(".bye")
|
||||||
.Description("Enables or Disables anouncements on the current channel when someone leaves the server.")
|
.Description("Enables or Disables anouncements on the current channel when someone leaves the server.")
|
||||||
.Do(async e => {
|
.Do(async e => {
|
||||||
@ -393,15 +404,15 @@ namespace NadekoBot.Modules
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
cgb.CreateCommand(".greetmsg")
|
cgb.CreateCommand(".byemsg")
|
||||||
.Description("Sets a new announce message. Type %user% if you want to mention the new member.\n**Usage**: .greetmsg Welcome to the server, %user%.")
|
.Description("Sets a new announce leave message. Type %user% if you want to mention the new member.\n**Usage**: .byemsg %user% has left the server.")
|
||||||
.Parameter("msg", ParameterType.Unparsed)
|
.Parameter("msg", ParameterType.Unparsed)
|
||||||
.Do(async e => {
|
.Do(async e => {
|
||||||
if (e.User.Id != NadekoBot.OwnerID) return;
|
if (e.User.Id != NadekoBot.OwnerID) return;
|
||||||
|
|
||||||
if (e.GetArg("msg") == null) return;
|
if (e.GetArg("msg") == null) return;
|
||||||
announceMsg = e.GetArg("msg");
|
announceLeaveMsg = e.GetArg("msg");
|
||||||
await e.Send("New message set.");
|
await e.Send("New bye message set.");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ using System.IO;
|
|||||||
using Discord;
|
using Discord;
|
||||||
using Discord.Audio;
|
using Discord.Audio;
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
using VideoLibrary;
|
using YoutubeExtractor;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using Discord.Legacy;
|
using Discord.Legacy;
|
||||||
@ -90,9 +90,6 @@ namespace NadekoBot.Modules {
|
|||||||
.Alias("pause")
|
.Alias("pause")
|
||||||
.Description("Pauses the song")
|
.Description("Pauses the song")
|
||||||
.Do(async e => {
|
.Do(async e => {
|
||||||
/*if (CurrentSong != null) {
|
|
||||||
CurrentSong.
|
|
||||||
}*/
|
|
||||||
await e.Send("Not yet implemented.");
|
await e.Send("Not yet implemented.");
|
||||||
});
|
});
|
||||||
cgb.CreateCommand("q")
|
cgb.CreateCommand("q")
|
||||||
@ -126,7 +123,9 @@ namespace NadekoBot.Modules {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async Task LoadNextSong() {
|
private async Task LoadNextSong() {
|
||||||
if (SongQueue.Count == 0) {
|
if (SongQueue.Count == 0 || !SongQueue[0].LinkResolved) {
|
||||||
|
if (CurrentSong != null)
|
||||||
|
CurrentSong.Cancel();
|
||||||
CurrentSong = null;
|
CurrentSong = null;
|
||||||
await Task.Delay(200);
|
await Task.Delay(200);
|
||||||
return;
|
return;
|
||||||
@ -141,7 +140,8 @@ namespace NadekoBot.Modules {
|
|||||||
enum StreamTaskState {
|
enum StreamTaskState {
|
||||||
Queued,
|
Queued,
|
||||||
Playing,
|
Playing,
|
||||||
Completed
|
Completed,
|
||||||
|
NotReady
|
||||||
}
|
}
|
||||||
|
|
||||||
class StreamRequest {
|
class StreamRequest {
|
||||||
@ -159,7 +159,7 @@ namespace NadekoBot.Modules {
|
|||||||
public TimeSpan Length = TimeSpan.FromSeconds(0);
|
public TimeSpan Length = TimeSpan.FromSeconds(0);
|
||||||
public string FileName;
|
public string FileName;
|
||||||
|
|
||||||
bool linkResolved;
|
public bool LinkResolved = false;
|
||||||
public string StreamUrl;
|
public string StreamUrl;
|
||||||
public bool NetworkDone;
|
public bool NetworkDone;
|
||||||
public long TotalSourceBytes;
|
public long TotalSourceBytes;
|
||||||
@ -191,25 +191,26 @@ namespace NadekoBot.Modules {
|
|||||||
void ResolveLink() {
|
void ResolveLink() {
|
||||||
var query = RequestText;
|
var query = RequestText;
|
||||||
try {
|
try {
|
||||||
var video = YouTube.Default.GetAllVideos(Searches.FindYoutubeUrlByKeywords(query))
|
var video = DownloadUrlResolver.GetDownloadUrls(Searches.FindYoutubeUrlByKeywords(query))
|
||||||
.Where(v => v.AdaptiveKind == AdaptiveKind.Audio)
|
.Where(v => v.AdaptiveType == AdaptiveType.Audio)
|
||||||
.OrderByDescending(v => v.AudioBitrate).FirstOrDefault();
|
.OrderByDescending(v => v.AudioBitrate).FirstOrDefault();
|
||||||
|
|
||||||
if (video == null)
|
if (video == null)
|
||||||
throw new Exception("Could not load any video elements"); // First one
|
throw new Exception("Could not load any video elements"); // First one
|
||||||
|
|
||||||
StreamUrl = video.Uri;
|
StreamUrl = video.DownloadUrl;
|
||||||
Title = video.Title;
|
Title = video.Title;
|
||||||
var fileName = Title.Replace("\\","_").Replace("/","_");
|
string invalidChars = new string(Path.GetInvalidFileNameChars()) + new string(Path.GetInvalidPathChars());
|
||||||
Path.GetInvalidPathChars().ForEach(c => { fileName = fileName.Replace(c, '_'); });
|
foreach (char c in invalidChars) {
|
||||||
FileName = fileName;
|
FileName = FileName.Replace(c.ToString(), "_");
|
||||||
|
}
|
||||||
|
|
||||||
StartBuffering();
|
StartBuffering();
|
||||||
linkResolved = true;
|
LinkResolved = true;
|
||||||
Channel.Send(":musical_note: **Queued** " + video.FullName);
|
Channel.Send(":musical_note: **Queued** " + video.Title);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// Send a message to the guy that queued that
|
// Send a message to the guy that queued that
|
||||||
Channel.SendMessage(":warning: The url is corrupted somehow...");
|
Channel.SendMessage(":warning: Something went wrong...");
|
||||||
Console.WriteLine("Cannot parse youtube url: " + query);
|
Console.WriteLine("Cannot parse youtube url: " + query);
|
||||||
Cancel();
|
Cancel();
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,7 @@ namespace NadekoBot.Modules {
|
|||||||
});
|
});
|
||||||
|
|
||||||
cgb.CreateCommand("bind")
|
cgb.CreateCommand("bind")
|
||||||
.Description("Bind a trello bot to a certain channel. Bot will operate only in 1 channel at a time")
|
.Description("Bind a trello bot to a single channel. You will receive notifications from your board when somethign is added or edited.")
|
||||||
.Parameter("board_id", Discord.Commands.ParameterType.Required)
|
.Parameter("board_id", Discord.Commands.ParameterType.Required)
|
||||||
.Do(async e => {
|
.Do(async e => {
|
||||||
if (e.User.Id != NadekoBot.OwnerID) return;
|
if (e.User.Id != NadekoBot.OwnerID) return;
|
||||||
|
@ -12,21 +12,20 @@
|
|||||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||||
<FileAlignment>512</FileAlignment>
|
<FileAlignment>512</FileAlignment>
|
||||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||||
<IsWebBootstrapper>true</IsWebBootstrapper>
|
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||||
<PublishUrl>C:\Users\Master\Desktop\NadekoBot\</PublishUrl>
|
<PublishUrl>C:\Users\Master\Desktop\NadekoBot\</PublishUrl>
|
||||||
<Install>true</Install>
|
<Install>true</Install>
|
||||||
<InstallFrom>Web</InstallFrom>
|
<InstallFrom>Disk</InstallFrom>
|
||||||
<UpdateEnabled>true</UpdateEnabled>
|
<UpdateEnabled>false</UpdateEnabled>
|
||||||
<UpdateMode>Foreground</UpdateMode>
|
<UpdateMode>Foreground</UpdateMode>
|
||||||
<UpdateInterval>7</UpdateInterval>
|
<UpdateInterval>7</UpdateInterval>
|
||||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||||
<UpdatePeriodically>false</UpdatePeriodically>
|
<UpdatePeriodically>false</UpdatePeriodically>
|
||||||
<UpdateRequired>false</UpdateRequired>
|
<UpdateRequired>false</UpdateRequired>
|
||||||
<MapFileExtensions>true</MapFileExtensions>
|
<MapFileExtensions>true</MapFileExtensions>
|
||||||
<InstallUrl>http://www.github.com/Kwoth/NadekoBot/</InstallUrl>
|
|
||||||
<CreateWebPageOnPublish>true</CreateWebPageOnPublish>
|
|
||||||
<WebPage>publish.htm</WebPage>
|
<WebPage>publish.htm</WebPage>
|
||||||
<ApplicationRevision>1</ApplicationRevision>
|
<AutorunEnabled>true</AutorunEnabled>
|
||||||
|
<ApplicationRevision>2</ApplicationRevision>
|
||||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||||
<UseApplicationTrust>false</UseApplicationTrust>
|
<UseApplicationTrust>false</UseApplicationTrust>
|
||||||
<PublishWizardCompleted>true</PublishWizardCompleted>
|
<PublishWizardCompleted>true</PublishWizardCompleted>
|
||||||
@ -64,10 +63,6 @@
|
|||||||
<SignManifests>true</SignManifests>
|
<SignManifests>true</SignManifests>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="libvideo, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\packages\VideoLibrary.1.3.1\lib\portable-net45+win+wpa81+MonoAndroid10+xamarinios10+MonoTouch10\libvideo.dll</HintPath>
|
|
||||||
<Private>True</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Manatee.Json, Version=1.0.0.0, Culture=neutral, PublicKeyToken=c267f67a39449c62, processorArchitecture=MSIL">
|
<Reference Include="Manatee.Json, Version=1.0.0.0, Culture=neutral, PublicKeyToken=c267f67a39449c62, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Manatee.Json.3.2.1\lib\net45\Manatee.Json.dll</HintPath>
|
<HintPath>..\packages\Manatee.Json.3.2.1\lib\net45\Manatee.Json.dll</HintPath>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
@ -129,6 +124,10 @@
|
|||||||
<HintPath>..\packages\taglib.2.1.0.0\lib\taglib-sharp.dll</HintPath>
|
<HintPath>..\packages\taglib.2.1.0.0\lib\taglib-sharp.dll</HintPath>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="YoutubeExtractor, Version=0.10.10.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\YoutubeExtractor.0.10.10\lib\net35\YoutubeExtractor.dll</HintPath>
|
||||||
|
<Private>True</Private>
|
||||||
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Classes\SParser.cs" />
|
<Compile Include="Classes\SParser.cs" />
|
||||||
|
@ -12,4 +12,6 @@
|
|||||||
<package id="RestSharp" version="105.2.3" targetFramework="net452" />
|
<package id="RestSharp" version="105.2.3" targetFramework="net452" />
|
||||||
<package id="taglib" version="2.1.0.0" targetFramework="net452" />
|
<package id="taglib" version="2.1.0.0" targetFramework="net452" />
|
||||||
<package id="VideoLibrary" version="1.3.1" targetFramework="net452" />
|
<package id="VideoLibrary" version="1.3.1" targetFramework="net452" />
|
||||||
|
<package id="VideoLibrary.Compat" version="1.3.3" targetFramework="net452" />
|
||||||
|
<package id="YoutubeExtractor" version="0.10.10" targetFramework="net452" />
|
||||||
</packages>
|
</packages>
|
Loading…
Reference in New Issue
Block a user