Fix chat messages
This commit is contained in:
parent
f7490c1190
commit
efa20e09ad
|
@ -66,7 +66,7 @@ export async function tick() {
|
|||
: "massive";
|
||||
addBack(winner.id, {
|
||||
m: "sendchat",
|
||||
message: `Our good friend ${user.name} caught a ${size} ${
|
||||
message: `Our good friend @${user.id} caught a ${size} ${
|
||||
animal.emoji || "🐟"
|
||||
}${animal.name}! ready to ${prefixes[0]}eat or ${
|
||||
prefixes[0]
|
||||
|
|
|
@ -145,7 +145,8 @@ export class MPPNetBot {
|
|||
});
|
||||
|
||||
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;
|
||||
|
|
Loading…
Reference in New Issue