Skip to content

[DONT MERGE] Implemented file upload checks

Mateusz Brawański requested to merge github/fork/Neuheit/patch-417 into master

Created by: Neuheit

Summary

This PR mainly fixes #417 (closed), but also simplifies a few checks and makes a few documentation/output changes.

Details

This adds a couple different checks to ensure users are sending files properly. Because the file size limit can vary from guild to guild, I created 4 different methods that handle this limit in guilds and private channels.

Essentially, if a guild exists from the channel, a method will iterate through the guild's premium tier and check if the file size violates each tier's file limit. If the guild or channel does not exist, another method will check the file size against the standard file limit (8 MB). I also added a check in DiscordMessage.RespondWithFilesAsync() and DiscordChannel.SendFilesAsync() to ensure the user does not send more than ten files with a single message.

Additionally, I removed a few checks in DiscordChannel.RespondAsync() as the same checks are in DiscordApiClient.CreateMessageAsync(), and I also added punctuation on a few error messages.

Changes proposed

  • Created 4 internal methods to handle file size checks.
  • Added/deleted a few checks in various methods for simplicity.
  • Added punctuation at the end of a few error messages.

Merge request reports

Loading