Skip to content

Commit

Permalink
Removed unnecessary vars
Browse files Browse the repository at this point in the history
  • Loading branch information
fthomys committed May 20, 2023
1 parent 4f14a19 commit a263a20
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
13 changes: 3 additions & 10 deletions src/Commands/ModerationSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,30 +30,24 @@ public async Task KickMember(CommandContext ctx, DiscordMember member, [Remainin
.WithColor(DiscordColor.Red);
DiscordEmbed embed = embedBuilder.Build();

bool sent;
string SentEmoji;
string sentString;
string ReasonString = $"Grund {reason} | Von Moderator: {ctx.User.UsernameWithDiscriminator} | Datum: {DateTime.Now:dd.MM.yyyy - HH:mm}";

try
{
await member.SendMessageAsync(embed: embed);
sent = true;
sentString = "Ja";
SentEmoji = "<:yes:861266772665040917>";
}
catch (UnauthorizedException)
{
sentString = "Nein. Nutzer hat DMs deaktiviert oder den Bot blockiert.";
sent = false;
SentEmoji = "<:no:861266772724023296>";
}

try
{
await member.RemoveAsync(ReasonString);
}
catch (UnauthorizedException e)
catch (UnauthorizedException)
{
DiscordEmbedBuilder failsuccessEmbedBuilder = new DiscordEmbedBuilder()
.WithTitle($"{member.UsernameWithDiscriminator} nicht gekickt")
Expand Down Expand Up @@ -131,7 +125,7 @@ public async Task BanMember(CommandContext ctx, DiscordUser user, [RemainingText
{
await ctx.Guild.BanMemberAsync(user.Id, 7, ReasonString);
}
catch (UnauthorizedException e)
catch (UnauthorizedException)
{
DiscordEmbedBuilder failsuccessEmbedBuilder = new DiscordEmbedBuilder()
.WithTitle($"{user.UsernameWithDiscriminator} nicht gebannt")
Expand Down Expand Up @@ -241,7 +235,6 @@ public async Task MultiBan(CommandContext ctx, [RemainingText] string ids_and_re
users_to_ban.Add(user);
}
}
string busers = "\n";
string busers_formatted = string.Join("\n", users_to_ban.Select(buser => buser.UsernameWithDiscriminator));
var caseid = HelperChecks.GenerateCaseID();
DiscordEmbedBuilder confirmEmbedBuilder = new DiscordEmbedBuilder()
Expand Down Expand Up @@ -504,7 +497,7 @@ public async Task BanRequest(CommandContext ctx, DiscordUser user, [RemainingTex
{
await ctx.Guild.BanMemberAsync(user, reason: $"Grund: {reason} | Banrequestor: {ctx.User} | Banapprover: {result.Result.User} | Datum: {now}");
}
catch (UnauthorizedException e)
catch (UnauthorizedException)
{
buttons.ForEach(x => x.Disable());
await result.Result.Interaction.CreateResponseAsync(InteractionResponseType.DeferredMessageUpdate);
Expand Down
2 changes: 1 addition & 1 deletion src/Services/DatabaseService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public static bool IsConnected()
return false;
}
}
catch (Exception ex)
catch (Exception)
{
return false;
}
Expand Down

0 comments on commit a263a20

Please sign in to comment.