log deleteMessage

This commit is contained in:
Kay Marquardt (Gnadelwartz) 2020-06-18 12:36:34 +02:00
parent 215667b3ef
commit 35d5e05ea9
3 changed files with 7 additions and 5 deletions

View File

@ -11,7 +11,7 @@
# This file is public domain in the USA and all free countries. # This file is public domain in the USA and all free countries.
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying) # Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
# #
#### $$VERSION$$ v0.98-dev-37-g3cd8dc9 #### $$VERSION$$ v0.98-dev-38-g215667b
# #
# Exit Codes: # Exit Codes:
# - 0 sucess (hopefully) # - 0 sucess (hopefully)
@ -298,8 +298,10 @@ killallproc() {
} }
# $ chat $2 mesgid $3 nolog
declare -xr DELETE_URL=$URL'/deleteMessage' declare -xr DELETE_URL=$URL'/deleteMessage'
delete_message() { 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}" sendJson "${1}" '"message_id": '"${2}"'' "${DELETE_URL}"
} }

View File

@ -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 ... 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 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, 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) 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. 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) #### [Next Create Bot](1_firstbot.md)
#### $$VERSION$$ v0.98-dev-35-gea27513 #### $$VERSION$$ v0.98-dev-38-g215667b

View File

@ -5,7 +5,7 @@
# This file is public domain in the USA and all free countries. # This file is public domain in the USA and all free countries.
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying) # 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 # will be automatically sourced from bashbot
@ -75,7 +75,7 @@ old_send_keyboard() {
ISEMPTY="ThisTextIsEmptyAndWillBeDeleted" ISEMPTY="ThisTextIsEmptyAndWillBeDeleted"
sendEmpty() { sendEmpty() {
sendJson "${@}" sendJson "${@}"
[[ "${2}" = *"${ISEMPTY}"* ]] && delete_message "${1}" "${BOTSENT[ID]}" [[ "${2}" = *"${ISEMPTY}"* ]] && delete_message "${1}" "${BOTSENT[ID]}" "nolog"
} }
send_keyboard() { send_keyboard() {
if [[ "$3" != *'['* ]]; then old_send_keyboard "${@}"; return; fi if [[ "$3" != *'['* ]]; then old_send_keyboard "${@}"; return; fi