Conversation
|
Would love to see this feature merged after a review, conflicts resolved and fixes |
i can take a look, but i'll be on vacation for a week first |
Small world, I'm on vacation rn for a week Have a good week. I can upgrade my bot in a significant way with it. |
Currently this is only partial and we might add something like a PollMessage or Poll class to core
|
Now ready |
13b3d10 to
2a306cd
Compare
They seem to be here by accident, I already removed them for good in #944.
All other kord enums use camel case naming.
lukellmann
left a comment
There was a problem hiding this comment.
also missing Permission.SendPolls, Intent.GuildMessagePolls, Intent.DirectMessagePolls
| /** | ||
| * Behavior of a Poll message. | ||
| */ | ||
| public interface PollBehavior : MessageBehavior { |
There was a problem hiding this comment.
i don't think it's a good idea to have Poll/PollBehavior extend Message/MessageBehavior - a poll is part of a message, not a message itself; it doesn't have a message type; ...
There was a problem hiding this comment.
I am quite sure poll message can't contain anything but the poll
There was a problem hiding this comment.
that might be true for now, but who knows about the future. conceptually a poll is part of a message.
| public fun answer(title: String, emojiUnicode: String? = null, id: Int = answers.size) { | ||
| require(answers.size < 10) { "Cannot add more than 10 answers" } | ||
| answers.add( | ||
| DiscordPoll.Answer( | ||
| answerId = id, | ||
| pollMedia = DiscordPoll.Media( | ||
| Optional(title), | ||
| Optional(emojiUnicode?.let { DiscordPartialEmoji(name = it) }).coerceToMissing() | ||
| ) | ||
| ) | ||
| ) | ||
| } | ||
|
|
||
| /** | ||
| * Adds an answer with [title] and [emoji]. | ||
| * | ||
| * @param id the answer id | ||
| */ | ||
| public fun answer(title: String, emoji: Snowflake? = null, id: Int = answers.size) { | ||
| require(answers.size < 10) { "Cannot add more than 10 answers" } | ||
| answers.add( | ||
| DiscordPoll.Answer( | ||
| answerId = id, | ||
| pollMedia = DiscordPoll.Media( | ||
| Optional(title), | ||
| Optional(emoji?.let { DiscordPartialEmoji(id = it) }).coerceToMissing() | ||
| ) | ||
| ) | ||
| ) | ||
| } |
There was a problem hiding this comment.
is the id required to be sent? that is is the answer_id field optional on poll creation? this makes me think it might be:
Only sent as part of responses from Discord's API/Gateway.
| * | ||
| * @param id the answer id | ||
| */ | ||
| public fun answer(title: String, emojiUnicode: String? = null, id: Int = answers.size) { |
There was a problem hiding this comment.
could emoji be used for the parameter name instead?
|
also relevant: discord/discord-api-docs#7090 |
|
Any progress? |
|
|
Actually we said that you wanted to finish this haha |
Oh, yeah I forgot about that and have been busy otherwise 😅 |
|
@lukellmann This one must have dropped out your field of view |
|
@DRSchlaubi looking at lukellmann's git activity, I don't think he'll come back to this. What do you think? |
|
Sure you can take a look at it, but I can't promise that I will get to merging/reviewing it |
# Conflicts: # common/api/common.api # common/api/common.klib.api # common/src/commonMain/kotlin/entity/DiscordMessage.kt # core/api/core.api # core/api/core.klib.api # core/src/commonMain/kotlin/cache/data/MessageData.kt # core/src/commonMain/kotlin/entity/Message.kt # gateway/src/commonMain/kotlin/Event.kt # rest/api/rest.api # rest/api/rest.klib.api # rest/src/commonMain/kotlin/json/JsonErrorCode.kt # rest/src/commonMain/kotlin/route/Route.kt # rest/src/commonMain/kotlin/service/ChannelService.kt
|
@lukellmann I have taken over this PR here and completed a large volume of your review comments. If you could find the time to review again that would be most appreciated 🙏🏼 |
No description provided.