DiscordKit icon indicating copy to clipboard operation
DiscordKit copied to clipboard

DiscordKitBot: Add basic types + a few other things

Open Candygoblen123 opened this issue 2 years ago • 3 comments

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 avatar Jun 19 '23 15:06 Candygoblen123

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.

Candygoblen123 avatar Jun 19 '23 15:06 Candygoblen123

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?

cryptoAlgorithm avatar Jul 02 '23 11:07 cryptoAlgorithm

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.

Candygoblen123 avatar Jul 05 '23 15:07 Candygoblen123