Fixed .clubapply hopefully, and removed some redundant discriminators

This commit is contained in:
Kwoth
2024-04-16 13:48:23 +00:00
parent d86b5b2b6c
commit eef5b3f948
8 changed files with 25 additions and 21 deletions

View File

@@ -28,5 +28,10 @@ public class DiscordUser : DbEntity
=> UserId.GetHashCode(); => UserId.GetHashCode();
public override string ToString() public override string ToString()
=> Username + "#" + Discriminator; {
if (string.IsNullOrWhiteSpace(Discriminator) || Discriminator == "0000")
return Username;
return Username + "#" + Discriminator;
}
} }

View File

@@ -19,25 +19,25 @@ public class WaifuInfo : DbEntity
public override string ToString() public override string ToString()
{ {
var claimer = "no one";
var status = string.Empty; var status = string.Empty;
var waifuUsername = Waifu.Username.TrimTo(20); var waifuUsername = Waifu.ToString().TrimTo(20);
var claimerUsername = Claimer?.Username.TrimTo(20); var claimer = Claimer?.ToString().TrimTo(20)
?? "no one";
var affinity = Affinity?.ToString().TrimTo(20);
if (ClaimerId is not null)
claimer = $"{claimerUsername}#{Claimer.Discriminator}";
if (AffinityId is null) if (AffinityId is null)
status = $"... but {waifuUsername}'s heart is empty"; status = $"... but {waifuUsername}'s heart is empty";
else if (AffinityId == ClaimerId) else if (AffinityId == ClaimerId)
status = $"... and {waifuUsername} likes {claimerUsername} too <3"; status = $"... and {waifuUsername} likes {claimer} too <3";
else else
{ {
status = status =
$"... but {waifuUsername}'s heart belongs to {Affinity.Username.TrimTo(20)}#{Affinity.Discriminator}"; $"... but {waifuUsername}'s heart belongs to {affinity}";
} }
return $"**{waifuUsername}#{Waifu.Discriminator}** - claimed by **{claimer}**\n\t{status}"; return $"**{waifuUsername}** - claimed by **{claimer}**\n\t{status}";
} }
} }

View File

@@ -363,7 +363,7 @@ public sealed class LogCommandService : ILogCommandService, IReadyExecutor
if (before.Username != after.Username) if (before.Username != after.Username)
{ {
embed.WithTitle("👥 " + GetText(g, strs.username_changed)) embed.WithTitle("👥 " + GetText(g, strs.username_changed))
.WithDescription($"{before.Username}#{before.Discriminator} | {before.Id}") .WithDescription($"{before.Username} | {before.Id}")
.AddField("Old Name", $"{before.Username}", true) .AddField("Old Name", $"{before.Username}", true)
.AddField("New Name", $"{after.Username}", true) .AddField("New Name", $"{after.Username}", true)
.WithFooter(CurrentTime(g)) .WithFooter(CurrentTime(g))
@@ -905,7 +905,7 @@ public sealed class LogCommandService : ILogCommandService, IReadyExecutor
str = "🎙" str = "🎙"
+ Format.Code(PrettyCurrentTime(usr.Guild)) + Format.Code(PrettyCurrentTime(usr.Guild))
+ GetText(logChannel.Guild, + GetText(logChannel.Guild,
strs.user_vmoved("👤" + Format.Bold(usr.Username + "#" + usr.Discriminator), strs.user_vmoved("👤" + Format.Bold(usr.Username),
Format.Bold(beforeVch?.Name ?? ""), Format.Bold(beforeVch?.Name ?? ""),
Format.Bold(afterVch?.Name ?? ""))); Format.Bold(afterVch?.Name ?? "")));
} }
@@ -914,7 +914,7 @@ public sealed class LogCommandService : ILogCommandService, IReadyExecutor
str = "🎙" str = "🎙"
+ Format.Code(PrettyCurrentTime(usr.Guild)) + Format.Code(PrettyCurrentTime(usr.Guild))
+ GetText(logChannel.Guild, + GetText(logChannel.Guild,
strs.user_vjoined("👤" + Format.Bold(usr.Username + "#" + usr.Discriminator), strs.user_vjoined("👤" + Format.Bold(usr.Username),
Format.Bold(afterVch?.Name ?? ""))); Format.Bold(afterVch?.Name ?? "")));
} }
else if (afterVch is null) else if (afterVch is null)
@@ -922,7 +922,7 @@ public sealed class LogCommandService : ILogCommandService, IReadyExecutor
str = "🎙" str = "🎙"
+ Format.Code(PrettyCurrentTime(usr.Guild)) + Format.Code(PrettyCurrentTime(usr.Guild))
+ GetText(logChannel.Guild, + GetText(logChannel.Guild,
strs.user_vleft("👤" + Format.Bold(usr.Username + "#" + usr.Discriminator), strs.user_vleft("👤" + Format.Bold(usr.Username),
Format.Bold(beforeVch.Name ?? ""))); Format.Bold(beforeVch.Name ?? "")));
} }

