counter error fixed

This commit is contained in:
array-in-a-matrix 2023-10-25 21:50:21 -04:00
parent 38836980ff
commit cd3c46deed
2 changed files with 3 additions and 2 deletions

1
example.count.json Normal file
View file

@ -0,0 +1 @@
{"count":{},"max":{"username":"","count":0}}

View file

@ -33,11 +33,11 @@ const lbCommand = async (roomId, message) => {
};
const countCommand = async (roomId, message) => {
client.replyNotice(roomId, message, `You said linux ${data.count[message.author.id]} times`)
client.replyNotice(roomId, message, `You said linux ${message["sender"]} times`)
};
const addCount = async (roomId, message) => {
if (!(message["sender"] in data.count)) { //! TypeError: Cannot use 'in' operator to search for '@local:domain.tld' in undefined
if (!(message["sender"] in data.count)) {
data.count[message["sender"]] = 0;
}
if (++data.count[message["sender"]] % 10 === 0) {