fix(dm): guard sendDmChannelInvite when contacts module is older
Fall back to dm.gossipDmChannelUpsert so open-dm works without a stale pearcord-contacts copy missing sendDmChannelInvite. Co-authored-by: Cursor <[email protected]>
This commit is contained in:
@@ -1035,8 +1035,10 @@ class PearcordPlatform extends EventEmitter {
|
||||
}))
|
||||
: false
|
||||
const channel = await this.dm.openWithPeer({ peerUserId, peerDisplayName })
|
||||
if (this.contacts) {
|
||||
if (typeof this.contacts?.sendDmChannelInvite === 'function') {
|
||||
await this.contacts.sendDmChannelInvite(peerUserId, channel).catch(() => {})
|
||||
} else if (this.dm?.gossipDmChannelUpsert) {
|
||||
this.dm.gossipDmChannelUpsert(channel)
|
||||
}
|
||||
this.messages.setChannel({ channelId: channel.id, guildId: DM_GUILD_ID })
|
||||
this.activeChannelId = channel.id
|
||||
|
||||
Reference in New Issue
Block a user