mirror of
https://github.com/nextcloud/spreed.git
synced 2025-12-17 21:12:20 +01:00
docs(bots): Simplify variable handling
Co-authored-by: Joas Schilling <213943+nickvergessen@users.noreply.github.com> Signed-off-by: Michael Bell <mb@igloos.one>
This commit is contained in:
parent
a6f3dc816e
commit
0801853077
1 changed files with 4 additions and 26 deletions
30
docs/bots.md
30
docs/bots.md
|
|
@ -335,32 +335,10 @@ Bots can also send message. On the sending process the same signature/verificati
|
|||
```bash
|
||||
#!/bin/bash
|
||||
|
||||
# Required environment variables:
|
||||
# NC_URL: The URL of the Nextcloud instance (e.g., "https://nextcloud.example.com")
|
||||
# TOKEN: The token of the conversation
|
||||
# SECRET: Shared secret that is specified when installing a bot
|
||||
# MESSAGE: The message to be sent
|
||||
|
||||
# Check if required variables are set
|
||||
if [ -z "$NC_URL" ]; then
|
||||
echo "Error: NC_URL is not set."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$TOKEN" ]; then
|
||||
echo "Error: TOKEN is not set."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$SECRET" ]; then
|
||||
echo "Error: SECRET is not set."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$MESSAGE" ]; then
|
||||
echo "Error: MESSAGE is not set."
|
||||
exit 1
|
||||
fi
|
||||
NC_URL="https://nextcloud.example.tld/" # The URL of the Nextcloud instance (e.g., "https://nextcloud.example.com")
|
||||
TOKEN="12345678" # The token of the conversation
|
||||
SECRET="53CR3T" # Shared secret that is specified when installing a bot
|
||||
MESSAGE=$1 # Pass the message as first argument
|
||||
|
||||
# Generate a random header and signature
|
||||
RANDOM_HEADER=$(openssl rand -hex 32)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue