mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-20 16:14:43 +08:00
Broadcast FriendAddEvent on acceptNewFriendRequest
This commit is contained in:
parent
45072c92d3
commit
3098a7d953
@ -21,6 +21,7 @@ import net.mamoe.mirai.contact.Group
|
||||
import net.mamoe.mirai.contact.User
|
||||
import net.mamoe.mirai.event.AbstractEvent
|
||||
import net.mamoe.mirai.internal.network.Packet
|
||||
import net.mamoe.mirai.utils.MiraiInternalApi
|
||||
import java.util.concurrent.atomic.AtomicBoolean
|
||||
|
||||
|
||||
@ -36,7 +37,7 @@ public data class FriendRemarkChangeEvent internal constructor(
|
||||
/**
|
||||
* 成功添加了一个新好友的事件
|
||||
*/
|
||||
public data class FriendAddEvent internal constructor(
|
||||
public data class FriendAddEvent @MiraiInternalApi constructor(
|
||||
/**
|
||||
* 新好友. 已经添加到 [Bot.friends]
|
||||
*/
|
||||
|
@ -21,10 +21,7 @@ import net.mamoe.mirai.*
|
||||
import net.mamoe.mirai.contact.*
|
||||
import net.mamoe.mirai.data.*
|
||||
import net.mamoe.mirai.event.broadcast
|
||||
import net.mamoe.mirai.event.events.BotInvitedJoinGroupRequestEvent
|
||||
import net.mamoe.mirai.event.events.MemberJoinEvent
|
||||
import net.mamoe.mirai.event.events.MemberJoinRequestEvent
|
||||
import net.mamoe.mirai.event.events.NewFriendRequestEvent
|
||||
import net.mamoe.mirai.event.events.*
|
||||
import net.mamoe.mirai.internal.contact.*
|
||||
import net.mamoe.mirai.internal.message.*
|
||||
import net.mamoe.mirai.internal.network.highway.HighwayHelper
|
||||
@ -137,6 +134,10 @@ internal open class MiraiImpl : IMirai, LowLevelApiAccessor {
|
||||
accept = true,
|
||||
blackList = false
|
||||
)
|
||||
|
||||
event.bot.getFriend(event.fromId)?.let { friend ->
|
||||
FriendAddEvent(friend).broadcast()
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun rejectNewFriendRequest(event: NewFriendRequestEvent, blackList: Boolean) {
|
||||
|
Loading…
Reference in New Issue
Block a user