11 Commits

Author SHA1 Message Date
bacbaf4866 update image link in header [ci_skip]
All checks were successful
QuotesBot / deploy (push) Successful in 23s
2025-06-05 19:43:11 +00:00
c8ae2c3860 re-added release workflow [ci_skip] 2025-06-05 19:35:30 +00:00
2eeaa34401 working 2025-06-05 19:28:25 +00:00
9bd34aeb2a fixed
All checks were successful
QuotesBot / deploy (push) Successful in 32s
2025-06-05 19:26:01 +00:00
99d307a2a7 debug line
Some checks failed
QuotesBot / deploy (push) Failing after 24s
2025-06-05 19:19:34 +00:00
b412eafc97 debug line 2025-06-05 19:18:43 +00:00
2e3c034eed think i fixed it 2025-06-05 19:01:02 +00:00
e593c71fc1 fix workflow badge
All checks were successful
QuotesBot / deploy (push) Successful in 36s
2025-06-05 10:22:56 -05:00
a159c7ff8e fix workflow badge 2025-06-05 10:21:50 -05:00
e10082d96c fix workflow 2025-06-05 08:33:35 -05:00
f48dd5dcf5 fix workflow 2025-06-05 08:28:56 -05:00
4 changed files with 32 additions and 7 deletions

View File

@ -1,12 +1,12 @@
name: QuotesBot name: QuotesBot
on: on:
schedule: schedule:
- cron '41 */5 * * *' - cron: '35 */4 * * *'
jobs: jobs:
deploy: deploy:
runs: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- name: Setup Python - name: Setup Python
uses: actions/setup-python@v3 uses: actions/setup-python@v3
with: with:
@ -15,7 +15,7 @@ jobs:
run: | run: |
python -m pip install --upgrade pip python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Run Script - name: Run app.py
run: run:
python app.py python app.py
env: env:

View File

@ -0,0 +1,25 @@
on:
push:
tags:
- 'v*'
name: create release
jobs:
build:
name: create release
runs-on: ubuntu-latest
steps:
- name: checkout code
uses: actions/checkout@v4
- name: create the release
id: create_release
uses: actions/create-release@v1
env:
GITEA_TOKEN: ${{ secrets.PAT }}
GITHUB_TOKEN: ${{ secrets.PAT }}
with:
tag_name: ${{ gitea.ref }}
release_name: release ${{ gitea.ref }}
body: |
releasing ${{ gitea.ref }} for ${{ gitea.repository }}
make_latest: true

View File

@ -1,5 +1,4 @@
# The new [QuotesBot](https://bots.fyrfli.social/@quotesbot) code # The new [QuotesBot](https://bots.fyrfli.social/@quotesbot) code [![](https://fyrfli.dev/fyrfli/quotesbot/actions/workflows/deploy.yml/badge.svg)](https://fyrfli.dev/fyrfli/quotesbot/actions)
![](https://fyrfli.dev/fyrfli/quotesbot/actions/workflows/deploy/badge.svg?branch=main&event=run)
In the neverending quest to improve my coding skills, I often check out the code that other bots employ. Last night, I decided to check out the code for the [ThursdayBot](https://github.com/devashishp/thursday) and realised something really neat: In the neverending quest to improve my coding skills, I often check out the code that other bots employ. Last night, I decided to check out the code for the [ThursdayBot](https://github.com/devashishp/thursday) and realised something really neat:

3
app.py
View File

@ -14,8 +14,9 @@ if source_object.reason == "OK":
reader = csv.DictReader(io.StringIO(source_object.text)) reader = csv.DictReader(io.StringIO(source_object.text))
source_data = dumps(list(reader)) source_data = dumps(list(reader))
choices = loads(source_data) choices = loads(source_data)
print(choices[0])
choice = choices[randint(0, len(choices) - 1)] choice = choices[randint(0, len(choices) - 1)]
headers = {'Authorization': 'Bearer ' + post_token} headers = {'Authorization': 'Bearer ' + post_token}
payload = {'status': f"{choice['quote']}\n\n - {choice['author']}\n\n#RandomQuote #quotes #quote #bot", 'visibility': 'public'} payload = {'status': f"{choice['quote']}\n\n - {choice['author']}\n\n#RandomQuote #quotes #quote #bot", 'visibility': 'public'}
response = post(post_endpoint, headers=headers, data=payload) response = post(post_endpoint, headers=headers, data=payload)
print(response.reason)
print(loads(response.text)['url'])