counter increases from other rooms #1

Closed
opened 2022-08-15 20:48:26 -04:00 by array-in-a-matrix · 3 comments

make counter for each room the bot is in, to prevent spam.

make counter for each room the bot is in, to prevent spam.
Author
Owner

make counter for each room

typescript:

const counters = new Map<string, number>(); // room ID, message count
client.on("room.message", (roomId: string, event: any) => {
  counters.set(roomId, (counters.get(roomId) ?? 0) + 1);
});
make counter for each room typescript: ```ts const counters = new Map<string, number>(); // room ID, message count client.on("room.message", (roomId: string, event: any) => { counters.set(roomId, (counters.get(roomId) ?? 0) + 1); }); ```
Author
Owner
var counters = new Map(); // room ID, message count
client.on("room.message", function (roomId, event) {
    var _a;
    counters.set(roomId, ((_a = counters.get(roomId)) !== null && _a !== void 0 ? _a : 0) + 1);
});



```js var counters = new Map(); // room ID, message count client.on("room.message", function (roomId, event) { var _a; counters.set(roomId, ((_a = counters.get(roomId)) !== null && _a !== void 0 ? _a : 0) + 1); }); ```
Author
Owner

4774610dad should fix this

4774610dad should fix this
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
array-in-a-matrix/text-gen-bot#1
No description provided.