From 35d5e05ea91cb07c2450bc70d5878f7551b3831d Mon Sep 17 00:00:00 2001 From: "Kay Marquardt (Gnadelwartz)" Date: Thu, 18 Jun 2020 12:36:34 +0200 Subject: [PATCH] log deleteMessage --- bashbot.sh | 4 +++- doc/0_install.md | 4 ++-- modules/sendMessage.sh | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/bashbot.sh b/bashbot.sh index 3478d7d..e91779a 100755 --- a/bashbot.sh +++ b/bashbot.sh @@ -11,7 +11,7 @@ # This file is public domain in the USA and all free countries. # Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying) # -#### $$VERSION$$ v0.98-dev-37-g3cd8dc9 +#### $$VERSION$$ v0.98-dev-38-g215667b # # Exit Codes: # - 0 sucess (hopefully) @@ -298,8 +298,10 @@ killallproc() { } +# $ chat $2 mesgid $3 nolog declare -xr DELETE_URL=$URL'/deleteMessage' delete_message() { + [ -z "$3" ] && printf "%s: Delete Message CHAT=%s MSG_ID=%s\n" "$(date)" "${1}" "${2}" >>"${UPDATELOG}" sendJson "${1}" '"message_id": '"${2}"'' "${DELETE_URL}" } diff --git a/doc/0_install.md b/doc/0_install.md index b0eece0..c27ab9e 100644 --- a/doc/0_install.md +++ b/doc/0_install.md @@ -52,7 +52,7 @@ see e.g. [Install Bash on Mac](http://macappstore.org/bash/) environment variable before running bashbot, e.g. the gnu versions of sed, grep, find ... I considered to make bashbot BSD sed compatible, but much of the bashbot "magic" relies on -(gnu) sed features, e.g. alternation ```|```, non printables ```\n\t\<```) or repeat ```?+``` pattern, not supported by BSD sed. +(gnu) sed features, e.g. alternation ```|```, non printables ```\n\t\<``` or repeat ```?+``` pattern, not supported by BSD sed. BSD/MacOS sed compatibility will result in a rewrite of all grep/sed commands with an uncertain outcome, see [BSD/MacOS vs. GNU sed](https://riptutorial.com/sed/topic/9436/bsd-macos-sed-vs--gnu-sed-vs--the-posix-sed-specification) to get an impression how different they are. @@ -107,5 +107,5 @@ The old format is supported for backward compatibility, but may fail for corner #### [Next Create Bot](1_firstbot.md) -#### $$VERSION$$ v0.98-dev-35-gea27513 +#### $$VERSION$$ v0.98-dev-38-g215667b diff --git a/modules/sendMessage.sh b/modules/sendMessage.sh index a506c26..17c6cba 100644 --- a/modules/sendMessage.sh +++ b/modules/sendMessage.sh @@ -5,7 +5,7 @@ # This file is public domain in the USA and all free countries. # Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying) # -#### $$VERSION$$ v0.98-dev-17-gdda5b6d +#### $$VERSION$$ v0.98-dev-38-g215667b # will be automatically sourced from bashbot @@ -75,7 +75,7 @@ old_send_keyboard() { ISEMPTY="ThisTextIsEmptyAndWillBeDeleted" sendEmpty() { sendJson "${@}" - [[ "${2}" = *"${ISEMPTY}"* ]] && delete_message "${1}" "${BOTSENT[ID]}" + [[ "${2}" = *"${ISEMPTY}"* ]] && delete_message "${1}" "${BOTSENT[ID]}" "nolog" } send_keyboard() { if [[ "$3" != *'['* ]]; then old_send_keyboard "${@}"; return; fi