mirror of
https://github.com/octoleo/telegram-bot-bash.git
synced 2025-01-16 02:42:19 +00:00
adjust examples to v0.90
This commit is contained in:
parent
9a81e440f1
commit
6302ef4795
@ -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.90-2-g274f5d8
|
#### $$VERSION$$ v0.90-3-g9a81e44
|
||||||
#
|
#
|
||||||
# Exit Codes:
|
# Exit Codes:
|
||||||
# - 0 sucess (hopefully)
|
# - 0 sucess (hopefully)
|
||||||
|
@ -36,12 +36,6 @@ mycommands() {
|
|||||||
|
|
||||||
# place your additional processing functions here ...
|
# place your additional processing functions here ...
|
||||||
|
|
||||||
# returns true if function exist
|
|
||||||
_is_function()
|
|
||||||
{
|
|
||||||
[ "$(LC_ALL=C type -t "$1")" = "function" ]
|
|
||||||
}
|
|
||||||
|
|
||||||
# inifnite loop for waching a given dir for new files
|
# inifnite loop for waching a given dir for new files
|
||||||
# $1 dir to wtach for new files
|
# $1 dir to wtach for new files
|
||||||
watch_dir_loop() {
|
watch_dir_loop() {
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
# to show how you can customize bashbot by only editing mycommands.sh
|
# to show how you can customize bashbot by only editing mycommands.sh
|
||||||
# NOTE: this is not tested, simply copied from original source and reworked!
|
# NOTE: this is not tested, simply copied from original source and reworked!
|
||||||
#
|
#
|
||||||
#### $$VERSION$$ v0.90-0-g7029f7f
|
#### $$VERSION$$ v0.90-3-g9a81e44
|
||||||
#
|
#
|
||||||
# shellcheck disable=SC2154
|
# shellcheck disable=SC2154
|
||||||
# shellcheck disable=SC2034
|
# shellcheck disable=SC2034
|
||||||
@ -35,16 +35,10 @@ bashbot_help='*Availiable commands*:
|
|||||||
# your additional bahsbot commands
|
# your additional bahsbot commands
|
||||||
# NOTE: command can have @botname attached, you must add * in case tests...
|
# NOTE: command can have @botname attached, you must add * in case tests...
|
||||||
mycommands() {
|
mycommands() {
|
||||||
[[ "$MESSAGE" = '/'* ]] || return
|
|
||||||
set +f
|
|
||||||
# shellcheck disable=SC2206
|
|
||||||
local arg=( $MESSAGE )
|
|
||||||
set -f
|
|
||||||
local cmd="${arg[0]}"
|
|
||||||
local msg=""
|
local msg=""
|
||||||
|
|
||||||
if user_is_botadmin "${USER[ID]}" || user_is_allowed "${USER[ID]}" "systemstatus"; then
|
if user_is_botadmin "${USER[ID]}" || user_is_allowed "${USER[ID]}" "systemstatus"; then
|
||||||
case "$cmd" in
|
case "$CMD" in
|
||||||
'/md'*) msg="$(cat /proc/mdstat)";;
|
'/md'*) msg="$(cat /proc/mdstat)";;
|
||||||
'/smb'*) msg="$(smbstatus)" ;;
|
'/smb'*) msg="$(smbstatus)" ;;
|
||||||
'/se'*) msg="$(sensors | sed -r 's/\s|\)+//g' | sed -r 's/\(high=|\(min=/\//' | sed -r 's/\,crit=|\,max=/\//')";;
|
'/se'*) msg="$(sensors | sed -r 's/\s|\)+//g' | sed -r 's/\(high=|\(min=/\//' | sed -r 's/\,crit=|\,max=/\//')";;
|
||||||
@ -55,8 +49,8 @@ mycommands() {
|
|||||||
'/lvm'*) msg="$(lvs | sed -r 's/\s+/\n/g')";;
|
'/lvm'*) msg="$(lvs | sed -r 's/\s+/\n/g')";;
|
||||||
'/lvsd'*) msg="$(lvs -a -o +devices | sed -r 's/\s+/\n/g')";;
|
'/lvsd'*) msg="$(lvs -a -o +devices | sed -r 's/\s+/\n/g')";;
|
||||||
'/smart'*)
|
'/smart'*)
|
||||||
[ "${arg[0]}" == "" ] && msg="example \`/smart sda\`" && return
|
[ "${CMD[1]}" == "" ] && msg="example \`/smart sda\`" && return
|
||||||
drive="$(echo "${arg[0]}" | cut -c 1-3)"
|
drive="$(echo "${CMD[1]}" | cut -c 1-3)"
|
||||||
echo "smartctl -a /dev/$drive"
|
echo "smartctl -a /dev/$drive"
|
||||||
msg="$(smartctl -a "/dev/$drive")"
|
msg="$(smartctl -a "/dev/$drive")"
|
||||||
;;
|
;;
|
||||||
|
Loading…
Reference in New Issue
Block a user