2
0
Files
bot/packages/js/src/queries/sendMessageQuery.ts

17 lines
459 B
TypeScript
Raw Normal View History

import { guessApiHost } from '@/utils/guessApiHost'
import type { ChatReply, SendMessageInput } from 'models'
import { isNotEmpty, sendRequest } from 'utils'
export async function sendMessageQuery({
apiHost,
...body
}: SendMessageInput & { apiHost?: string }) {
const response = await sendRequest<ChatReply>({
method: 'POST',
url: `${isNotEmpty(apiHost) ? apiHost : guessApiHost()}/api/v1/sendMessage`,
body,
})
return response.data
}