lq, q nicer txt, fixed .prune > 100

This commit is contained in:
Master Kwoth
2016-01-30 12:08:30 +01:00
parent 171d3cd4ab
commit efc2810f22
7 changed files with 73 additions and 47 deletions

View File

@@ -33,6 +33,17 @@ namespace NadekoBot.Extensions {
}
return "`"+string.Join(" ", letters)+"`";
}
public static string TrimTo(this string str, int num) {
if (num < 0)
throw new ArgumentException("TrimTo argument cannot be less than 0");
if (num == 0)
return String.Empty;
if (num <= 3)
return String.Join("", str.Select(c => '.'));
if (str.Length < num)
return str;
return string.Join("", str.Take(num - 3)) + "...";
}
/// <summary>
/// Sends a message to the channel from which this command is called.

View File

@@ -65,7 +65,7 @@ namespace NadekoBot.Classes.Music {
if (video == null) // do something with this error
throw new Exception("Could not load any video elements based on the query.");
Title = video.Title;
Title = video.Title.Substring(0,video.Title.Length-10); // removing trailing "- You Tube"
} catch (Exception ex) {
privateState = StreamState.Completed;
Console.WriteLine($"Failed resolving the link.{ex.Message}");
@@ -142,7 +142,7 @@ namespace NadekoBot.Classes.Music {
public string Stats() =>
"--------------------------------\n" +
$"Music stats for {string.Join("", parent.Title.Take(parent.Title.Length > 20 ? 20 : parent.Title.Length))}\n" +
$"Music stats for {string.Join("", parent.Title.TrimTo(50))}\n" +
$"Server: {parent.Server.Name}\n" +
$"Length:{buffer.Length * 1.0f / 1.MB()}MB Status: {State}\n" +
"--------------------------------\n";

View File

@@ -5,7 +5,6 @@ using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Timers;
using NadekoBot.Extensions;
using System.Threading.Tasks;