fix stuff
This commit is contained in:
parent
5f092305f7
commit
2332625953
|
@ -66,3 +66,6 @@ package-lock.json
|
||||||
|
|
||||||
# Memo
|
# Memo
|
||||||
memo.txt
|
memo.txt
|
||||||
|
|
||||||
|
# BoG
|
||||||
|
src/shell/.env
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
API_TOKEN=""
|
||||||
|
API_ID=""
|
|
@ -1,14 +1,22 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
MY_PATH="`dirname \"$0\"`" # relative
|
||||||
|
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||||
|
|
||||||
|
[[ -n $MY_PATH/.env ]] && source $MY_PATH/.env || (echo "Please create $MY_PATH/.env as $MY_PATH/.env.example" && exit 1)
|
||||||
|
|
||||||
sendmsg() {
|
sendmsg() {
|
||||||
chan="$1"
|
chan="$1"
|
||||||
msg="${@:2}"
|
msg="${@:2}"
|
||||||
|
|
||||||
[[ ! $chan || ! $msg ]] && echo "Please select user and message." && exit 1
|
[[ ! $chan || ! $msg ]] && echo "Please select user and message." && exit 1
|
||||||
|
|
||||||
curl -s -H "X-Auth-Token: 9aHo-EZ4ySYv9reV7rwcRLxuOSWeATmKlyKRvwebIXa" \
|
curl -s -H "X-Auth-Token: $API_TOKEN" \
|
||||||
-H "X-User-Id: HTuZCNhtoG4yQocCg" \
|
-H "X-User-Id: $API_ID" \
|
||||||
-H "Content-type:application/json" \
|
-H "Content-type:application/json" \
|
||||||
http://192.168.9.6:10140/api/v1/chat.postMessage \
|
http://192.168.9.6:10140/api/v1/chat.postMessage \
|
||||||
-d "{ \"channel\": \"$chan\", \"text\": \"$msg\" }" > /dev/null 2>&1
|
-d "{ \"channel\": \"$chan\", \"text\": \"$msg\" }" > /dev/null 2>&1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$@
|
||||||
|
|
||||||
|
|
Reference in New Issue