#!/bin/bash # # v0.3 / TK # # # Wordlists: https://github.com/verachell/English-word-lists-parts-of-speech-approximate # # https://raw.githubusercontent.com/verachell/English-word-lists-parts-of-speech-approximate/main/nouns/mostly-nouns.txt # https://raw.githubusercontent.com/verachell/English-word-lists-parts-of-speech-approximate/main/other-categories/mostly-adjectives.txt # https://raw.githubusercontent.com/verachell/English-word-lists-parts-of-speech-approximate/main/verbs/mostly-verbs-infinitive.txt # if [ $# -eq 0 ]; then echo "No word length supplied (4-21)" exit fi if [ $1 -lt 4 ] || [ $1 -gt 21 ]; then echo "Word length must be between 4 to 21 characters" exit fi word=($(cat mostly* | tr 'A-Z' 'a-z' | egrep "^[a-z]{$1}$" | shuf | head -1 | fold -w1)) finalword=(_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) for i in $(seq 0 $(($1-1)) | shuf); do finalword[$i]=${word[$i]} reveal=$(echo ${finalword[@]} | sed 's/ //g' | cut -c1-$1) # data to telegram # curl -s -X POST "https://api.telegram.org/botNNNNNNNNNN:KEYYYYYY/sendMessage" -d "chat_id=XXXXXXXXX&text=Word puzzle with one minute delay: $reveal" > /dev/null # sleep 60 # for debugging echo $reveal done