mirror of
https://github.com/octoleo/telegram-bot-bash.git
synced 2024-12-27 12:42:40 +00:00
49 lines
1.2 KiB
Bash
Executable File
49 lines
1.2 KiB
Bash
Executable File
#!/bin/bash
|
|
# shellcheck disable=SC1090,SC2034
|
|
#===============================================================================
|
|
#
|
|
# FILE: bin/delete_message.sh
|
|
#
|
|
USAGE='delete_message.sh [-h|--help] "CHAT[ID]" "MESSAGE[ID]" [debug]'
|
|
#
|
|
# DESCRIPTION: delete a message in the given user/group
|
|
#
|
|
# OPTIONS: CHAT[ID] - ID number of CHAT or BOTADMIN
|
|
# MESSAGE[ID] - message to delete
|
|
#
|
|
# -h - display short help
|
|
# --help - this help
|
|
#
|
|
# Set BASHBOT_HOME to your installation directory
|
|
#
|
|
# LICENSE: WTFPLv2 http://www.wtfpl.net/txt/copying/
|
|
# AUTHOR: KayM (gnadelwartz), kay@rrr.de
|
|
# CREATED: 03.01.2021 15:37
|
|
#
|
|
#### $$VERSION$$ v1.40-0-gf9dab50
|
|
#===============================================================================
|
|
|
|
####
|
|
# parse args
|
|
DELETE="delete_message"
|
|
|
|
# set bashbot environment
|
|
source "${0%/*}/bashbot_env.inc.sh" "${3:-debug}" # $3 debug
|
|
print_help "$1"
|
|
|
|
####
|
|
# ready, do stuff here -----
|
|
if [ "$1" == "BOTADMIN" ]; then
|
|
CHAT="${BOT_ADMIN}"
|
|
else
|
|
CHAT="$1"
|
|
fi
|
|
|
|
# delete message
|
|
"${DELETE}" "${CHAT}" "$2"
|
|
|
|
[ "${BOTSENT[OK]}" = "true" ] && BOTSENT[ID]="$2"
|
|
|
|
# output send message result
|
|
print_result
|