Skip to content

Conversation

Candygoblen123
Copy link
Contributor

The PR adds types for the following:

  • Guilds
  • Guild Members
  • Guild channels
  • Text Channels
  • Category channels

It also refactors the Message type. All the the types have convenience methods and properties. These changes make it possible to create slightly more complex bots.

This PR also makes some changes to Client:

  • The login call will now block the main thread, so that users no longer have to do it manually. This is a potentially breaking change.
  • The rest object is now public, so that advanced users can have access to the discord API, if they so choose.
  • Restricts the number of logged in clients to 1.
  • Fixed an issue where the client would not get logged out properly when exiting. Note that exiting gracefully only works when exiting with SIGINT, because we need to intercept the exit call. It also does not work while a debugger is attached.
  • Added a method to login with a token in a file.

Added a few support methods/classes:

  • asyncMap() and asyncCompactMap() - map() and compactMap() but async
  • PaginatedSequence - An AsyncSequence that abstracts away grabbing paginated data.

Changes to docs:

  • Added a formatted landing page for docc
  • Lots and lots of writing documentation.

@Candygoblen123 Candygoblen123 marked this pull request as draft June 19, 2023 15:41
@Candygoblen123
Copy link
Contributor Author

There's still a lot of convenience methods to write for Guild, but i decided to make this PR so you can start reviewing it.

Copy link
Member

@cryptoAlgorithm cryptoAlgorithm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is really amazing and adds so many missing features, thanks!

I understand that it is still a work in progress, and so far it seems very nice. I've left some comments which you could take as suggestions.

Due to the sheer massiveness of this PR, I have spent a reasonable effort reading thru most files but might've missed something.

@cryptoAlgorithm
Copy link
Member

Thanks for making the recommended changes. Are there other modifications you'd like to make or can I mark this PR as ready for review?

@Candygoblen123
Copy link
Contributor Author

Yeah go on and review it, I’m not gonna have much time this week to work on stuff, but I’ll get any requested changes done asap.

@cryptoAlgorithm cryptoAlgorithm marked this pull request as ready for review July 13, 2023 02:03

/// The url to jump to this message
public var jumpURL: URL? {
get {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This get { clause is redundant, should be removed to resolve the lint warning

public let interactionID: Snowflake
/// The guild member that sent the interaction
public var member: Member? {
get {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The get keyword should be removed here as well to resolve the following lint warning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants