Fix chat messages

This commit is contained in:
Hri7566 2024-02-23 00:06:34 -05:00
parent f7490c1190
commit efa20e09ad
2 changed files with 26 additions and 2 deletions

View File

@ -66,7 +66,7 @@ export async function tick() {
: "massive"; : "massive";
addBack(winner.id, { addBack(winner.id, {
m: "sendchat", m: "sendchat",
message: `Our good friend ${user.name} caught a ${size} ${ message: `Our good friend @${user.id} caught a ${size} ${
animal.emoji || "🐟" animal.emoji || "🐟"
}${animal.name}! ready to ${prefixes[0]}eat or ${ }${animal.name}! ready to ${prefixes[0]}eat or ${
prefixes[0] prefixes[0]

View File

@ -145,7 +145,8 @@ export class MPPNetBot {
}); });
if (!command) return; if (!command) return;
if (command.response) this.sendChat(command.response, msg.id); if (command.response)
this.sendDM(command.response, msg.sender._id, msg.id);
} }
); );
@ -202,6 +203,29 @@ export class MPPNetBot {
} }
} }
} }
public sendDM(text: string, dm: string, reply_to?: string) {
let lines = text.split("\n");
for (const line of lines) {
if (line.length <= 510) {
(this.client as any).sendArray([
{
m: "dm",
message: `\u034f${line
.split("\t")
.join("")
.split("\r")
.join("")}`,
_id: dm,
reply_to: reply_to
}
]);
} else {
this.sendChat(line);
}
}
}
} }
export default MPPNetBot; export default MPPNetBot;