!m q now takes youtube timestamp. Improved description for translate command
This commit is contained in:
parent
9d10d78727
commit
5abd1e8800
@ -260,7 +260,11 @@ namespace NadekoBot.Modules.Music.Classes
|
||||
|
||||
if (video == null) // do something with this error
|
||||
throw new Exception("Could not load any video elements based on the query.");
|
||||
return new Song(new SongInfo
|
||||
var m = Regex.Match(query, @"\?t=(?<t>\d*)");
|
||||
int gotoTime = 0;
|
||||
if (m.Captures.Count > 0)
|
||||
int.TryParse(m.Groups["t"].ToString(), out gotoTime);
|
||||
var song = new Song(new SongInfo
|
||||
{
|
||||
Title = video.Title.Substring(0, video.Title.Length - 10), // removing trailing "- You Tube"
|
||||
Provider = "YouTube",
|
||||
@ -268,6 +272,8 @@ namespace NadekoBot.Modules.Music.Classes
|
||||
Query = link,
|
||||
ProviderType = musicType,
|
||||
});
|
||||
song.SkipTo = gotoTime;
|
||||
return song;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -13,7 +13,8 @@ namespace NadekoBot.Modules.Translator
|
||||
internal override void Init(CommandGroupBuilder cgb)
|
||||
{
|
||||
cgb.CreateCommand(Module.Prefix + "trans")
|
||||
.Description("Translates from>to text. From the given language to the destiation language.")
|
||||
.Alias(Module.Prefix + "translate")
|
||||
.Description($"Translates from>to text. From the given language to the destiation language.\n**Usage**: {Module.Prefix}trans en>fr Hello")
|
||||
.Parameter("langs", ParameterType.Required)
|
||||
.Parameter("text", ParameterType.Unparsed)
|
||||
.Do(TranslateFunc());
|
||||
|
Loading…
Reference in New Issue
Block a user