fix stuff

This commit is contained in:
poka 2020-07-12 03:36:24 +02:00
parent 5f092305f7
commit 2332625953
3 changed files with 15 additions and 2 deletions

3
.gitignore vendored
View File

@ -66,3 +66,6 @@ package-lock.json
# Memo
memo.txt
# BoG
src/shell/.env

2
src/shell/.env.example Normal file
View File

@ -0,0 +1,2 @@
API_TOKEN=""
API_ID=""

View File

@ -1,14 +1,22 @@
#!/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() {
chan="$1"
msg="${@:2}"
[[ ! $chan || ! $msg ]] && echo "Please select user and message." && exit 1
curl -s -H "X-Auth-Token: 9aHo-EZ4ySYv9reV7rwcRLxuOSWeATmKlyKRvwebIXa" \
-H "X-User-Id: HTuZCNhtoG4yQocCg" \
curl -s -H "X-Auth-Token: $API_TOKEN" \
-H "X-User-Id: $API_ID" \
-H "Content-type:application/json" \
http://192.168.9.6:10140/api/v1/chat.postMessage \
-d "{ \"channel\": \"$chan\", \"text\": \"$msg\" }" > /dev/null 2>&1
}
$@