Moved _strings, added some extension methods

This commit is contained in:
Master Kwoth 2017-05-08 13:43:38 +02:00
parent 13dea118a9
commit 8408a17450
21 changed files with 9 additions and 3 deletions

View File

@ -93,8 +93,8 @@ namespace NadekoBot.Modules.Help
if (alias != null) if (alias != null)
str += string.Format(" **/ `{0}`**", alias); str += string.Format(" **/ `{0}`**", alias);
var embed = new EmbedBuilder() var embed = new EmbedBuilder()
.AddField(fb => fb.WithName(str).WithValue($"{string.Format(com.Summary, com.Module.Aliases.First())} {GetCommandRequirements(com)}").WithIsInline(true)) .AddField(fb => fb.WithName(str).WithValue($"{com.RealSummary()} {GetCommandRequirements(com)}").WithIsInline(true))
.AddField(fb => fb.WithName(GetText("usage")).WithValue(string.Format(com.Remarks, com.Module.Aliases.First())).WithIsInline(false)) .AddField(fb => fb.WithName(GetText("usage")).WithValue(com.RealRemarks()).WithIsInline(false))
.WithColor(NadekoBot.OkColor); .WithColor(NadekoBot.OkColor);
await channel.EmbedAsync(embed).ConfigureAwait(false); await channel.EmbedAsync(embed).ConfigureAwait(false);
} }

View File

@ -34,6 +34,9 @@
<None Update="data\**\*"> <None Update="data\**\*">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
<None Update="_strings\**">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="data\musicdata\**\*"> <None Update="data\musicdata\**\*">
<CopyToOutputDirectory>Never</CopyToOutputDirectory> <CopyToOutputDirectory>Never</CopyToOutputDirectory>
</None> </None>

View File

@ -11,7 +11,7 @@ namespace NadekoBot.Services
{ {
public class NadekoStrings public class NadekoStrings
{ {
public const string stringsPath = @"data/strings/"; public const string stringsPath = @"_strings/";
private readonly ImmutableDictionary<string, ImmutableDictionary<string, string>> responseStrings; private readonly ImmutableDictionary<string, ImmutableDictionary<string, string>> responseStrings;
private readonly Logger _log; private readonly Logger _log;

View File

@ -27,6 +27,9 @@ namespace NadekoBot.Extensions
return Convert.ToBase64String(plainTextBytes); return Convert.ToBase64String(plainTextBytes);
} }
public static string RealSummary(this CommandInfo cmd) => string.Format(cmd.Summary, cmd.Module.GetTopLevelModule().Prefix);
public static string RealRemarks(this CommandInfo cmd) => string.Format(cmd.Remarks, cmd.Module.GetTopLevelModule().Prefix);
public static Stream ToStream(this IEnumerable<byte> bytes, bool canWrite = false) public static Stream ToStream(this IEnumerable<byte> bytes, bool canWrite = false)
{ {
var ms = new MemoryStream(bytes as byte[] ?? bytes.ToArray(), canWrite); var ms = new MemoryStream(bytes as byte[] ?? bytes.ToArray(), canWrite);