generated from array-in-a-matrix/matrix-bot-template
counter error fixed
This commit is contained in:
parent
38836980ff
commit
cd3c46deed
1
example.count.json
Normal file
1
example.count.json
Normal file
|
@ -0,0 +1 @@
|
|||
{"count":{},"max":{"username":"","count":0}}
|
4
index.js
4
index.js
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue