Skip to content

Commit

Permalink
Upgrade DSharpPlus to 5.0.0-nightly-02295
Browse files Browse the repository at this point in the history
  • Loading branch information
Erisa committed Jun 22, 2024
1 parent 57a54d2 commit f7d2996
Show file tree
Hide file tree
Showing 37 changed files with 156 additions and 173 deletions.
14 changes: 7 additions & 7 deletions Cliptok.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@

<ItemGroup>
<PackageReference Include="Abyssal.HumanDateParser" Version="2.0.0-20191113.1" />
<PackageReference Include="DSharpPlus" Version="5.0.0-nightly-01982" />
<PackageReference Include="DSharpPlus.CommandsNext" Version="5.0.0-nightly-01982" />
<PackageReference Include="DSharpPlus.SlashCommands" Version="5.0.0-nightly-01982" />
<PackageReference Include="DSharpPlus" Version="5.0.0-nightly-02294" />
<PackageReference Include="DSharpPlus.CommandsNext" Version="5.0.0-nightly-02294" />
<PackageReference Include="DSharpPlus.SlashCommands" Version="5.0.0-nightly-02294" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Serilog" Version="3.1.1" />
<PackageReference Include="Serilog.Expressions" Version="4.0.0" />
<PackageReference Include="Serilog" Version="4.0.0" />
<PackageReference Include="Serilog.Expressions" Version="5.0.0" />
<PackageReference Include="Serilog.Extensions.Logging" Version="8.0.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="5.0.1" />
<PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />
<PackageReference Include="Serilog.Sinks.TextWriter" Version="2.1.0" />
<PackageReference Include="StackExchange.Redis" Version="2.7.17" />
<PackageReference Include="StackExchange.Redis" Version="2.7.33" />
<PackageReference Include="System.Linq" Version="4.3.0" />
<PackageReference Include="System.Linq.Async" Version="6.0.1" />
</ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions Commands/Bans.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public async Task MassBanCmd(CommandContext ctx, [RemainingText] string input)
[Command("ban")]
[Aliases("tempban", "bonk", "isekaitruck")]
[Description("Bans a user that you have permission to ban, deleting all their messages in the process. See also: bankeep.")]
[HomeServer, RequireHomeserverPerm(ServerPermLevel.Moderator), RequirePermissions(Permissions.BanMembers)]
[HomeServer, RequireHomeserverPerm(ServerPermLevel.Moderator), RequirePermissions(DiscordPermissions.BanMembers)]
public async Task BanCmd(CommandContext ctx,
[Description("The user you wish to ban. Accepts many formats")] DiscordUser targetMember,
[RemainingText, Description("The time and reason for the ban. e.g. '14d trolling' NOTE: Add 'appeal' to the start of the reason to include an appeal link")] string timeAndReason = "No reason specified.")
Expand Down Expand Up @@ -134,7 +134,7 @@ public async Task BanCmd(CommandContext ctx,
/// Sue me, I beg you.
[Command("bankeep")]
[Aliases("bansave")]
[Description("Bans a user but keeps their messages around."), HomeServer, RequireHomeserverPerm(ServerPermLevel.Moderator), RequirePermissions(Permissions.BanMembers)]
[Description("Bans a user but keeps their messages around."), HomeServer, RequireHomeserverPerm(ServerPermLevel.Moderator), RequirePermissions(DiscordPermissions.BanMembers)]
public async Task BankeepCmd(CommandContext ctx,
[Description("The user you wish to ban. Accepts many formats")] DiscordUser targetMember,
[RemainingText, Description("The time and reason for the ban. e.g. '14d trolling' NOTE: Add 'appeal' to the start of the reason to include an appeal link")] string timeAndReason = "No reason specified.")
Expand Down Expand Up @@ -216,7 +216,7 @@ public async Task BankeepCmd(CommandContext ctx,

[Command("unban")]
[Description("Unbans a user who has been previously banned.")]
[HomeServer, RequireHomeserverPerm(ServerPermLevel.Moderator), RequirePermissions(Permissions.BanMembers)]
[HomeServer, RequireHomeserverPerm(ServerPermLevel.Moderator), RequirePermissions(DiscordPermissions.BanMembers)]
public async Task UnbanCmd(CommandContext ctx, [Description("The user to unban, usually a mention or ID")] DiscordUser targetUser, [Description("Used in audit log only currently")] string reason = "No reason specified.")
{
if ((await Program.db.HashExistsAsync("bans", targetUser.Id)))
Expand Down
2 changes: 1 addition & 1 deletion Commands/Debug.cs
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ public async Task Import(CommandContext ctx,
foreach (var overwrite in channel.PermissionOverwrites)
{
// Ignore role overrides
if (overwrite.Type == OverwriteType.Role) continue;
if (overwrite.Type == DiscordOverwriteType.Role) continue;

// Get user's current overrides from db
var userOverrides = await Program.db.HashGetAsync("overrides", overwrite.Id.ToString());
Expand Down
6 changes: 3 additions & 3 deletions Commands/InteractionCommands/AnnouncementInteractions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ internal class AnnouncementInteractions : ApplicationCommandModule
{
[SlashCommand("announcebuild", "Announce a Windows Insider build in the current channel.", defaultPermission: false)]
[SlashRequireHomeserverPerm(ServerPermLevel.TrialModerator)]
[SlashCommandPermissions(Permissions.ModerateMembers)]
[SlashCommandPermissions(DiscordPermissions.ModerateMembers)]
public async Task AnnounceBuildSlashCommand(InteractionContext ctx,
[Choice("Windows 10", 10)]
[Choice("Windows 11", 11)]
Expand Down Expand Up @@ -217,7 +217,7 @@ public async Task AnnounceBuildSlashCommand(InteractionContext ctx,
threadBrackets = "10 RP";

string threadName = string.Format(autothreadName, buildNumber, threadBrackets);
threadChannel = await messageSent.CreateThreadAsync(threadName, AutoArchiveDuration.Week, "Creating thread for Insider build.");
threadChannel = await messageSent.CreateThreadAsync(threadName, DiscordAutoArchiveDuration.Week, "Creating thread for Insider build.");

var initialMsg = await threadChannel.SendMessageAsync($"{blogLink}");
await initialMsg.PinAsync();
Expand All @@ -238,7 +238,7 @@ public async Task AnnounceBuildSlashCommand(InteractionContext ctx,
if (insiderChannel2 != "")
await insiderRole2.ModifyAsync(mentionable: false);

if (announcementChannel.Type is ChannelType.News)
if (announcementChannel.Type is DiscordChannelType.News)
await announcementChannel.CrosspostMessageAsync(msg);
}

Expand Down
8 changes: 4 additions & 4 deletions Commands/InteractionCommands/BanInteractions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace Cliptok.Commands.InteractionCommands
internal class BanInteractions : ApplicationCommandModule
{
[SlashCommand("ban", "Bans a user from the server, either permanently or temporarily.", defaultPermission: false)]
[SlashRequireHomeserverPerm(ServerPermLevel.Moderator), SlashCommandPermissions(Permissions.BanMembers)]
[SlashRequireHomeserverPerm(ServerPermLevel.Moderator), SlashCommandPermissions(DiscordPermissions.BanMembers)]
public async Task BanSlashCommand(InteractionContext ctx,
[Option("user", "The user to ban")] DiscordUser user,
[Option("reason", "The reason the user is being banned")] string reason,
Expand All @@ -16,7 +16,7 @@ public async Task BanSlashCommand(InteractionContext ctx,
{
// Initial response to avoid the 3 second timeout, will edit later.
var eout = new DiscordInteractionResponseBuilder().AsEphemeral(true);
await ctx.CreateResponseAsync(InteractionResponseType.DeferredChannelMessageWithSource, eout);
await ctx.CreateResponseAsync(DiscordInteractionResponseType.DeferredChannelMessageWithSource, eout);

// Edits need a webhook rather than interaction..?
DiscordWebhookBuilder webhookOut = new();
Expand Down Expand Up @@ -113,7 +113,7 @@ public async Task BanSlashCommand(InteractionContext ctx,
}

[SlashCommand("unban", "Unbans a user who has been previously banned.", defaultPermission: false)]
[SlashRequireHomeserverPerm(ServerPermLevel.Moderator), SlashCommandPermissions(Permissions.BanMembers)]
[SlashRequireHomeserverPerm(ServerPermLevel.Moderator), SlashCommandPermissions(DiscordPermissions.BanMembers)]
public async Task SlashUnbanCommand(InteractionContext ctx, [Option("user", "The ID or mention of the user to unban. Ignore the suggestions, IDs work.")] SnowflakeObject userId, [Option("reason", "Used in audit log only currently")] string reason = "No reason specified.")
{
DiscordUser targetUser = default;
Expand Down Expand Up @@ -144,7 +144,7 @@ public async Task SlashUnbanCommand(InteractionContext ctx, [Option("user", "The
}

[SlashCommand("kick", "Kicks a user, removing them from the server until they rejoin.", defaultPermission: false)]
[SlashRequireHomeserverPerm(ServerPermLevel.Moderator), SlashCommandPermissions(Permissions.KickMembers)]
[SlashRequireHomeserverPerm(ServerPermLevel.Moderator), SlashCommandPermissions(DiscordPermissions.KickMembers)]
public async Task KickCmd(InteractionContext ctx, [Option("user", "The user you want to kick from the server.")] DiscordUser target, [Option("reason", "The reason for kicking this user.")] string reason = "No reason specified.")
{
if (target.IsBot)
Expand Down
6 changes: 3 additions & 3 deletions Commands/InteractionCommands/ClearInteractions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ public class ClearInteractions : ApplicationCommandModule
public static Dictionary<ulong, List<DiscordMessage>> MessagesToClear = new();

[SlashCommand("clear", "Delete many messages from the current channel.", defaultPermission: false)]
[HomeServer, SlashRequireHomeserverPerm(ServerPermLevel.TrialModerator), RequireBotPermissions(Permissions.ManageMessages), SlashCommandPermissions(Permissions.ModerateMembers)]
[HomeServer, SlashRequireHomeserverPerm(ServerPermLevel.TrialModerator), RequireBotPermissions(DiscordPermissions.ManageMessages), SlashCommandPermissions(DiscordPermissions.ModerateMembers)]
public async Task ClearSlashCommand(InteractionContext ctx,
[Option("count", "The number of messages to consider for deletion. Required if you don't use the 'up_to' argument.")] long count = 0,
[Option("up_to", "Optionally delete messages up to (not including) this one. Accepts IDs and links.")] string upTo = "",
Expand All @@ -20,7 +20,7 @@ public async Task ClearSlashCommand(InteractionContext ctx,
[Option("dry_run", "Don't actually delete the messages, just output what would be deleted.")] bool dryRun = false
)
{
await ctx.CreateResponseAsync(InteractionResponseType.DeferredChannelMessageWithSource, new DiscordInteractionResponseBuilder().AsEphemeral(!dryRun));
await ctx.CreateResponseAsync(DiscordInteractionResponseType.DeferredChannelMessageWithSource, new DiscordInteractionResponseBuilder().AsEphemeral(!dryRun));

// If all args are unset
if (count == 0 && upTo == "" && user == default && ignoreMods == false && match == "" && botsOnly == false && humansOnly == false && attachmentsOnly == false && stickersOnly == false && linksOnly == false)
Expand Down Expand Up @@ -252,7 +252,7 @@ public async Task ClearSlashCommand(InteractionContext ctx,
// Warn the mod if we're going to be deleting 50 or more messages.
if (messagesToClear.Count >= 50)
{
DiscordButtonComponent confirmButton = new(ButtonStyle.Danger, "clear-confirm-callback", "Delete Messages");
DiscordButtonComponent confirmButton = new(DiscordButtonStyle.Danger, "clear-confirm-callback", "Delete Messages");
DiscordMessage confirmationMessage = await ctx.FollowUpAsync(new DiscordFollowupMessageBuilder().WithContent($"{Program.cfgjson.Emoji.Muted} You're about to delete {messagesToClear.Count} messages. Are you sure?").AddComponents(confirmButton).AsEphemeral(true));

MessagesToClear.Add(confirmationMessage.Id, messagesToClear);
Expand Down
8 changes: 4 additions & 4 deletions Commands/InteractionCommands/ContextCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
internal class ContextCommands : ApplicationCommandModule
{
[ContextMenu(ApplicationCommandType.UserContextMenu, "Show Avatar", defaultPermission: true)]
[ContextMenu(DiscordApplicationCommandType.UserContextMenu, "Show Avatar", defaultPermission: true)]
public async Task ContextAvatar(ContextMenuContext ctx)
{
string avatarUrl = await LykosAvatarMethods.UserOrMemberAvatarURL(ctx.TargetUser, ctx.Guild);
Expand All @@ -19,19 +19,19 @@ public async Task ContextAvatar(ContextMenuContext ctx)
await ctx.RespondAsync(null, embed, ephemeral: true);
}

[ContextMenu(ApplicationCommandType.UserContextMenu, "Show Warnings", defaultPermission: true)]
[ContextMenu(DiscordApplicationCommandType.UserContextMenu, "Show Warnings", defaultPermission: true)]
public async Task ContextWarnings(ContextMenuContext ctx)
{
await ctx.RespondAsync(embed: await WarningHelpers.GenerateWarningsEmbedAsync(ctx.TargetUser), ephemeral: true);
}

[ContextMenu(ApplicationCommandType.UserContextMenu, "User Information", defaultPermission: true)]
[ContextMenu(DiscordApplicationCommandType.UserContextMenu, "User Information", defaultPermission: true)]
public async Task ContextUserInformation(ContextMenuContext ctx)
{
await ctx.RespondAsync(embed: await DiscordHelpers.GenerateUserEmbed(ctx.TargetUser, ctx.Guild), ephemeral: true);
}

[ContextMenu(ApplicationCommandType.UserContextMenu, "Hug", defaultPermission: true),]
[ContextMenu(DiscordApplicationCommandType.UserContextMenu, "Hug", defaultPermission: true),]
public async Task Hug(ContextMenuContext ctx)
{
var user = ctx.TargetUser;
Expand Down
4 changes: 2 additions & 2 deletions Commands/InteractionCommands/DebugInteractions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ internal class DebugInteractions : ApplicationCommandModule
{
[SlashCommand("scamcheck", "Check if a link or message is known to the anti-phishing API.", defaultPermission: false)]
[Description("Check if a link or message is known to the anti-phishing API.")]
[SlashRequireHomeserverPerm(ServerPermLevel.TrialModerator), SlashCommandPermissions(Permissions.ModerateMembers)]
[SlashRequireHomeserverPerm(ServerPermLevel.TrialModerator), SlashCommandPermissions(DiscordPermissions.ModerateMembers)]
public async Task ScamCheck(InteractionContext ctx, [Option("input", "Domain or message content to scan.")] string content)
{
var urlMatches = Constants.RegexConstants.url_rx.Matches(content);
Expand Down Expand Up @@ -49,7 +49,7 @@ public async Task ScamCheck(InteractionContext ctx, [Option("input", "Domain or
}

[SlashCommand("tellraw", "You know what you're here for.", defaultPermission: false)]
[SlashRequireHomeserverPerm(ServerPermLevel.Moderator), SlashCommandPermissions(Permissions.ModerateMembers)]
[SlashRequireHomeserverPerm(ServerPermLevel.Moderator), SlashCommandPermissions(DiscordPermissions.ModerateMembers)]
public async Task TellRaw(InteractionContext ctx, [Option("input", "???")] string input, [Option("reply_msg_id", "ID of message to use in a reply context.")] string replyID = "0", [Option("pingreply", "Ping pong.")] bool pingreply = true, [Option("channel", "Either mention or ID. Not a name.")] string discordChannel = default)
{
DiscordChannel channelObj = default;
Expand Down
4 changes: 2 additions & 2 deletions Commands/InteractionCommands/DehoistInteractions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
internal class DehoistInteractions : ApplicationCommandModule
{
[SlashCommand("dehoist", "Dehoist a member, dropping them to the bottom of the list. Lasts until they change nickname.", defaultPermission: false)]
[SlashRequireHomeserverPerm(ServerPermLevel.Moderator), SlashCommandPermissions(Permissions.ManageNicknames)]
[SlashRequireHomeserverPerm(ServerPermLevel.Moderator), SlashCommandPermissions(DiscordPermissions.ManageNicknames)]
public async Task DehoistSlashCmd(InteractionContext ctx, [Option("member", "The member to dehoist.")] DiscordUser user)
{
DiscordMember member;
Expand Down Expand Up @@ -39,7 +39,7 @@ await member.ModifyAsync(a =>
}

[SlashCommandGroup("permadehoist", "Permanently/persistently dehoist members.", defaultPermission: false)]
[SlashRequireHomeserverPerm(ServerPermLevel.TrialModerator), SlashCommandPermissions(Permissions.ManageNicknames)]
[SlashRequireHomeserverPerm(ServerPermLevel.TrialModerator), SlashCommandPermissions(DiscordPermissions.ManageNicknames)]
public class PermadehoistSlashCommands
{
[SlashCommand("enable", "Permanently dehoist a member. They will be automatically dehoisted until disabled.")]
Expand Down
Loading

0 comments on commit f7d2996

Please sign in to comment.