Skip to content

Commit

Permalink
fix plugins/auto_reply: put msgdate into db
Browse files Browse the repository at this point in the history
  • Loading branch information
91khr committed Oct 20, 2023
1 parent 9c7f79b commit 47b5b78
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ jobs:
# ssh-keyscan github.com >> ~/.ssh/known_hosts
# git config --global user.name '$DEPLOY_PRI'
# git config --global user.email '$DEPLOY_PRI'

# - name: Update package-lock.json
# run: |
# git add package-lock.json
# git commit -m "Auto Update package-lock" --no-verify
# git push origin main
# git push origin main
8 changes: 7 additions & 1 deletion src/plugins/auto_reply/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,17 @@ const handleReply = async (app: App, msg: Message) => {
if (reply_it === undefined) return;
const rephr = repdate.getHours();
const [lo, hi, rep] = reply_it;
if (lo <= rephr && rephr <= hi && msgdate.getTime() - repdate.getTime() <= 14400_000) return;
if (
lo <= rephr &&
rephr <= hi &&
msgdate.getTime() - repdate.getTime() <= (hi - lo + 1) * 3600_000
)
return;
void app.bot.sendMessage(
msg.chat.id,
rep.replaceAll(/\${(\w*)}/g, (_, s: string) => vars[s])
);
chat[msg.from!.id].last_reply = msgdate;
};

const init: PluginInit = (init_app) => {
Expand Down

0 comments on commit 47b5b78

Please sign in to comment.