adjust examples to v0.90

This commit is contained in:
Kay Marquardt (Gnadelwartz) 2019-06-01 12:46:27 +02:00
parent 9a81e440f1
commit 6302ef4795
3 changed files with 5 additions and 17 deletions

View File

@ -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.90-2-g274f5d8
#### $$VERSION$$ v0.90-3-g9a81e44
#
# Exit Codes:
# - 0 sucess (hopefully)

View File

@ -36,12 +36,6 @@ mycommands() {
# 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
# $1 dir to wtach for new files
watch_dir_loop() {

View File

@ -5,7 +5,7 @@
# to show how you can customize bashbot by only editing mycommands.sh
# 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=SC2034
@ -35,16 +35,10 @@ bashbot_help='*Availiable commands*:
# your additional bahsbot commands
# NOTE: command can have @botname attached, you must add * in case tests...
mycommands() {
[[ "$MESSAGE" = '/'* ]] || return
set +f
# shellcheck disable=SC2206
local arg=( $MESSAGE )
set -f
local cmd="${arg[0]}"
local msg=""
if user_is_botadmin "${USER[ID]}" || user_is_allowed "${USER[ID]}" "systemstatus"; then
case "$cmd" in
case "$CMD" in
'/md'*) msg="$(cat /proc/mdstat)";;
'/smb'*) msg="$(smbstatus)" ;;
'/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')";;
'/lvsd'*) msg="$(lvs -a -o +devices | sed -r 's/\s+/\n/g')";;
'/smart'*)
[ "${arg[0]}" == "" ] && msg="example \`/smart sda\`" && return
drive="$(echo "${arg[0]}" | cut -c 1-3)"
[ "${CMD[1]}" == "" ] && msg="example \`/smart sda\`" && return
drive="$(echo "${CMD[1]}" | cut -c 1-3)"
echo "smartctl -a /dev/$drive"
msg="$(smartctl -a "/dev/$drive")"
;;