0201
Some checks failed
test / Run tests (push) Failing after 15s
build / Build (push) Failing after 22s
Some checks failed
test / Run tests (push) Failing after 15s
build / Build (push) Failing after 22s
This commit is contained in:
parent
23b8efcdf5
commit
8ae6fcc8f9
@ -2,7 +2,8 @@ import { Message, MessageConnect } from "./server";
|
|||||||
|
|
||||||
export async function sendMessage(msg: Message, action: string, data?: any): Promise<any> {
|
export async function sendMessage(msg: Message, action: string, data?: any): Promise<any> {
|
||||||
const res = await msg.sendMessage({ action, data });
|
const res = await msg.sendMessage({ action, data });
|
||||||
if (res.code) {
|
console.log(action, data, res);
|
||||||
|
if (res && res.code) {
|
||||||
console.error(res);
|
console.error(res);
|
||||||
return Promise.reject(res.message);
|
return Promise.reject(res.message);
|
||||||
} else {
|
} else {
|
||||||
|
@ -91,7 +91,6 @@ export class Group {
|
|||||||
// 转发消息
|
// 转发消息
|
||||||
export function forwardMessage(path: string, from: Server, to: Message) {
|
export function forwardMessage(path: string, from: Server, to: Message) {
|
||||||
from.on(path, (params, fromCon) => {
|
from.on(path, (params, fromCon) => {
|
||||||
console.log(params, fromCon);
|
|
||||||
if (fromCon) {
|
if (fromCon) {
|
||||||
to.connect({ action: path, data: params }).then((toCon) => {
|
to.connect({ action: path, data: params }).then((toCon) => {
|
||||||
fromCon.onMessage((data) => {
|
fromCon.onMessage((data) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user