1
0
Fork 1
mirror of https://github.com/TeamOctolings/Octobot.git synced 2025-04-20 00:43:36 +03:00

Tidy up project structure, fix bug with edit logging

Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
This commit is contained in:
Octol1ttle 2023-07-09 21:49:47 +05:00
parent 2dd9f023ef
commit 507d5fd58f
Signed by: Octol1ttle
GPG key ID: B77C34313AEE1FFF
27 changed files with 178 additions and 175 deletions

View file

@ -23,8 +23,9 @@
<PackageReference Include="Humanizer.Core.ru" Version="2.14.1"/>
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1"/>
<PackageReference Include="Remora.Discord" Version="2023.3.0"/>
<EmbeddedResource Update="Messages.resx">
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="locale\Messages.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Messages.Designer.cs</LastGenOutput>
</EmbeddedResource>

View file

@ -28,7 +28,7 @@ namespace Boyfriend {
internal static System.Resources.ResourceManager ResourceManager {
get {
if (object.Equals(null, resourceMan)) {
System.Resources.ResourceManager temp = new System.Resources.ResourceManager("Boyfriend.Messages", typeof(Messages).Assembly);
System.Resources.ResourceManager temp = new System.Resources.ResourceManager("Boyfriend.locale.Messages", typeof(Messages).Assembly);
resourceMan = temp;
}
return resourceMan;

View file

@ -65,8 +65,7 @@ public class BanCommandGroup : CommandGroup {
public async Task<Result> BanUserAsync(
[Description("User to ban")] IUser target,
[Description("Ban reason")] string reason,
[Description("Ban duration")]
TimeSpan? duration = null) {
[Description("Ban duration")] TimeSpan? duration = null) {
if (!_context.TryGetContextIDs(out var guildId, out var channelId, out var userId))
return Result.FromError(
new ArgumentNullError(nameof(_context), "Unable to retrieve necessary IDs from command context"));
@ -200,8 +199,7 @@ public class BanCommandGroup : CommandGroup {
[Description("Unban user")]
public async Task<Result> UnbanUserAsync(
[Description("User to unban")] IUser target,
[Description("Unban reason")]
string reason) {
[Description("Unban reason")] string reason) {
if (!_context.TryGetContextIDs(out var guildId, out var channelId, out var userId))
return Result.FromError(
new ArgumentNullError(nameof(_context), "Unable to retrieve necessary IDs from command context"));

View file

@ -125,13 +125,17 @@ public static class Extensions {
}
/// <summary>
/// Sanitizes a string (see <see cref="SanitizeForBlockCode" />) and formats the string with block code.
/// Sanitizes a string (see <see cref="SanitizeForBlockCode" />) and formats the string to use Markdown Block Code formatting with a specified
/// language for syntax highlighting.
/// </summary>
/// <param name="s">The string to sanitize and format.</param>
/// <returns>The sanitized string formatted with <see cref="Markdown.BlockCode(string)" />.</returns>
public static string InBlockCode(this string s) {
/// <param name="language"></param>
/// <returns>The sanitized string formatted to use Markdown Block Code with a specified
/// language for syntax highlighting.</returns>
public static string InBlockCode(this string s, string language = "") {
s = s.SanitizeForBlockCode();
return $"```{s.SanitizeForBlockCode()}{(s.EndsWith("`") || string.IsNullOrWhiteSpace(s) ? " " : "")}```";
return
$"```{language}\n{s.SanitizeForBlockCode()}{(s.EndsWith("`") || string.IsNullOrWhiteSpace(s) ? " " : "")}```";
}
public static string Localized(this string key) {
@ -159,7 +163,7 @@ public static class Extensions {
builder.AppendLine(line.Text);
}
return InBlockCode(builder.ToString());
return InBlockCode(builder.ToString(), "diff");
}
public static string GetTag(this IUser user) {