Skip to content
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

feat: group vote protocol #2416

Draft
wants to merge 18 commits into
base: dev
Choose a base branch
from
Draft

feat: group vote protocol #2416

wants to merge 18 commits into from

Conversation

cssxsh
Copy link
Contributor

@cssxsh cssxsh commented Jan 8, 2023

close #1901

@cssxsh cssxsh changed the title add: group vote protocol feat: group vote protocol Jan 8, 2023
@cssxsh
Copy link
Contributor Author

cssxsh commented Jan 8, 2023

@Him188 @Karlatemp 我打算仿照 Announcements 设计API
有什么建议吗

@Him188
Copy link
Member

Him188 commented Jan 8, 2023

我觉得可以

@Him188 Him188 added this to the 2.15 milestone Jan 17, 2023
@Him188 Him188 self-requested a review January 17, 2023 11:36
@Him188 Him188 added t:feature 类型: 新特性 x:protocol 属性: 协议相关 s:core 子系统: mirai-core labels Jan 18, 2023
@Him188 Him188 modified the milestones: 2.15, 2.15.0-RC Jan 18, 2023
mirai-core-mock/src/internal/contact/MockVotesImpl.kt Outdated Show resolved Hide resolved
mirai-core-mock/src/internal/contact/MockVotesImpl.kt Outdated Show resolved Hide resolved
Comment on lines 18 to 33
internal class OnlineVoteImpl(
override val group: Group,
override val senderId: Long,
override val sender: NormalMember?,
override val fid: String,
override val publicationTime: Long,
override val endTime: Long,
override var title: String,
override var options: List<String>,
override var select: List<Int>,
override var records: List<OnlineVoteRecord>,
override val parameters: VoteParameters
) : OnlineVote {

override val url: String = "https://client.qun.qq.com/qqweb/m/qun/vote/detail.html?fid=${fid}&groupuin=${group.id}"
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

此 class 需要是 immutable, 不应支持 update 操作

@Him188
Copy link
Member

Him188 commented Apr 4, 2023

Exception in thread "main" kotlinx.serialization.json.internal.JsonDecodingException: Expected start of the object '{', but had 'EOF' instead at path: $
JSON input: <html>
<head><title>502 Bad Gateway</title></head>
<body>
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx</center>
</body>
</html>

	at kotlinx.serialization.json.internal.JsonExceptionsKt.JsonDecodingException(JsonExceptions.kt:24)
	at kotlinx.serialization.json.internal.JsonExceptionsKt.JsonDecodingException(JsonExceptions.kt:32)
	at kotlinx.serialization.json.internal.AbstractJsonLexer.fail(AbstractJsonLexer.kt:584)
	at kotlinx.serialization.json.internal.AbstractJsonLexer.fail$default(AbstractJsonLexer.kt:582)
	at kotlinx.serialization.json.internal.AbstractJsonLexer.fail$kotlinx_serialization_json(AbstractJsonLexer.kt:223)
	at kotlinx.serialization.json.internal.AbstractJsonLexer.unexpectedToken(AbstractJsonLexer.kt:206)
	at kotlinx.serialization.json.internal.StringJsonLexer.consumeNextToken(StringJsonLexer.kt:74)
	at kotlinx.serialization.json.internal.StreamingJsonDecoder.beginStructure(StreamingJsonDecoder.kt:97)
	at net.mamoe.mirai.internal.contact.vote.GroupVoteList$$serializer.deserialize(GroupVoteProtocol.kt:27)
	at net.mamoe.mirai.internal.contact.vote.GroupVoteList$$serializer.deserialize(GroupVoteProtocol.kt:27)
	at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:70)
	at kotlinx.serialization.json.Json.decodeFromString(Json.kt:97)
	at net.mamoe.mirai.utils.JsonStructKt.loadAs(JsonStruct.kt:26)
	at net.mamoe.mirai.utils.JsonStructKt.loadAs$default(JsonStruct.kt:25)
	at net.mamoe.mirai.internal.contact.vote.GroupVoteProtocolKt.getGroupVoteList(GroupVoteProtocol.kt:201)
	at net.mamoe.mirai.internal.contact.vote.GroupVoteProtocolKt$getGroupVoteList$1.invokeSuspend(GroupVoteProtocol.kt)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at io.ktor.util.pipeline.SuspendFunctionGun.resumeRootWith(SuspendFunctionGun.kt:138)
	at io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:112)
	at io.ktor.util.pipeline.SuspendFunctionGun.access$loop(SuspendFunctionGun.kt:14)
	at io.ktor.util.pipeline.SuspendFunctionGun$continuation$1.resumeWith(SuspendFunctionGun.kt:62)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)
	at io.ktor.util.pipeline.SuspendFunctionGun.resumeRootWith(SuspendFunctionGun.kt:138)
	at io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:112)
	at io.ktor.util.pipeline.SuspendFunctionGun.access$loop(SuspendFunctionGun.kt:14)
	at io.ktor.util.pipeline.SuspendFunctionGun$continuation$1.resumeWith(SuspendFunctionGun.kt:62)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)
	at io.ktor.util.pipeline.SuspendFunctionGun.resumeRootWith(SuspendFunctionGun.kt:138)
	at io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:112)
	at io.ktor.util.pipeline.SuspendFunctionGun.access$loop(SuspendFunctionGun.kt:14)
	at io.ktor.util.pipeline.SuspendFunctionGun$continuation$1.resumeWith(SuspendFunctionGun.kt:62)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)
	at io.ktor.util.pipeline.SuspendFunctionGun.resumeRootWith(SuspendFunctionGun.kt:138)
	at io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:112)
	at io.ktor.util.pipeline.SuspendFunctionGun.access$loop(SuspendFunctionGun.kt:14)
	at io.ktor.util.pipeline.SuspendFunctionGun$continuation$1.resumeWith(SuspendFunctionGun.kt:62)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)
	at io.ktor.util.pipeline.SuspendFunctionGun.resumeRootWith(SuspendFunctionGun.kt:138)
	at io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:112)
	at io.ktor.util.pipeline.SuspendFunctionGun.access$loop(SuspendFunctionGun.kt:14)
	at io.ktor.util.pipeline.SuspendFunctionGun$continuation$1.resumeWith(SuspendFunctionGun.kt:62)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)
	at kotlinx.coroutines.DispatchedTaskKt.resume(DispatchedTask.kt:178)
	at kotlinx.coroutines.DispatchedTaskKt.dispatch(DispatchedTask.kt:166)
	at kotlinx.coroutines.CancellableContinuationImpl.dispatchResume(CancellableContinuationImpl.kt:397)
	at kotlinx.coroutines.CancellableContinuationImpl.resumeImpl(CancellableContinuationImpl.kt:431)
	at kotlinx.coroutines.CancellableContinuationImpl.resumeImpl$default(CancellableContinuationImpl.kt:420)
	at kotlinx.coroutines.CancellableContinuationImpl.resumeWith(CancellableContinuationImpl.kt:328)
	at kotlinx.coroutines.ResumeAwaitOnCompletion.invoke(JobSupport.kt:1413)
	at kotlinx.coroutines.JobSupport.notifyCompletion(JobSupport.kt:1520)
	at kotlinx.coroutines.JobSupport.completeStateFinalization(JobSupport.kt:323)
	at kotlinx.coroutines.JobSupport.finalizeFinishingState(JobSupport.kt:240)
	at kotlinx.coroutines.JobSupport.tryMakeCompletingSlowPath(JobSupport.kt:906)
	at kotlinx.coroutines.JobSupport.tryMakeCompleting(JobSupport.kt:863)
	at kotlinx.coroutines.JobSupport.makeCompletingOnce$kotlinx_coroutines_core(JobSupport.kt:828)
	at kotlinx.coroutines.AbstractCoroutine.resumeWith(AbstractCoroutine.kt:100)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
	at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:42)
	at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95)
	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)

@Him188
Copy link
Member

Him188 commented Apr 4, 2023

我现在测试必定 502, 等几天再说

@Him188 Him188 requested a review from Karlatemp April 4, 2023 20:33
@Him188
Copy link
Member

Him188 commented Apr 4, 2023

@Karlatemp @cssxsh 看看 public API?

@sandtechnology
Copy link
Collaborator

群投票功能已经被下线了 所以(

@Him188
Copy link
Member

Him188 commented Apr 5, 2023

确实,测试的时候看到变成了腾讯投票

@cssxsh cssxsh marked this pull request as draft April 10, 2023 14:22
@Him188 Him188 removed this from the 2.15.0-RC milestone Apr 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
s:core 子系统: mirai-core t:feature 类型: 新特性 x:protocol 属性: 协议相关
Projects
None yet
Development

Successfully merging this pull request may close these issues.

增加群投票相关操作
3 participants