Détachement du Python

This commit is contained in:
F. Y. H. 2021-10-05 22:48:17 +02:00
parent 59d00b4bdf
commit 172f73b5ba
2 changed files with 16 additions and 4 deletions

9
revolt_bot.py Normal file
View 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())

View file

@ -47,7 +47,7 @@ function message()
{
#$1: $CHANNEL_ID
#$2: $MESSAGE
ULID=$( python -c 'from ulid import ULID; ulid = ULID(); print(ulid.generate())' )
ULID=$( python ./revolt_bot.py )
echo 'Message à mon salon :'
curl -H "x-bot-token: $BOT_TOKEN" \
--data """
@ -103,11 +103,14 @@ do
shift 2;;
('-m'|'--message'|'--')
if [[ $2 != "" ]]
if [[ $2 == - ]]
then
MESSAGE=/dev/stdin
elif [[ $2 == "" ]]
then
MESSAGE=$2
else
MESSAGE=""
else
MESSAGE=$2
fi
M_FLAG=1
shift 2;;