-
-
Notifications
You must be signed in to change notification settings - Fork 166
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Message "stream" #770
Message "stream" #770
Conversation
✅ Deploy Preview for dpp-dev ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Example program:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does base_stream& operator<<(const int& n);
use & for the int (see streams.h)? ints shouldn't be passed by a const ref (see this for more info) as far as I'm aware.
Though this not explicitly mentioned in the coding standard, functions in DPP in general have their braces start on the same line, and have a newline in between definitions, e.g. void foo {
// stuff
}
void bar {
// other stuff
} Though I can't explicitly require that you change your code to fit that since it's not in the coding standard, it would be appreciated. |
This is mentioned in the coding standard https://dpp.dev/coding-standards.html |
Here's a new and improved test with the new features:
|
I would love to see what this looks like in discord itself. Whilst I like this new example with adding components, I don't like that |
It does indeed mean that the message is done |
Okay, so going back to your example's first message. It shows If so, I feel that this shouldn't be allowed as it becomes really weird looking, allowing more messages after an end message call. I guess you could also just not do it but still feels weird! |
I don't really like the function model still. It's harder for the compiler to inline than a constexpr variable, it doesn't look like |
What do you mean, if we add streams for other facilities? |
For example if you want to stream a thread and << users to it, to add them to the thread. Making streams work with other stream than messages. |
I don't get your point, are you saying that there are too many << overloads or too few? |
I'm not saying either of those. What i'm saying is, when designing a feature that works on a large library, one needs to take into account how it interacts with the rest of the library too. If you can stream a channel and add messages to it to simplify calling cluster methods, then it makes sense that other cluster calls could be simplified with other things too. For example adding users to a thread. Then, because you chose In fact now the more I think about it, the more i think it would make sense to have a message builder with your additions, that you can then stream to the channel stream you get on a channel. dpp::message m = dpp::message::stream() << "Message text" << some_embed << component1 << component2 << stream::build;
channel.stream(cluster) << m << dpp::message{"another message"} << stream::send;
thread.stream(cluster) << dpp::message{"a message"} << user1 << user2 << stream::send; // sends the message and adds user1 and user2 to the thread for example. |
I'm closing this PR as we see no benefit in this and it doesn't fit with the style of the lib. |
Here I've added a feature where you can create both messages from channels and direct messages from users with a cluster object using a "stream like" interface