Skip to content

Commit

Permalink
Remove unnecessary Npgsql imports across the project
Browse files Browse the repository at this point in the history
Npgsql imports, which are no longer needed, have been removed from numerous files across the project. Additionally, minor code formatting adjustments have been made to improve readability in some instances. This removal simplifies the codebase, making it easier to understand and maintain.
  • Loading branch information
FabiChan99 committed Dec 25, 2023
1 parent 4efff40 commit d18f33d
Show file tree
Hide file tree
Showing 39 changed files with 216 additions and 146 deletions.
1 change: 0 additions & 1 deletion src/Commands/Moderation/CaseManagementCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
using DisCatSharp.CommandsNext;
using DisCatSharp.CommandsNext.Attributes;
using DisCatSharp.Entities;
using Npgsql;

#endregion

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using DisCatSharp.CommandsNext;
using DisCatSharp.CommandsNext.Attributes;
using DisCatSharp.Entities;
using Npgsql;

#endregion

Expand Down
7 changes: 5 additions & 2 deletions src/Commands/TempVC/BlockUserCommand.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using AGC_Management.Attributes;
#region

using AGC_Management.Attributes;
using AGC_Management.Utils;
using AGC_Management.Utils.TempVoice;
using DisCatSharp.CommandsNext;
Expand All @@ -7,6 +9,8 @@
using DisCatSharp.Enums;
using Microsoft.Extensions.Logging;

#endregion

namespace AGC_Management.Commands.TempVC;

public class BlockUserCommand : TempVoiceHelper
Expand Down Expand Up @@ -128,5 +132,4 @@ public async Task VoiceBlock(CommandContext ctx, [RemainingText] string users)
}
);
}

}
6 changes: 5 additions & 1 deletion src/Commands/TempVC/ChannelInfoCommand.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using AGC_Management.Attributes;
#region

using AGC_Management.Attributes;
using AGC_Management.Services;
using AGC_Management.Utils;
using AGC_Management.Utils.TempVoice;
Expand All @@ -9,6 +11,8 @@
using DisCatSharp.Enums;
using DisCatSharp.Interactivity.Extensions;

#endregion

namespace AGC_Management.Commands.TempVC;

public sealed class ChannelInfoCommand : TempVoiceHelper
Expand Down
9 changes: 6 additions & 3 deletions src/Commands/TempVC/ChannelModManagement.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
using AGC_Management.Attributes;
#region

using AGC_Management.Attributes;
using AGC_Management.Utils.TempVoice;
using DisCatSharp.CommandsNext;
using DisCatSharp.CommandsNext.Attributes;
using DisCatSharp.Entities;

namespace AGC_Management.Commands.TempVC;
#endregion

namespace AGC_Management.Commands.TempVC;

[Group("channelmod")]
[Aliases("cmod")]
Expand Down Expand Up @@ -138,4 +141,4 @@ public async Task ChannelModList(CommandContext ctx)
await ctx.RespondAsync(emb);
}
}
}
}
35 changes: 19 additions & 16 deletions src/Commands/TempVC/ChannelStatusManager.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
using AGC_Management.Attributes;
#region

using AGC_Management.Attributes;
using AGC_Management.Services;
using AGC_Management.Utils.TempVoice;
using DisCatSharp.CommandsNext;
using DisCatSharp.CommandsNext.Attributes;
using DisCatSharp.Entities;
using Npgsql;

namespace AGC_Management.Commands.TempVC;
#endregion

namespace AGC_Management.Commands.TempVC;

[Group("channelstatus")]
[Aliases("vcstatus", "channel-status", "vc-status")]
Expand All @@ -25,12 +27,12 @@ await ctx.RespondAsync(
"<:attention:1085333468688433232> **Fehler!** Der Name muss zwischen 1 und 50 Zeichen lang sein.");
return;
}
var current_timestamp = DateTimeOffset.UtcNow.ToUnixTimeSeconds();
List<long> dbChannels = await GetChannelIDFromDB(ctx);
DiscordChannel userChannel = ctx.Member?.VoiceState?.Channel;
bool isMod = await IsChannelMod(userChannel, ctx.Member);
if (userChannel == null || !dbChannels.Contains((long)userChannel?.Id) && !isMod)
{
await NoChannel(ctx);
Expand Down Expand Up @@ -72,7 +74,7 @@ await ctx.RespondAsync(
"<:attention:1085333468688433232> **Fehler!** Channelstatus ist nicht mit diesem Channel kompatibel. Bitte erstelle einen neuen Channel.");
return;
}
long? edittimestamp = timestampdata;
long? math = current_timestamp - edittimestamp;
Expand All @@ -94,8 +96,8 @@ await msg.ModifyAsync(
"<:attention:1085333468688433232> **Fehler!** Der Channelstatus konnte nicht geändert werden. Bitte versuche es erneut.");
return;
}
await using (NpgsqlConnection conn = new(DatabaseService.GetConnectionString()))
{
await conn.OpenAsync();
Expand All @@ -107,7 +109,7 @@ await msg.ModifyAsync(
int affected = await command.ExecuteNonQueryAsync();
}
}
await msg.ModifyAsync(
"<:success:1085333481820790944> **Erfolg!** Der Channelstatus wurde erfolgreich geändert.");
}
Expand All @@ -117,12 +119,13 @@ await msg.ModifyAsync(
[Command("remove")]
public async Task SetStatus(CommandContext ctx)
{
_ = Task.Run(async () => {
_ = Task.Run(async () =>
{
var current_timestamp = DateTimeOffset.UtcNow.ToUnixTimeSeconds();
List<long> dbChannels = await GetChannelIDFromDB(ctx);
DiscordChannel userChannel = ctx.Member?.VoiceState?.Channel;
bool isMod = await IsChannelMod(userChannel, ctx.Member);
if (userChannel == null || !dbChannels.Contains((long)userChannel?.Id) && !isMod)
{
await NoChannel(ctx);
Expand Down Expand Up @@ -164,14 +167,14 @@ await ctx.RespondAsync(
"<:attention:1085333468688433232> **Fehler!** Channelstatus ist nicht mit diesem Channel kompatibel. Bitte erstelle einen neuen Channel.");
return;
}
else if (timestampdata == 0)
if (timestampdata == 0)
{
await ctx.RespondAsync(
"<:attention:1085333468688433232> **Fehler!** Der Channelstatus wurde noch nicht gesetzt.");
return;
}
long? edittimestamp = timestampdata;
long? math = current_timestamp - edittimestamp;
Expand All @@ -184,7 +187,7 @@ await msg.ModifyAsync(
}
channel.RemoveVoiceChannelStatusAsync();
await using (NpgsqlConnection conn = new(DatabaseService.GetConnectionString()))
{
await conn.OpenAsync();
Expand All @@ -196,7 +199,7 @@ await msg.ModifyAsync(
int affected = await command.ExecuteNonQueryAsync();
}
}
await msg.ModifyAsync(
"<:success:1085333481820790944> **Erfolg!** Der Channelstatus wurde erfolgreich entfernt.");
}
Expand Down
9 changes: 6 additions & 3 deletions src/Commands/TempVC/ClaimChannelCommand.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
using AGC_Management.Attributes;
#region

using AGC_Management.Attributes;
using AGC_Management.Services;
using AGC_Management.Utils.TempVoice;
using DisCatSharp.CommandsNext;
using DisCatSharp.CommandsNext.Attributes;
using DisCatSharp.Entities;
using DisCatSharp.Enums;

#endregion

namespace AGC_Management.Commands.TempVC;

public sealed class ClaimChannelCommand : TempVoiceHelper
{
[Command("claim")]
[Command("claim")]
[RequireDatabase]
[Aliases("claimvc")]
public async Task ClaimVoice(CommandContext ctx)
Expand Down Expand Up @@ -81,5 +85,4 @@ await msg.ModifyAsync(
}
});
}

}
6 changes: 5 additions & 1 deletion src/Commands/TempVC/HideChannelCommand.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
using AGC_Management.Attributes;
#region

using AGC_Management.Attributes;
using AGC_Management.Utils.TempVoice;
using DisCatSharp.CommandsNext;
using DisCatSharp.CommandsNext.Attributes;
using DisCatSharp.Entities;
using DisCatSharp.Enums;

#endregion

namespace AGC_Management.Commands.TempVC;

public sealed class HideChannelCommand : TempVoiceHelper
Expand Down
7 changes: 5 additions & 2 deletions src/Commands/TempVC/JoinRequestCommand.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
using AGC_Management.Utils;
#region

using AGC_Management.Utils;
using AGC_Management.Utils.TempVoice;
using DisCatSharp.CommandsNext;
using DisCatSharp.CommandsNext.Attributes;
using DisCatSharp.Entities;
using DisCatSharp.Enums;
using DisCatSharp.Interactivity.Extensions;

#endregion

namespace AGC_Management.Commands.TempVC;

public sealed class JoinRequestCommand : TempVoiceHelper
Expand Down Expand Up @@ -200,5 +204,4 @@ await userchannel.ModifyAsync(x =>
}
});
}

}
6 changes: 5 additions & 1 deletion src/Commands/TempVC/LockChannelCommand.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
using AGC_Management.Attributes;
#region

using AGC_Management.Attributes;
using AGC_Management.Utils.TempVoice;
using DisCatSharp.CommandsNext;
using DisCatSharp.CommandsNext.Attributes;
using DisCatSharp.Entities;
using DisCatSharp.Enums;

#endregion

namespace AGC_Management.Commands.TempVC;

public sealed class LockChannelCommand : TempVoiceHelper
Expand Down
7 changes: 5 additions & 2 deletions src/Commands/TempVC/PermitCommand.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using AGC_Management.Attributes;
#region

using AGC_Management.Attributes;
using AGC_Management.Utils;
using AGC_Management.Utils.TempVoice;
using DisCatSharp.CommandsNext;
Expand All @@ -7,11 +9,12 @@
using DisCatSharp.Enums;
using DisCatSharp.Exceptions;

#endregion

namespace AGC_Management.Commands.TempVC;

public sealed class PermitCommand : TempVoiceHelper
{

[Command("permit")]
[RequireDatabase]
[Aliases("allow", "whitelist", "multipermit")]
Expand Down
7 changes: 5 additions & 2 deletions src/Commands/TempVC/RenameChannelCommand.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
using AGC_Management.Attributes;
#region

using AGC_Management.Attributes;
using AGC_Management.Services;
using AGC_Management.Utils.TempVoice;
using DisCatSharp.CommandsNext;
using DisCatSharp.CommandsNext.Attributes;
using DisCatSharp.Entities;

#endregion

namespace AGC_Management.Commands.TempVC;

public sealed class RenameChannelCommand : TempVoiceHelper
Expand Down Expand Up @@ -83,5 +87,4 @@ await msg.ModifyAsync(
}
});
}

}
8 changes: 6 additions & 2 deletions src/Commands/TempVC/SessionManagement.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using AGC_Management.Attributes;
#region

using AGC_Management.Attributes;
using AGC_Management.Services;
using AGC_Management.Utils;
using AGC_Management.Utils.TempVoice;
Expand All @@ -9,6 +11,8 @@
using DisCatSharp.Exceptions;
using DisCatSharp.Interactivity.Extensions;

#endregion

namespace AGC_Management.Commands.TempVC;

[Group("session")]
Expand Down Expand Up @@ -293,4 +297,4 @@ await msg.ModifyAsync(
}
});
}
}
}
10 changes: 5 additions & 5 deletions src/Commands/TempVC/SetChannelLimitStatus.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
using AGC_Management.Attributes;
#region

using AGC_Management.Attributes;
using AGC_Management.Utils.TempVoice;
using DisCatSharp.CommandsNext;
using DisCatSharp.CommandsNext.Attributes;
using DisCatSharp.Entities;

#endregion

namespace AGC_Management.Commands.TempVC;

public sealed class SetChannelLimitStatus : TempVoiceHelper
{


[Command("limit")]
[RequireDatabase]
[Aliases("vclimit")]
Expand Down Expand Up @@ -45,6 +47,4 @@ await ctx.RespondAsync(
$"<:success:1085333481820790944> Du hast {userChannel.Mention} erfolgreich ein Userlimit von **{limit}** gesetzt.");
}
}


}
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
using AGC_Management.Utils.TempVoice;
#region

using AGC_Management.Utils.TempVoice;
using DisCatSharp.CommandsNext;
using DisCatSharp.CommandsNext.Attributes;
using DisCatSharp.Entities;
using DisCatSharp.Enums;

#endregion

namespace AGC_Management.Commands.TempVC.TeamCommands.DevCommands;

public sealed class TempVoicePanel : TempVoiceHelper
Expand Down
Loading

0 comments on commit d18f33d

Please sign in to comment.