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

Add RequestEventData for saving request events #1309

Merged
merged 3 commits into from
Aug 12, 2021

Conversation

Karlatemp
Copy link
Member

close #1145

@Karlatemp Karlatemp added t:feature 类型: 新特性 N 优先级: 一般 labels Jun 6, 2021
@Karlatemp Karlatemp requested a review from Him188 June 6, 2021 09:36
@Him188 Him188 added this to the 2.7-M2 milestone Jun 6, 2021
@Karlatemp Karlatemp force-pushed the karlatemp/serialize-reqest-events branch from 4ee7bc3 to de9d8aa Compare June 7, 2021 05:31
@Karlatemp Karlatemp requested a review from Him188 June 7, 2021 06:29
@Karlatemp Karlatemp force-pushed the karlatemp/serialize-reqest-events branch from afba0ad to bca7fcf Compare June 21, 2021 03:46
@Him188 Him188 modified the milestones: 2.7-M2, 2.8-M1 Jun 24, 2021
@Him188

This comment has been minimized.

@Him188 Him188 modified the milestones: 2.8-M1, 2.8 Jul 7, 2021
Copy link
Member

@Him188 Him188 left a comment

Choose a reason for hiding this comment

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

如果设计为每个事件一种 Ticket (或是更好的名称) 是否更好? 名称更精简

public sealed interface EventTicket {
    public val botId: Long
}

@Serializable
public class MemberInvitationTicket(
    public override val botId: Long,
    public val groupId: Long,
    public val eventId: Long,
    public val invitorId: Long,
    public val groupName: String,
    public val invitorNick: String,
)  : EventTicket

public data class BotInvitedJoinGroupRequestEvent { 
    public fun createTicket(): MemberInvitationTicket = TODO()
}

用户如果以 MemberInvitationTicket 类型序列化, 则会直接使用 MemberInvitationTicket 的 serializer. 而如果使用 EventTicket, 用户可以选择使用 contextual serializer 或 polymorphic serializer

@Karlatemp Karlatemp force-pushed the karlatemp/serialize-reqest-events branch from bca7fcf to 56e43c3 Compare August 11, 2021 14:55
@Karlatemp Karlatemp requested a review from Him188 August 11, 2021 15:00
@Him188 Him188 merged commit 8a607ed into dev Aug 12, 2021
@Him188 Him188 deleted the karlatemp/serialize-reqest-events branch August 12, 2021 06:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
N 优先级: 一般 t:feature 类型: 新特性
Projects
None yet
Development

Successfully merging this pull request may close these issues.

希望提供群成员事件和新好友申请事件的构造方法
2 participants