Compare commits
13 Commits
3ed5ef7079
...
main
Author | SHA1 | Date | |
---|---|---|---|
bacbaf4866
|
|||
c8ae2c3860
|
|||
2eeaa34401
|
|||
9bd34aeb2a
|
|||
99d307a2a7
|
|||
b412eafc97
|
|||
2e3c034eed
|
|||
e593c71fc1
|
|||
a159c7ff8e
|
|||
e10082d96c
|
|||
f48dd5dcf5
|
|||
9b00d5d6ee
|
|||
467defdffe
|
@ -1,14 +1,12 @@
|
||||
name: QuotesBot
|
||||
on:
|
||||
schedule:
|
||||
- cron '25 */5 * * *'
|
||||
permissions:
|
||||
contents: read
|
||||
- cron: '35 */4 * * *'
|
||||
jobs:
|
||||
deploy:
|
||||
runs: ubuntu-latest
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v3
|
||||
with:
|
||||
@ -17,7 +15,7 @@ jobs:
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
|
||||
- name: Run Script
|
||||
- name: Run app.py
|
||||
run:
|
||||
python app.py
|
||||
env:
|
||||
|
25
.gitea/workflows/release.yml
Normal file
25
.gitea/workflows/release.yml
Normal 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
|
||||
|
@ -1,7 +1,6 @@
|
||||
# The new [QuotesBot](https://bots.fyrfli.social/@quotesbot) code
|
||||

|
||||
# The new [QuotesBot](https://bots.fyrfli.social/@quotesbot) code [](https://fyrfli.dev/fyrfli/quotesbot/actions)
|
||||
|
||||
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:
|
||||
|
||||
>[!IMPORTANT]
|
||||
>***there is a way to make the bot completely foolproof!!!***
|
||||
|
3
app.py
3
app.py
@ -14,8 +14,9 @@ if source_object.reason == "OK":
|
||||
reader = csv.DictReader(io.StringIO(source_object.text))
|
||||
source_data = dumps(list(reader))
|
||||
choices = loads(source_data)
|
||||
print(choices[0])
|
||||
choice = choices[randint(0, len(choices) - 1)]
|
||||
headers = {'Authorization': 'Bearer ' + post_token}
|
||||
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)
|
||||
print(response.reason)
|
||||
print(loads(response.text)['url'])
|
||||
|
Reference in New Issue
Block a user