* Filter out Uint8Array arguments in data.args and convert them to a Buffer using b4a library if needed.
This commit is contained in:
parent
a53c238889
commit
473f678a45
14
src/index.ts
14
src/index.ts
|
@ -216,8 +216,18 @@ class Message extends Client {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
async (data: any) => {
|
async (data: any) => {
|
||||||
if (data?.args && data?.args[0] instanceof Uint8Array) {
|
if (data.args) {
|
||||||
data.args[0] = b4a.from(data.args[0]);
|
data.args = data.args.filter((arg: any) => {
|
||||||
|
if (arg instanceof Uint8Array) {
|
||||||
|
return b4a.from(arg);
|
||||||
|
}
|
||||||
|
|
||||||
|
return arg;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data?.args && data?.args[0]?.buffer instanceof Uint8Array) {
|
||||||
|
data.args[0].buffer = b4a.from(data.args[0].buffer);
|
||||||
}
|
}
|
||||||
switch (data.action) {
|
switch (data.action) {
|
||||||
case "encode":
|
case "encode":
|
||||||
|
|
Loading…
Reference in New Issue