View File

@@ -239,7 +239,7 @@ public partial class Gambling : GamblingModule<GamblingService>
var usr = membersArray[new NadekoRandom().Next(0, membersArray.Length)]; var usr = membersArray[new NadekoRandom().Next(0, membersArray.Length)];
await SendConfirmAsync("🎟 " + GetText(strs.raffled_user), await SendConfirmAsync("🎟 " + GetText(strs.raffled_user),
$"**{usr.Username}#{usr.Discriminator}**", $"**{usr.Username}**",
footer: $"ID: {usr.Id}"); footer: $"ID: {usr.Id}");
} }
@@ -258,7 +258,7 @@ public partial class Gambling : GamblingModule<GamblingService>
var usr = membersArray[new NadekoRandom().Next(0, membersArray.Length)]; var usr = membersArray[new NadekoRandom().Next(0, membersArray.Length)];
await SendConfirmAsync("🎟 " + GetText(strs.raffled_user), await SendConfirmAsync("🎟 " + GetText(strs.raffled_user),
$"**{usr.Username}#{usr.Discriminator}**", $"**{usr.Username}**",
footer: $"ID: {usr.Id}"); footer: $"ID: {usr.Id}");
} }

View File

@@ -259,8 +259,8 @@ public partial class Xp
await ReplyConfirmLocalizedAsync(strs.club_applied(Format.Bold(club.ToString()))); await ReplyConfirmLocalizedAsync(strs.club_applied(Format.Bold(club.ToString())));
else if (result == ClubApplyResult.Banned) else if (result == ClubApplyResult.Banned)
await ReplyErrorLocalizedAsync(strs.club_join_banned); await ReplyErrorLocalizedAsync(strs.club_join_banned);
else if (result == ClubApplyResult.InsufficientLevel) else if (result == ClubApplyResult.AlreadyApplied)
await ReplyErrorLocalizedAsync(strs.club_insuff_lvl); await ReplyErrorLocalizedAsync(strs.club_already_applied);
else if (result == ClubApplyResult.AlreadyInAClub) else if (result == ClubApplyResult.AlreadyInAClub)
await ReplyErrorLocalizedAsync(strs.club_already_in); await ReplyErrorLocalizedAsync(strs.club_already_in);
} }

View File

@@ -146,7 +146,7 @@ public class ClubService : INService, IClubService
return ClubApplyResult.Banned; return ClubApplyResult.Banned;
if (club.Applicants.Any(x => x.UserId == du.Id)) if (club.Applicants.Any(x => x.UserId == du.Id))
return ClubApplyResult.InsufficientLevel; return ClubApplyResult.AlreadyApplied;
var app = new ClubApplicants var app = new ClubApplicants
{ {

View File

@@ -27,8 +27,7 @@ public interface IClubService
public enum ClubApplyResult public enum ClubApplyResult
{ {
Success, Success,
AlreadyInAClub, AlreadyInAClub,
Banned, Banned,
InsufficientLevel AlreadyApplied
} }

View File

@@ -838,7 +838,7 @@
"server_leaderboard": "Server XP Leaderboard", "server_leaderboard": "Server XP Leaderboard",
"global_leaderboard": "Global XP Leaderboard", "global_leaderboard": "Global XP Leaderboard",
"modified": "Modified server XP of the user {0} by {1}", "modified": "Modified server XP of the user {0} by {1}",
"club_insuff_lvl": "You're insufficient level to join that club.", "club_already_applied": "You've already applied to that club.",
"club_join_banned": "You're banned from that club.", "club_join_banned": "You're banned from that club.",
"club_already_in": "You are already a member of a club.", "club_already_in": "You are already a member of a club.",
"club_create_error_name": "Failed creating the club. A club with that name already exists.", "club_create_error_name": "Failed creating the club. A club with that name already exists.",