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:
parent
2dd9f023ef
commit
507d5fd58f
27 changed files with 178 additions and 175 deletions
|
@ -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>
|
||||
|
|
|
@ -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;
|
|
@ -59,8 +59,8 @@ public class AboutCommandGroup : CommandGroup {
|
|||
builder.AppendLine($"@{dev} — {$"AboutDeveloper@{dev}".Localized()}");
|
||||
|
||||
builder.AppendLine()
|
||||
.AppendLine(Markdown.Bold(Messages.AboutTitleWiki))
|
||||
.AppendLine("https://github.com/TeamOctolings/Boyfriend/wiki");
|
||||
.AppendLine(Markdown.Bold(Messages.AboutTitleWiki))
|
||||
.AppendLine("https://github.com/TeamOctolings/Boyfriend/wiki");
|
||||
|
||||
var embed = new EmbedBuilder().WithSmallTitle(Messages.AboutBot, currentUser)
|
||||
.WithDescription(builder.ToString())
|
|
@ -63,10 +63,9 @@ public class BanCommandGroup : CommandGroup {
|
|||
[RequireBotDiscordPermissions(DiscordPermission.BanMembers)]
|
||||
[Description("Ban user")]
|
||||
public async Task<Result> BanUserAsync(
|
||||
[Description("User to ban")] IUser target,
|
||||
[Description("Ban reason")] string reason,
|
||||
[Description("Ban duration")]
|
||||
TimeSpan? duration = null) {
|
||||
[Description("User to ban")] IUser target,
|
||||
[Description("Ban reason")] string reason,
|
||||
[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"));
|
||||
|
@ -199,9 +198,8 @@ public class BanCommandGroup : CommandGroup {
|
|||
[RequireBotDiscordPermissions(DiscordPermission.BanMembers)]
|
||||
[Description("Unban user")]
|
||||
public async Task<Result> UnbanUserAsync(
|
||||
[Description("User to unban")] IUser target,
|
||||
[Description("Unban reason")]
|
||||
string reason) {
|
||||
[Description("User to unban")] IUser target,
|
||||
[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"));
|
|
@ -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) {
|
Loading…
Add table
Reference in a new issue