From 47cab8021d040fa41a20fb3e1998bc098c8aeded Mon Sep 17 00:00:00 2001 From: "Kay Marquardt (Gnadelwartz)" Date: Mon, 25 Jan 2021 22:32:14 +0100 Subject: [PATCH] bin: kickban + promote user --- bin/kickban_user.sh | 47 +++++++++++++++++++++++++++++++++++++++++++++ bin/promote_user.sh | 46 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 93 insertions(+) create mode 100755 bin/kickban_user.sh create mode 100755 bin/promote_user.sh diff --git a/bin/kickban_user.sh b/bin/kickban_user.sh new file mode 100755 index 0000000..c6acf8a --- /dev/null +++ b/bin/kickban_user.sh @@ -0,0 +1,47 @@ +#!/bin/bash +# shellcheck disable=SC1090,SC2034 +#=============================================================================== +# +# FILE: bin/kickban_user.sh +# +USAGE='kickban_user.sh [-h|--help] [-u|--unban] "CHAT[ID]" "USER[ID]" [debug]' +# +# DESCRIPTION: kickban or unban a user from the given group +# +# OPTIONS: -u | --unban - unban user +# CHAT[ID] - ID number of CHAT or BOTADMIN to send to yourself +# USER[ID] - user to (un)ban +# +# -h - display short help +# --help - this help +# +# +# LICENSE: WTFPLv2 http://www.wtfpl.net/txt/copying/ +# AUTHOR: KayM (gnadelwartz), kay@rrr.de +# CREATED: 25.01.2021 20:34 +# +#### $$VERSION$$ v1.35-dev-11-g6b102a7 +#=============================================================================== + +#### +# parse args +BAN="kick_chat_member" +case "$1" in + "-u"|"--unban") + BAN="unban_chat_member" + shift + ;; +esac + +# set bashbot environment +source "${0%/*}/bashbot_env.inc.sh" "${3:-debug}" # $3 debug +print_help "$1" + +#### +# ready, do stuff here ----- + +# send message in selected format +"${BAN}" "$1" "$2" + +# output send message result +print_result diff --git a/bin/promote_user.sh b/bin/promote_user.sh new file mode 100755 index 0000000..3fa3961 --- /dev/null +++ b/bin/promote_user.sh @@ -0,0 +1,46 @@ +#!/bin/bash +# shellcheck disable=SC1090,SC2034 +#=============================================================================== +# +# FILE: bin/promote_user.sh +# +USAGE='promote_user.sh [-h|--help] "CHAT[ID]" "USER[ID]" "right[:true|false]" ..' +# +# DESCRIPTION: promote / denote user rights in given group +# +# OPTIONS: CHAT[ID] - ID number of CHAT or BOTADMIN to send to yourself +# USER[ID] - user to (un)ban +# rights[:true|false] - rights to grant in long or short form, +# followed by :true to grant or :false to renove +# long: is_anonymous can_change_info can_post_messages can_edit_messages +# can_delete_messages can_invite_users can_restrict_members +# can_pin_messages can_promote_member` +# short: anon change post edit delete invite restrict pin promote +# +# -h - display short help +# --help - this help +# +# +# LICENSE: WTFPLv2 http://www.wtfpl.net/txt/copying/ +# AUTHOR: KayM (gnadelwartz), kay@rrr.de +# CREATED: 25.01.2021 22:34 +# +#### $$VERSION$$ v1.35-dev-11-g6b102a7 +#=============================================================================== + +#### +# parse args +PROMOTE="promote_chat_member" + +# set bashbot environment +source "${0%/*}/bashbot_env.inc.sh" "debug" # debug +print_help "$1" + +#### +# ready, do stuff here ----- + +# send message in selected format +"${PROMOTE}" "$@" + +# output send message result +print_result