Skip to content

Commit

Permalink
Merge pull request #752 from hktrpg/cmd-edit-mode
Browse files Browse the repository at this point in the history
Cmd edit mode and use with number
  • Loading branch information
zeteticl authored Sep 15, 2024
2 parents 103c94e + 226f3d0 commit d0f055b
Show file tree
Hide file tree
Showing 3 changed files with 673 additions and 593 deletions.
17 changes: 17 additions & 0 deletions modules/records.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,23 @@ class Records extends EventEmitter {
// return JSON.stringify(doc).toString();
});
}
editSettrpgCommandfunction(dbbase, msg, callback) {
console.log("editSettrpgCommandfunction: " + msg.trpgCommandfunction[0]?.topic);
const topicRegex = new RegExp(`^${msg.trpgCommandfunction[0]?.topic}$`, 'i');
console.log("topicRegex: " + topicRegex);
schema[dbbase].findOneAndUpdate(
{ groupid: msg.groupid, "trpgCommandfunction.topic": topicRegex },
{ $set: { "trpgCommandfunction.$.contact": msg.trpgCommandfunction[0].contact } },
{ new: true, upsert: false },
(err, doc) => {
if (err) {
console.error("Something wrong when updating data!", err);
} else {
callback(doc);
}
}
);
}


/*
Expand Down
Loading

0 comments on commit d0f055b

Please sign in to comment.