mirror of
https://github.com/chrononeko/chronocat.git
synced 2024-11-21 22:58:10 +00:00
fix(api): fix common send
This commit is contained in:
parent
c3d3974643
commit
5467e7bfd9
@ -10,13 +10,17 @@ export const commonSend = async (
|
||||
peer: Partial<Peer>,
|
||||
elements: O.Partial<Element, 'deep'>[],
|
||||
) => {
|
||||
const privatePeerUid = await ctx.chronocat.uix.getUid2(peer.peerUid!)
|
||||
if (!privatePeerUid) {
|
||||
ctx.chronocat.l.error('内部错误', {
|
||||
code: 2152,
|
||||
throw: true,
|
||||
})
|
||||
return Promise.resolve<RedMessage>(undefined as unknown as RedMessage)
|
||||
let privatePeerUid: string | undefined = undefined
|
||||
|
||||
if (peer.chatType === ChatType.Private) {
|
||||
privatePeerUid = await ctx.chronocat.uix.getUid2(peer.peerUid!)
|
||||
if (!privatePeerUid) {
|
||||
ctx.chronocat.l.error('内部错误', {
|
||||
code: 2152,
|
||||
throw: true,
|
||||
})
|
||||
return Promise.resolve<RedMessage>(undefined as unknown as RedMessage)
|
||||
}
|
||||
}
|
||||
|
||||
const param = {
|
||||
@ -26,7 +30,7 @@ export const commonSend = async (
|
||||
peer.chatType === ChatType.Private
|
||||
? {
|
||||
chatType: ChatType.Private,
|
||||
peerUid: privatePeerUid,
|
||||
peerUid: privatePeerUid!,
|
||||
}
|
||||
: (peer as Peer),
|
||||
msgElements: elements,
|
||||
|
Loading…
Reference in New Issue
Block a user