yourWaifu / sleepy-discord

C++ library for the Discord chat client. Please use Rust for new bots
https://yourWaifu.github.io/sleepy-discord/
MIT License
707 stars 92 forks source link

createTextChannel() doesn't work #184

Open Paket236 opened 3 years ago

Paket236 commented 3 years ago

This function does not work. I would like to be able to create categories and text channels.

yourWaifu commented 3 years ago

hmm, I plan on making making a new type template called json::Dynamic<Type> , looking at this endpoint, I think this will be a very good use case.

yourWaifu commented 3 years ago

To give a bit of an update, I've renamed it to json::Maybe<Type> and I've pushed it to the develop branch, https://github.com/yourWaifu/sleepy-discord/commit/327042c60d1cb6bf07ab82f85feb1450adca7531 I might make another one called json::Optional<Type> if I think it'll be useful, the main difference is that Maybe is a pointer while Optional is a union, which allows it to be on the stack but will always take up memory even when null.

jpapale commented 3 years ago

According to https://discord.com/developers/docs/resources/channel#channel-object-channel-types request(Post, path("guilds/{guild.id}/channels", { serverID }), settings, "{\"name\": " + json::string(name) + ", \"type\": \"text\"}") Should be: request(Post, path("guilds/{guild.id}/channels", { serverID }), settings, "{\"name\": " + json::string(name) + ", \"type\": 0}")