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")
|
||||
.Description("Enables or Disables anouncements on the current channel when someone leaves the server.")
|
||||
.Do(async e => {
|
||||
@ -393,15 +404,15 @@ 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%.")
|
||||
cgb.CreateCommand(".byemsg")
|
||||
.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)
|
||||
.Do(async e => {
|
||||
if (e.User.Id != NadekoBot.OwnerID) return;
|
||||
|
||||
if (e.GetArg("msg") == null) return;
|
||||
announceMsg = e.GetArg("msg");
|
||||
await e.Send("New message set.");
|
||||
announceLeaveMsg = e.GetArg("msg");
|
||||
await e.Send("New bye message set.");
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -11,7 +11,7 @@ using System.IO;
|
||||
using Discord;
|
||||
using Discord.Audio;
|
||||
using System.Collections.Concurrent;
|
||||
using VideoLibrary;
|
||||
using YoutubeExtractor;
|
||||
using System.Threading;
|
||||
using System.Diagnostics;
|
||||
using Discord.Legacy;
|
||||
@ -90,9 +90,6 @@ namespace NadekoBot.Modules {
|
||||
.Alias("pause")
|
||||
.Description("Pauses the song")
|
||||
.Do(async e => {
|
||||
/*if (CurrentSong != null) {
|
||||
CurrentSong.
|
||||
}*/
|
||||
await e.Send("Not yet implemented.");
|
||||
});
|
||||
cgb.CreateCommand("q")
|
||||
@ -126,7 +123,9 @@ namespace NadekoBot.Modules {
|
||||
}
|
||||
|
||||
private async Task LoadNextSong() {
|
||||
if (SongQueue.Count == 0) {
|
||||
if (SongQueue.Count == 0 || !SongQueue[0].LinkResolved) {
|
||||
if (CurrentSong != null)
|
||||
CurrentSong.Cancel();
|
||||
CurrentSong = null;
|
||||
await Task.Delay(200);
|
||||
return;
|
||||
@ -141,7 +140,8 @@ namespace NadekoBot.Modules {
|
||||
enum StreamTaskState {
|
||||
Queued,
|
||||
Playing,
|
||||
Completed
|
||||
Completed,
|
||||
NotReady
|
||||
}
|
||||
|
||||
class StreamRequest {
|
||||
@ -159,7 +159,7 @@ namespace NadekoBot.Modules {
|
||||
public TimeSpan Length = TimeSpan.FromSeconds(0);
|
||||
public string FileName;
|
||||
|
||||
bool linkResolved;
|
||||
public bool LinkResolved = false;
|
||||
public string StreamUrl;
|
||||
public bool NetworkDone;
|
||||
public long TotalSourceBytes;
|
||||
@ -191,25 +191,26 @@ namespace NadekoBot.Modules {
|
||||
void ResolveLink() {
|
||||
var query = RequestText;
|
||||
try {
|
||||
var video = YouTube.Default.GetAllVideos(Searches.FindYoutubeUrlByKeywords(query))
|
||||
.Where(v => v.AdaptiveKind == AdaptiveKind.Audio)
|
||||
var video = DownloadUrlResolver.GetDownloadUrls(Searches.FindYoutubeUrlByKeywords(query))
|
||||
.Where(v => v.AdaptiveType == AdaptiveType.Audio)
|
||||
.OrderByDescending(v => v.AudioBitrate).FirstOrDefault();
|
||||
|
||||
if (video == null)
|
||||
throw new Exception("Could not load any video elements"); // First one
|
||||
|
||||
StreamUrl = video.Uri;
|
||||
StreamUrl = video.DownloadUrl;
|
||||
Title = video.Title;
|
||||
var fileName = Title.Replace("\\","_").Replace("/","_");
|
||||
Path.GetInvalidPathChars().ForEach(c => { fileName = fileName.Replace(c, '_'); });
|
||||
FileName = fileName;
|
||||
string invalidChars = new string(Path.GetInvalidFileNameChars()) + new string(Path.GetInvalidPathChars());
|
||||
foreach (char c in invalidChars) {
|
||||
FileName = FileName.Replace(c.ToString(), "_");
|
||||
}
|
||||
|
||||
StartBuffering();
|
||||
linkResolved = true;
|
||||
Channel.Send(":musical_note: **Queued** " + video.FullName);
|
||||
LinkResolved = true;
|
||||
Channel.Send(":musical_note: **Queued** " + video.Title);
|
||||
} catch (Exception e) {
|
||||
// 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);
|
||||
Cancel();
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ namespace NadekoBot.Modules {
|
||||
});
|
||||
|
||||
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)
|
||||
.Do(async e => {
|
||||
if (e.User.Id != NadekoBot.OwnerID) return;
|
||||
|
@ -12,21 +12,20 @@
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<IsWebBootstrapper>true</IsWebBootstrapper>
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<PublishUrl>C:\Users\Master\Desktop\NadekoBot\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Web</InstallFrom>
|
||||
<UpdateEnabled>true</UpdateEnabled>
|
||||
<InstallFrom>Disk</InstallFrom>
|
||||
<UpdateEnabled>false</UpdateEnabled>
|
||||
<UpdateMode>Foreground</UpdateMode>
|
||||
<UpdateInterval>7</UpdateInterval>
|
||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||
<UpdatePeriodically>false</UpdatePeriodically>
|
||||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<InstallUrl>http://www.github.com/Kwoth/NadekoBot/</InstallUrl>
|
||||
<CreateWebPageOnPublish>true</CreateWebPageOnPublish>
|
||||
<WebPage>publish.htm</WebPage>
|
||||
<ApplicationRevision>1</ApplicationRevision>
|
||||
<AutorunEnabled>true</AutorunEnabled>
|
||||
<ApplicationRevision>2</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<PublishWizardCompleted>true</PublishWizardCompleted>
|
||||
@ -64,10 +63,6 @@
|
||||
<SignManifests>true</SignManifests>
|
||||
</PropertyGroup>
|
||||
<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">
|
||||
<HintPath>..\packages\Manatee.Json.3.2.1\lib\net45\Manatee.Json.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
@ -129,6 +124,10 @@
|
||||
<HintPath>..\packages\taglib.2.1.0.0\lib\taglib-sharp.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</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>
|
||||
<Compile Include="Classes\SParser.cs" />
|
||||
|
@ -12,4 +12,6 @@
|
||||
<package id="RestSharp" version="105.2.3" targetFramework="net452" />
|
||||
<package id="taglib" version="2.1.0.0" 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>
|
Loading…
Reference in New Issue
Block a user