Closed NyCodeGHG closed 1 year ago
I changed the implementation to now use enums, the user is not able to set just a label in the activity builder because this is only valid in the response. So this has the same type safety as the generics version, but much simpler :)
Checklist
Description of Changes
I implemented support for buttons. This is a breaking change, because it adds a new field to the
Activity
struct and changes how secrets are added. When bothsecrets
andbuttons
are set, discord will respond with an error that the fields are exclusive. I've made some changes to represent that in the type system inActivityBuilder
via a generic.The API for everything besides secrets and buttons stays the same. If a user wants to set the secrets they will have to call
with_secrets()
first and are only able to do that on the returned struct. The same behaviour is implemented for buttons but withwith_buttons()
.Discord responds with a different structure for the buttons than it expects in the request. I didn't want to duplicate the Activity struct, so I did that with being generic over the Button type. Because of a bug in rust I had to implement Default manually.
Related Issues