mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-05 07:30:09 +08:00
Announcement API: Refine naming of properties:
- pinned -> isPinned - popup -> showPopup - needConfirm -> requireConfirmation - readMemberNumber -> confirmedMembersCount - publishTime -> publicationTime - isAllRead -> allConfirmed
This commit is contained in:
parent
881f713be2
commit
a0baa65193
@ -637,12 +637,12 @@ public final class net/mamoe/mirai/contact/announcement/AnnouncementParameters {
|
||||
public fun equals (Ljava/lang/Object;)Z
|
||||
public static final fun getDefault ()Lnet/mamoe/mirai/contact/announcement/AnnouncementParameters;
|
||||
public final fun getImage ()Lnet/mamoe/mirai/contact/announcement/AnnouncementImage;
|
||||
public final fun getNeedConfirm ()Z
|
||||
public final fun getPinned ()Z
|
||||
public final fun getPopup ()Z
|
||||
public final fun getRequireConfirmation ()Z
|
||||
public final fun getSendToNewMember ()Z
|
||||
public final fun getShowEditCard ()Z
|
||||
public final fun getShowPopup ()Z
|
||||
public fun hashCode ()I
|
||||
public final fun isPinned ()Z
|
||||
public fun toString ()Ljava/lang/String;
|
||||
}
|
||||
|
||||
@ -670,22 +670,22 @@ public final class net/mamoe/mirai/contact/announcement/AnnouncementParametersBu
|
||||
public final fun build ()Lnet/mamoe/mirai/contact/announcement/AnnouncementParameters;
|
||||
public final fun image ()Lnet/mamoe/mirai/contact/announcement/AnnouncementImage;
|
||||
public final fun image (Lnet/mamoe/mirai/contact/announcement/AnnouncementImage;)Lnet/mamoe/mirai/contact/announcement/AnnouncementParametersBuilder;
|
||||
public final fun needConfirm ()Z
|
||||
public final fun needConfirm (Z)Lnet/mamoe/mirai/contact/announcement/AnnouncementParametersBuilder;
|
||||
public final fun pinned ()Z
|
||||
public final fun pinned (Z)Lnet/mamoe/mirai/contact/announcement/AnnouncementParametersBuilder;
|
||||
public final fun popup ()Z
|
||||
public final fun popup (Z)Lnet/mamoe/mirai/contact/announcement/AnnouncementParametersBuilder;
|
||||
public final fun isPinned ()Z
|
||||
public final fun isPinned (Z)Lnet/mamoe/mirai/contact/announcement/AnnouncementParametersBuilder;
|
||||
public final fun requireConfirmation ()Z
|
||||
public final fun requireConfirmation (Z)Lnet/mamoe/mirai/contact/announcement/AnnouncementParametersBuilder;
|
||||
public final fun sendToNewMember ()Z
|
||||
public final fun sendToNewMember (Z)Lnet/mamoe/mirai/contact/announcement/AnnouncementParametersBuilder;
|
||||
public final synthetic fun setImage (Lnet/mamoe/mirai/contact/announcement/AnnouncementImage;)V
|
||||
public final synthetic fun setNeedConfirm (Z)V
|
||||
public final synthetic fun setPinned (Z)V
|
||||
public final synthetic fun setPopup (Z)V
|
||||
public final synthetic fun setRequireConfirmation (Z)V
|
||||
public final synthetic fun setSendToNewMember (Z)V
|
||||
public final synthetic fun setShowEditCard (Z)V
|
||||
public final synthetic fun setShowPopup (Z)V
|
||||
public final fun showEditCard ()Z
|
||||
public final fun showEditCard (Z)Lnet/mamoe/mirai/contact/announcement/AnnouncementParametersBuilder;
|
||||
public final fun showPopup ()Z
|
||||
public final fun showPopup (Z)Lnet/mamoe/mirai/contact/announcement/AnnouncementParametersBuilder;
|
||||
}
|
||||
|
||||
public final class net/mamoe/mirai/contact/announcement/AnnouncementParametersBuilderKt {
|
||||
@ -737,13 +737,13 @@ public final class net/mamoe/mirai/contact/announcement/OfflineAnnouncementKt {
|
||||
public abstract interface class net/mamoe/mirai/contact/announcement/OnlineAnnouncement : net/mamoe/mirai/contact/announcement/Announcement {
|
||||
public fun delete ()Z
|
||||
public fun delete (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public abstract fun getAllRead ()Z
|
||||
public abstract fun getConfirmedMembersCount ()I
|
||||
public abstract fun getFid ()Ljava/lang/String;
|
||||
public abstract fun getGroup ()Lnet/mamoe/mirai/contact/Group;
|
||||
public abstract fun getPublishTime ()J
|
||||
public abstract fun getReadMemberNumber ()I
|
||||
public abstract fun getPublicationTime ()J
|
||||
public abstract fun getSender ()Lnet/mamoe/mirai/contact/NormalMember;
|
||||
public abstract fun getSenderId ()J
|
||||
public abstract fun isAllRead ()Z
|
||||
}
|
||||
|
||||
public final class net/mamoe/mirai/contact/announcement/OnlineAnnouncementKt {
|
||||
|
@ -637,12 +637,12 @@ public final class net/mamoe/mirai/contact/announcement/AnnouncementParameters {
|
||||
public fun equals (Ljava/lang/Object;)Z
|
||||
public static final fun getDefault ()Lnet/mamoe/mirai/contact/announcement/AnnouncementParameters;
|
||||
public final fun getImage ()Lnet/mamoe/mirai/contact/announcement/AnnouncementImage;
|
||||
public final fun getNeedConfirm ()Z
|
||||
public final fun getPinned ()Z
|
||||
public final fun getPopup ()Z
|
||||
public final fun getRequireConfirmation ()Z
|
||||
public final fun getSendToNewMember ()Z
|
||||
public final fun getShowEditCard ()Z
|
||||
public final fun getShowPopup ()Z
|
||||
public fun hashCode ()I
|
||||
public final fun isPinned ()Z
|
||||
public fun toString ()Ljava/lang/String;
|
||||
}
|
||||
|
||||
@ -670,22 +670,22 @@ public final class net/mamoe/mirai/contact/announcement/AnnouncementParametersBu
|
||||
public final fun build ()Lnet/mamoe/mirai/contact/announcement/AnnouncementParameters;
|
||||
public final fun image ()Lnet/mamoe/mirai/contact/announcement/AnnouncementImage;
|
||||
public final fun image (Lnet/mamoe/mirai/contact/announcement/AnnouncementImage;)Lnet/mamoe/mirai/contact/announcement/AnnouncementParametersBuilder;
|
||||
public final fun needConfirm ()Z
|
||||
public final fun needConfirm (Z)Lnet/mamoe/mirai/contact/announcement/AnnouncementParametersBuilder;
|
||||
public final fun pinned ()Z
|
||||
public final fun pinned (Z)Lnet/mamoe/mirai/contact/announcement/AnnouncementParametersBuilder;
|
||||
public final fun popup ()Z
|
||||
public final fun popup (Z)Lnet/mamoe/mirai/contact/announcement/AnnouncementParametersBuilder;
|
||||
public final fun isPinned ()Z
|
||||
public final fun isPinned (Z)Lnet/mamoe/mirai/contact/announcement/AnnouncementParametersBuilder;
|
||||
public final fun requireConfirmation ()Z
|
||||
public final fun requireConfirmation (Z)Lnet/mamoe/mirai/contact/announcement/AnnouncementParametersBuilder;
|
||||
public final fun sendToNewMember ()Z
|
||||
public final fun sendToNewMember (Z)Lnet/mamoe/mirai/contact/announcement/AnnouncementParametersBuilder;
|
||||
public final synthetic fun setImage (Lnet/mamoe/mirai/contact/announcement/AnnouncementImage;)V
|
||||
public final synthetic fun setNeedConfirm (Z)V
|
||||
public final synthetic fun setPinned (Z)V
|
||||
public final synthetic fun setPopup (Z)V
|
||||
public final synthetic fun setRequireConfirmation (Z)V
|
||||
public final synthetic fun setSendToNewMember (Z)V
|
||||
public final synthetic fun setShowEditCard (Z)V
|
||||
public final synthetic fun setShowPopup (Z)V
|
||||
public final fun showEditCard ()Z
|
||||
public final fun showEditCard (Z)Lnet/mamoe/mirai/contact/announcement/AnnouncementParametersBuilder;
|
||||
public final fun showPopup ()Z
|
||||
public final fun showPopup (Z)Lnet/mamoe/mirai/contact/announcement/AnnouncementParametersBuilder;
|
||||
}
|
||||
|
||||
public final class net/mamoe/mirai/contact/announcement/AnnouncementParametersBuilderKt {
|
||||
@ -737,13 +737,13 @@ public final class net/mamoe/mirai/contact/announcement/OfflineAnnouncementKt {
|
||||
public abstract interface class net/mamoe/mirai/contact/announcement/OnlineAnnouncement : net/mamoe/mirai/contact/announcement/Announcement {
|
||||
public fun delete ()Z
|
||||
public fun delete (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public abstract fun getAllRead ()Z
|
||||
public abstract fun getConfirmedMembersCount ()I
|
||||
public abstract fun getFid ()Ljava/lang/String;
|
||||
public abstract fun getGroup ()Lnet/mamoe/mirai/contact/Group;
|
||||
public abstract fun getPublishTime ()J
|
||||
public abstract fun getReadMemberNumber ()I
|
||||
public abstract fun getPublicationTime ()J
|
||||
public abstract fun getSender ()Lnet/mamoe/mirai/contact/NormalMember;
|
||||
public abstract fun getSenderId ()J
|
||||
public abstract fun isAllRead ()Z
|
||||
}
|
||||
|
||||
public final class net/mamoe/mirai/contact/announcement/OnlineAnnouncementKt {
|
||||
|
@ -31,13 +31,13 @@ public class AnnouncementParameters internal constructor(
|
||||
/** 发送给新成员 */
|
||||
public val sendToNewMember: Boolean = false,
|
||||
/** 置顶. 可以有多个置顶公告 */
|
||||
public val pinned: Boolean = false,
|
||||
public val isPinned: Boolean = false,
|
||||
/** 显示能够引导群成员修改昵称的窗口 */
|
||||
public val showEditCard: Boolean = false,
|
||||
/** 使用弹窗 */
|
||||
public val popup: Boolean = false,
|
||||
public val showPopup: Boolean = false,
|
||||
/** 需要群成员确认 */
|
||||
public val needConfirm: Boolean = false,
|
||||
public val requireConfirmation: Boolean = false,
|
||||
) {
|
||||
/**
|
||||
* 以该对象作为原型创建一个 [AnnouncementParametersBuilder].
|
||||
@ -46,10 +46,10 @@ public class AnnouncementParameters internal constructor(
|
||||
val outer = this@AnnouncementParameters
|
||||
image(outer.image)
|
||||
sendToNewMember(outer.sendToNewMember)
|
||||
pinned(outer.pinned)
|
||||
isPinned(outer.isPinned)
|
||||
showEditCard(outer.showEditCard)
|
||||
popup(outer.popup)
|
||||
needConfirm(outer.needConfirm)
|
||||
showPopup(outer.showPopup)
|
||||
requireConfirmation(outer.requireConfirmation)
|
||||
}
|
||||
|
||||
public companion object {
|
||||
@ -71,10 +71,10 @@ public class AnnouncementParameters internal constructor(
|
||||
|
||||
if (image != other.image) return false
|
||||
if (sendToNewMember != other.sendToNewMember) return false
|
||||
if (pinned != other.pinned) return false
|
||||
if (isPinned != other.isPinned) return false
|
||||
if (showEditCard != other.showEditCard) return false
|
||||
if (popup != other.popup) return false
|
||||
if (needConfirm != other.needConfirm) return false
|
||||
if (showPopup != other.showPopup) return false
|
||||
if (requireConfirmation != other.requireConfirmation) return false
|
||||
|
||||
return true
|
||||
}
|
||||
@ -82,14 +82,14 @@ public class AnnouncementParameters internal constructor(
|
||||
override fun hashCode(): Int {
|
||||
var result = image?.hashCode() ?: 0
|
||||
result = 31 * result + sendToNewMember.hashCode()
|
||||
result = 31 * result + pinned.hashCode()
|
||||
result = 31 * result + isPinned.hashCode()
|
||||
result = 31 * result + showEditCard.hashCode()
|
||||
result = 31 * result + popup.hashCode()
|
||||
result = 31 * result + needConfirm.hashCode()
|
||||
result = 31 * result + showPopup.hashCode()
|
||||
result = 31 * result + requireConfirmation.hashCode()
|
||||
return result
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
return "AnnouncementParameters(image=$image, sendToNewMember=$sendToNewMember, pinned=$pinned, showEditCard=$showEditCard, popup=$popup, needConfirm=$needConfirm)"
|
||||
return "AnnouncementParameters(image=$image, sendToNewMember=$sendToNewMember, isPinned=$isPinned, showEditCard=$showEditCard, showPopup=$showPopup, requireConfirmation=$requireConfirmation)"
|
||||
}
|
||||
}
|
@ -64,10 +64,10 @@ public class AnnouncementParametersBuilder @JvmOverloads constructor(
|
||||
@JvmSynthetic set
|
||||
|
||||
/**
|
||||
* @see AnnouncementParameters.pinned
|
||||
* @see AnnouncementParameters.isPinned
|
||||
*/
|
||||
public var pinned: Boolean = prototype.pinned
|
||||
@JvmName("pinned") get
|
||||
public var isPinned: Boolean = prototype.isPinned
|
||||
@JvmName("isPinned") get
|
||||
@JvmSynthetic set
|
||||
|
||||
/**
|
||||
@ -78,17 +78,17 @@ public class AnnouncementParametersBuilder @JvmOverloads constructor(
|
||||
@JvmSynthetic set
|
||||
|
||||
/**
|
||||
* @see AnnouncementParameters.popup
|
||||
* @see AnnouncementParameters.showPopup
|
||||
*/
|
||||
public var popup: Boolean = prototype.popup
|
||||
@JvmName("popup") get
|
||||
public var showPopup: Boolean = prototype.showPopup
|
||||
@JvmName("showPopup") get
|
||||
@JvmSynthetic set
|
||||
|
||||
/**
|
||||
* @see AnnouncementParameters.needConfirm
|
||||
* @see AnnouncementParameters.requireConfirmation
|
||||
*/
|
||||
public var needConfirm: Boolean = prototype.needConfirm
|
||||
@JvmName("needConfirm") get
|
||||
public var requireConfirmation: Boolean = prototype.requireConfirmation
|
||||
@JvmName("requireConfirmation") get
|
||||
@JvmSynthetic set
|
||||
|
||||
/**
|
||||
@ -108,10 +108,10 @@ public class AnnouncementParametersBuilder @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
/**
|
||||
* @see AnnouncementParameters.pinned
|
||||
* @see AnnouncementParameters.isPinned
|
||||
*/
|
||||
public fun pinned(isPinned: Boolean): AnnouncementParametersBuilder {
|
||||
this.pinned = isPinned
|
||||
public fun isPinned(isPinned: Boolean): AnnouncementParametersBuilder {
|
||||
this.isPinned = isPinned
|
||||
return this
|
||||
}
|
||||
|
||||
@ -124,18 +124,18 @@ public class AnnouncementParametersBuilder @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
/**
|
||||
* @see AnnouncementParameters.popup
|
||||
* @see AnnouncementParameters.showPopup
|
||||
*/
|
||||
public fun popup(popup: Boolean): AnnouncementParametersBuilder {
|
||||
this.popup = popup
|
||||
public fun showPopup(showPopup: Boolean): AnnouncementParametersBuilder {
|
||||
this.showPopup = showPopup
|
||||
return this
|
||||
}
|
||||
|
||||
/**
|
||||
* @see AnnouncementParameters.needConfirm
|
||||
* @see AnnouncementParameters.requireConfirmation
|
||||
*/
|
||||
public fun needConfirm(needConfirm: Boolean): AnnouncementParametersBuilder {
|
||||
this.needConfirm = needConfirm
|
||||
public fun requireConfirmation(requireConfirmation: Boolean): AnnouncementParametersBuilder {
|
||||
this.requireConfirmation = requireConfirmation
|
||||
return this
|
||||
}
|
||||
|
||||
@ -143,7 +143,7 @@ public class AnnouncementParametersBuilder @JvmOverloads constructor(
|
||||
* 使用当前参数构造 [AnnouncementParameters].
|
||||
*/
|
||||
public fun build(): AnnouncementParameters =
|
||||
AnnouncementParameters(image, sendToNewMember, pinned, showEditCard, popup, needConfirm)
|
||||
AnnouncementParameters(image, sendToNewMember, isPinned, showEditCard, showPopup, requireConfirmation)
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -53,21 +53,21 @@ public interface OnlineAnnouncement : Announcement {
|
||||
public val fid: String
|
||||
|
||||
/**
|
||||
* 所有人都已阅读, 如果 [AnnouncementParameters.needConfirm] 为 `true` 则为所有人都已确认.
|
||||
* 所有人都已阅读, 如果 [AnnouncementParameters.requireConfirmation] 为 `true` 则为所有人都已确认.
|
||||
*/
|
||||
public val isAllRead: Boolean
|
||||
public val allConfirmed: Boolean
|
||||
|
||||
/**
|
||||
* 已经阅读的成员数量,如果 [AnnouncementParameters.needConfirm] 为 `true` 则为已经确认的成员数量
|
||||
* 已经阅读的成员数量,如果 [AnnouncementParameters.requireConfirmation] 为 `true` 则为已经确认的成员数量
|
||||
*/
|
||||
public val readMemberNumber: Int
|
||||
public val confirmedMembersCount: Int
|
||||
|
||||
/**
|
||||
* 公告发出的时间,为 EpochSecond (自 1970-01-01T00:00:00Z 的秒数)
|
||||
*
|
||||
* @see Instant.ofEpochSecond
|
||||
*/
|
||||
public val publishTime: Long
|
||||
public val publicationTime: Long
|
||||
|
||||
/**
|
||||
* 删除这个公告. 需要管理员权限. 使用 [Announcements.delete] 与此方法效果相同.
|
||||
|
@ -28,9 +28,9 @@ internal data class OnlineAnnouncementImpl(
|
||||
override val content: String,
|
||||
override val parameters: AnnouncementParameters,
|
||||
override val fid: String,
|
||||
override val isAllRead: Boolean,
|
||||
override val readMemberNumber: Int,
|
||||
override val publishTime: Long,
|
||||
override val allConfirmed: Boolean,
|
||||
override val confirmedMembersCount: Int,
|
||||
override val publicationTime: Long,
|
||||
) : OnlineAnnouncement {
|
||||
//
|
||||
// @Serializable
|
||||
|
@ -107,10 +107,10 @@ internal class AnnouncementsImpl(
|
||||
return mutableListOf<String>().apply {
|
||||
if (image != null) add("with image")
|
||||
if (sendToNewMember) add("sendToNewMember")
|
||||
if (pinned) add("pinned")
|
||||
if (isPinned) add("pinned")
|
||||
if (showEditCard) add("showEditCard")
|
||||
if (popup) add("popup")
|
||||
if (needConfirm) add("needConfirm")
|
||||
if (showPopup) add("popup")
|
||||
if (requireConfirmation) add("needConfirm")
|
||||
}.joinToString()
|
||||
}
|
||||
|
||||
@ -129,9 +129,9 @@ internal class AnnouncementsImpl(
|
||||
content = content,
|
||||
parameters = parameters,
|
||||
fid = fid,
|
||||
isAllRead = false,
|
||||
readMemberNumber = 0,
|
||||
publishTime = currentTimeSeconds()
|
||||
allConfirmed = false,
|
||||
confirmedMembersCount = 0,
|
||||
publicationTime = currentTimeSeconds()
|
||||
).also {
|
||||
logger.verbose { "Publishing announcement #$id: success." }
|
||||
}
|
||||
@ -293,10 +293,10 @@ internal object AnnouncementProtocol {
|
||||
type = if (parameters.sendToNewMember) 20 else 6,
|
||||
settings = GroupAnnouncementSettings(
|
||||
isShowEditCard = if (parameters.showEditCard) 1 else 0,
|
||||
tipWindowType = if (parameters.popup) 0 else 1,
|
||||
confirmRequired = if (parameters.needConfirm) 1 else 0,
|
||||
tipWindowType = if (parameters.showPopup) 0 else 1,
|
||||
confirmRequired = if (parameters.requireConfirmation) 1 else 0,
|
||||
),
|
||||
pinned = if (parameters.pinned) 1 else 0,
|
||||
pinned = if (parameters.isPinned) 1 else 0,
|
||||
)
|
||||
}
|
||||
|
||||
@ -309,16 +309,16 @@ internal object AnnouncementProtocol {
|
||||
sender = group[sender],
|
||||
content = msg.text,
|
||||
parameters = buildAnnouncementParameters {
|
||||
pinned = this@toAnnouncement.pinned == 1
|
||||
isPinned = this@toAnnouncement.pinned == 1
|
||||
sendToNewMember = type == 20
|
||||
popup = settings.tipWindowType == 0
|
||||
needConfirm = settings.confirmRequired == 1
|
||||
showPopup = settings.tipWindowType == 0
|
||||
requireConfirmation = settings.confirmRequired == 1
|
||||
showEditCard = settings.isShowEditCard == 1
|
||||
},
|
||||
fid = fid,
|
||||
isAllRead = isAllConfirm != 0,
|
||||
readMemberNumber = readNum,
|
||||
publishTime = time
|
||||
allConfirmed = isAllConfirm != 0,
|
||||
confirmedMembersCount = readNum,
|
||||
publicationTime = time
|
||||
)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user