Détachement du Python
This commit is contained in:
parent
59d00b4bdf
commit
172f73b5ba
2 changed files with 16 additions and 4 deletions
9
revolt_bot.py
Normal file
9
revolt_bot.py
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
#!/usr/bin/env/ python3
|
||||||
|
#NOTE : pour cURL et la partie Python
|
||||||
|
#```bash
|
||||||
|
#sudo apt install curl
|
||||||
|
#pip install py-ulid
|
||||||
|
#```
|
||||||
|
from ulid import ULID
|
||||||
|
ulid = ULID()
|
||||||
|
print(ulid.generate())
|
|
@ -47,7 +47,7 @@ function message()
|
||||||
{
|
{
|
||||||
#$1: $CHANNEL_ID
|
#$1: $CHANNEL_ID
|
||||||
#$2: $MESSAGE
|
#$2: $MESSAGE
|
||||||
ULID=$( python -c 'from ulid import ULID; ulid = ULID(); print(ulid.generate())' )
|
ULID=$( python ./revolt_bot.py )
|
||||||
echo 'Message à mon salon :'
|
echo 'Message à mon salon :'
|
||||||
curl -H "x-bot-token: $BOT_TOKEN" \
|
curl -H "x-bot-token: $BOT_TOKEN" \
|
||||||
--data """
|
--data """
|
||||||
|
@ -103,11 +103,14 @@ do
|
||||||
shift 2;;
|
shift 2;;
|
||||||
|
|
||||||
('-m'|'--message'|'--')
|
('-m'|'--message'|'--')
|
||||||
if [[ $2 != "" ]]
|
if [[ $2 == - ]]
|
||||||
|
then
|
||||||
|
MESSAGE=/dev/stdin
|
||||||
|
elif [[ $2 == "" ]]
|
||||||
then
|
then
|
||||||
MESSAGE=$2
|
|
||||||
else
|
|
||||||
MESSAGE=""
|
MESSAGE=""
|
||||||
|
else
|
||||||
|
MESSAGE=$2
|
||||||
fi
|
fi
|
||||||
M_FLAG=1
|
M_FLAG=1
|
||||||
shift 2;;
|
shift 2;;
|
||||||
|
|
Loading…
Reference in a new issue