|
@@ -235,12 +235,16 @@ async function sendMessage(message) {
|
|
|
username: chatUserName,
|
|
username: chatUserName,
|
|
|
message: message
|
|
message: message
|
|
|
}));
|
|
}));
|
|
|
|
|
+ let mentions = [];
|
|
|
await setTimeout(() => {
|
|
await setTimeout(() => {
|
|
|
const mentionRegex = /@([a-zA-Z0-9_]+_mesa\d+|IAKlein)/g;
|
|
const mentionRegex = /@([a-zA-Z0-9_]+_mesa\d+|IAKlein)/g;
|
|
|
const mentions = message.match(mentionRegex);
|
|
const mentions = message.match(mentionRegex);
|
|
|
if (mentions) {
|
|
if (mentions) {
|
|
|
mentions.forEach(mention => {
|
|
mentions.forEach(mention => {
|
|
|
const username = mention.slice(1);
|
|
const username = mention.slice(1);
|
|
|
|
|
+ const exist = mentions.find(u => u === username);
|
|
|
|
|
+ if (!exist && username === chatUserName) return; // don't mention myself if multiple mentions
|
|
|
|
|
+ mentions.push(username);
|
|
|
if (username === "IAKlein"){
|
|
if (username === "IAKlein"){
|
|
|
sendMessageToAI(message);
|
|
sendMessageToAI(message);
|
|
|
}else {
|
|
}else {
|