Skip to content

Commit

Permalink
fix: telegram api rate limit
Browse files Browse the repository at this point in the history
  • Loading branch information
mohammad5305 committed Feb 5, 2024
1 parent 6d6d88e commit 44efa49
Show file tree
Hide file tree
Showing 3 changed files with 7,652 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:

- uses: EndBug/add-and-commit@v9
with:
add: './current.txt'
add: './current.json'
message: 'gh action: current feed updated'
default_author: github_actions

Expand Down
4 changes: 2 additions & 2 deletions crawl_news.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ SHORT_COMMITS=$(mktemp -p /tmp crawl.XXXX)
curl -H "Accept: application/vnd.github.v3+json" "https://api.github.com/repos/crawl/crawl/commits?per_page=100" -o $CURRENT_FEED



# TODO: handle the case where one of message get lost(due to connection error or something)
push_news() {
DATA=$(echo "$1" | grep -v "^\s*$")

if [[ $(echo "$DATA" | wc -l ) == 1 ]]
then
# TODO: normalize the string(converting html entities)
# TODO: normalize the string(converting html entities like &) and causes to some message be trimmed
echo "$DATA" >> $SHORT_COMMITS
else
curl -s -X POST "$URL" -d chat_id=$CHANNEL_ID -d parse_mode="HTML" -d text="$DATA"
sleep 5
fi
}

Expand Down
Loading

0 comments on commit 44efa49

Please sign in to comment.