Page MenuHomeAITSYS Dev

DisCatSharp 9.8.5
Updated 15 Days AgoPublic

Upgrade from 9.8.4 to 9.8.5

What is new in DisCatSharp?

  • Enforced Naming Conventions
  • Reworked ApplicationCommands Module
  • Timeouts
  • RestClient
  • DisCatSharp.Common Extensions
  • Attachment manipulation and alt text
  • Modals
  • Slash Attachments

What changed?

ApplicationCommands Module

First of all, the complete module was rewritten to be significant faster.
We could decrease the application command startup to ~30 seconds.
Before it was like 5 minutes for big bots.
On startup, depending on the size, it can take a few minutes till application commands can be used.
The lib automatically catches this during the startup and warns the user.
We added GuildCommands & GlobalCommands to the Application​Commands​Extension.
Every guild command will be added to DiscordGuild.RegisteredApplicationCommands and the permissions to DiscordGuild.GuildApplicationCommandPermissions
Furthermore:

  • Instead of registering commands when the client is ready, it waits for all guilds to be downloaded.
  • The module now checks for existing commands and only executes API calls when needed.
Default Help Module

You can add EnableDefaultHelp = false in the ApplicationCommandsConfiguration to disable the module.
If not supplied, DisCatSharp automatically generates a global /help command.

Many thanks to Will for adding this to our lib ❤️

Example
DiscordClient.UseApplicationCommands(new ApplicationCommandsConfiguration() {
    EnableDefaultHelp = true
});
Permissions

You can now set global permissions ❤️
But we had to change the way the module works for it.
The new methods for adding commands are now:

  • Global Commands
ApplicationCommandsExtension.RegisterGlobalCommands<MyAwesomeGlobalCommandClass>(perms => {
    perms.AddRole(some_cool_guild_id, some_cool_role_id, false);
});
  • Guild Commands
ApplicationCommandsExtension.RegisterGuildCommands<MyAwesomeGuildCommandClass>(some_cool_guild_id, perms => {
    perms.AddRole(some_cool_role_id, true);
});
Options & Attributes

Discord supports integers as input but we only added long for some unknown reason.
We added to the Option type number now int.

Events

We added the following events for you:

Timeouts

Methods

You have the following methods to use timeouts:

Properties

We added a property called CommunicationDisabledUntil to DiscordMember

Events (Unstable)

We added the following events for timeouts:

Auditlogs

You can find the documentation for the timeout auditlog here.

RestClient (Experimental)

We exposed our internal http client as the property RestClient on DiscordBaseClient

DisCatSharp.Common

We added the following RegEx to this extension:

We use them mostly internally

Attachments

You can now set the alt text on your attachments!
Visit the following docs for more infos:
DiscordMessageFile.Description
DiscordAttachment.Description

Our last changelogs for that:

+ Added support for file description (aka. Alt Text)
You can supply a description to {DiscordMessageBuilder|DiscordFollowupMessageBuilder|DiscordInteractionResponseBuilder|DiscordWebhookBuilder}.WithFile
You can view the description property of files with {DiscordMessageFile|DiscordAttachment}.Description
+ Added function DiscordWebhookBuilder.KeepAttachments
This allows you to add / modify & replace / keep attachments on DiscordWebhookBuilders.
+ Full support for attachment operations on messages, webhooks & interactions
Methods are now ModifyAttachments, KeepAttachments & ClearAttachments

Snippet:

[Command("ufwd"), Description(Download a jpg file from an url and upload upload it to discord with a description (alt text).")]
public async Task UploadFileWithDescriptionAsync(CommandContext ctx, [Description("Url of file")] string url, [RemainingText, Description("Description of file")] string description)
{
    Uri uri = new(url);
    var stream = await ctx.Client.RestClient.GetStreamAsync(uri);
    DiscordMessageBuilder builder = new();
    builder.WithFile("test.jpg", stream, false, description);
    await ctx.RespondAsync(builder);
}

Additional Notes

Users

DiscordClient.GetUserAsync defaults now to fetch=true.

Interaction Locales

We already support the newly introduced locale and guild_locale fields on interactions!

Modals & Slash Attachments

These who things are still in private beta sadly, but we added it already.
Docs will be added on release from discord's side.

Application Command Translations

Wait.. this is a thing?! YES!!!!
It's not yet released but I know that you love to see upcoming things.
So feel free to take a look into Articles.

Last Author
aiko
Last Edited
Wed, Jan 12, 19:12

Event Timeline

aiko created this object.
aiko created this object with visibility "DisCatSharp (Project)".
aiko created this object with edit policy "Restricted Project (Project)".
aiko edited the content of this document. (Show Details)
aiko edited the content of this document. (Show Details)
aiko published a new version of this document.
aiko edited the content of this document. (Show Details)
aiko changed the visibility from "DisCatSharp (Project)" to "Public (No Login Required)".
aiko signed these changes with MFA.Wed, Jan 12, 19:04
aiko added a subscriber: aiko.

Pre-Version, pending review

aiko edited the content of this document. (Show Details)