Skip to content

Commit 629b74c

Browse files
committed
completely revampted .env.template syntax, shiny new checker, better formatting and more
1 parent b2b4a08 commit 629b74c

5 files changed

Lines changed: 220 additions & 94 deletions

File tree

.env.template

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,40 @@
11
REDDIT_CLIENT_ID=""
22
#EXPLANATION the ID of your Reddit app of SCRIPT type
3+
#RANGE 12:30
4+
#MATCH_REGEX [-a-zA-Z0-9._~+/]+=*$
5+
#OOB_ERROR The ID should be over 12 and under 30 characters, double check your input.
36

47
REDDIT_CLIENT_SECRET=""
58
#EXPLANATION the SECRET of your Reddit app of SCRIPT type
9+
#RANGE 20:40
10+
#MATCH_REGEX [-a-zA-Z0-9._~+/]+=*$
11+
#OOB_ERROR The secret should be over 20 and under 40 characters, double check your input.
612

713
REDDIT_USERNAME=""
814
#EXPLANATION the username of your reddit account
15+
#RANGE 3:20
16+
#MATCH_REGEX [_0-9a-zA-Z]+$
17+
#OOB_ERROR A username HAS to be between 3 and 20 characters
918

1019
REDDIT_PASSWORD=""
1120
#EXPLANATION the password of your reddit account
21+
#RANGE 8:None
22+
#OOB_ERROR Password too short
1223

1324
#OPTIONAL
1425
RANDOM_THREAD="no"
15-
#EXPLANATION If set to no, it will ask you a thread link to extract the thread, if yes it will randomize it. Default: "no"
26+
# If set to no, it will ask you a thread link to extract the thread, if yes it will randomize it. Default: "no"
1627

1728
REDDIT_2FA=""
1829
#MATCH_REGEX ^(yes|no)
1930
#EXPLANATION Whether you have Reddit 2FA enabled, Valid options are "yes" and "no"
2031

2132
SUBREDDIT="AskReddit"
33+
#EXPLANATION what subreddit to pull posts from, the name of the sub, not the URL
34+
#RANGE 3:20
35+
#MATCH_REGEX [_0-9a-zA-Z]+$
36+
#OOB_ERROR A subreddit name HAS to be between 3 and 20 characters
37+
2238
ALLOW_NSFW="False"
2339
#EXPLANATION Whether to allow NSFW content, True or False
2440
#MATCH_REGEX ^(True|False)$
@@ -29,16 +45,22 @@ POST_ID=""
2945

3046
THEME="LIGHT"
3147
#EXPLANATION sets the Reddit theme, either LIGHT or DARK
48+
#MATCH_REGEX ^(dark|light|DARK|LIGHT)$
3249

3350
TIMES_TO_RUN=""
3451
#EXPLANATION used if you want to run multiple times. set to an int e.g. 4 or 29 and leave blank for 1
3552

3653
MAX_COMMENT_LENGTH="500"
3754
#EXPLANATION max number of characters a comment can have. default is 500
55+
#RANGE 0:10000
56+
#MATCH_TYPE int
57+
#OOB_ERROR the max comment length should be between 0 and 10000
3858

39-
#OPTIONAL
4059
OPACITY="1"
41-
#EXPLANATION sets the opacity of the comments, Range is 0 -> 1 recommended around 0.8-0.9
60+
#EXPLANATION Sets the opacity of the comments when overlayed over the background
61+
#RANGE 0:1
62+
#MATCH_TYPE float
63+
#OOB_ERROR The opacity HAS to be between 0 and 1
4264

4365
# see different voice options: todo: add docs
4466
VOICE="Matthew"
@@ -49,4 +71,4 @@ TTsChoice="polly"
4971

5072
#OPTIONAL
5173
STORYMODE="False"
52-
#EXPLANATION IN-PROGRESS - not yet implemented
74+
# IN-PROGRESS - not yet implemented
Lines changed: 49 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
# For most projects, this workflow file will not need changing; you simply need
23
# to commit it to your repository.
34
#
@@ -12,61 +13,61 @@
1213
name: "CodeQL"
1314

1415
on:
15-
push:
16-
branches: [ "master" ]
17-
pull_request:
18-
# The branches below must be a subset of the branches above
19-
branches: [ "master" ]
20-
schedule:
21-
- cron: '16 14 * * 3'
16+
push:
17+
branches: [ "master" ]
18+
pull_request:
19+
# The branches below must be a subset of the branches above
20+
branches: [ "master" ]
21+
schedule:
22+
- cron: '16 14 * * 3'
2223

2324
jobs:
24-
analyze:
25-
name: Analyze
26-
runs-on: ubuntu-latest
27-
permissions:
28-
actions: read
29-
contents: read
30-
security-events: write
25+
analyze:
26+
name: Analyze
27+
runs-on: ubuntu-latest
28+
permissions:
29+
actions: read
30+
contents: read
31+
security-events: write
32+
33+
strategy:
34+
fail-fast: false
35+
matrix:
36+
language: [ 'python' ]
37+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
38+
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
39+
40+
steps:
41+
- name: Checkout repository
42+
uses: actions/checkout@v3
3143

32-
strategy:
33-
fail-fast: false
34-
matrix:
35-
language: [ 'python' ]
36-
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
37-
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
44+
# Initializes the CodeQL tools for scanning.
45+
- name: Initialize CodeQL
46+
uses: github/codeql-action/init@v2
47+
with:
48+
languages: ${{ matrix.language }}
49+
# If you wish to specify custom queries, you can do so here or in a config file.
50+
# By default, queries listed here will override any specified in a config file.
51+
# Prefix the list here with "+" to use these queries and those in the config file.
3852

39-
steps:
40-
- name: Checkout repository
41-
uses: actions/checkout@v3
53+
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
54+
# queries: security-extended,security-and-quality
4255

43-
# Initializes the CodeQL tools for scanning.
44-
- name: Initialize CodeQL
45-
uses: github/codeql-action/init@v2
46-
with:
47-
languages: ${{ matrix.language }}
48-
# If you wish to specify custom queries, you can do so here or in a config file.
49-
# By default, queries listed here will override any specified in a config file.
50-
# Prefix the list here with "+" to use these queries and those in the config file.
51-
52-
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
53-
# queries: security-extended,security-and-quality
5456

55-
56-
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
57-
# If this step fails, then you should remove it and run the build manually (see below)
58-
- name: Autobuild
59-
uses: github/codeql-action/autobuild@v2
57+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
58+
# If this step fails, then you should remove it and run the build manually (see below)
59+
- name: Autobuild
60+
uses: github/codeql-action/autobuild@v2
6061

61-
# ℹ️ Command-line programs to run using the OS shell.
62-
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
62+
# ℹ️ Command-line programs to run using the OS shell.
63+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
6364

64-
# If the Autobuild fails above, remove it and uncomment the following three lines.
65-
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
65+
# If the Autobuild fails above, remove it and uncomment the following three lines.
66+
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
6667

67-
# - run: |
68-
# echo "Run, Build Application using script"
69-
# ./location_of_script_within_repo/buildscript.sh
68+
# - run: |
69+
# echo "Run, Build Application using script"
70+
# ./location_of_script_within_repo/buildscript.sh
7071

71-
- name: Perform CodeQL Analysis
72-
uses: github/codeql-action/analyze@v2
72+
- name: Perform CodeQL Analysis
73+
uses: github/codeql-action/analyze@v2

main.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/env python
2-
import time
32

43
from subprocess import Popen
54
from dotenv import load_dotenv
@@ -26,23 +25,16 @@
2625
╚═╝ ╚═╝╚══════╝╚═════╝ ╚═════╝ ╚═╝ ╚═╝ ╚═══╝ ╚═╝╚═════╝ ╚══════╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
2726
"""
2827
)
29-
load_dotenv()
3028
# Modified by JasonLovesDoggo
3129
print_markdown(
3230
"### Thanks for using this tool! [Feel free to contribute to this project on GitHub!](https://lewismenelaws.com) If you have any questions, feel free to reach out to me on Twitter or submit a GitHub issue. You can find solutions to many common problems in the [Documentation](https://luka-hietala.gitbook.io/documentation-for-the-reddit-bot/)"
3331
)
3432

3533

36-
client_id = getenv("REDDIT_CLIENT_ID")
37-
client_secret = getenv("REDDIT_CLIENT_SECRET")
38-
username = getenv("REDDIT_USERNAME")
39-
password = getenv("REDDIT_PASSWORD")
40-
reddit2fa = getenv("REDDIT_2FA")
41-
42-
4334
def main():
4435
if check_env() is not True:
4536
exit()
37+
load_dotenv()
4638
cleanup()
4739

4840
def get_obj():
@@ -58,8 +50,7 @@ def get_obj():
5850

5951

6052
def run_many(times):
61-
for x in range(times):
62-
x = x + 1
53+
for x in range(1, times + 1):
6354
print_step(
6455
f'on the {x}{("st" if x == 1 else ("nd" if x == 2 else ("rd" if x == 3 else "th")))} iteration of {times}'
6556
) # correct 1st 2nd 3rd 4th 5th....

0 commit comments

Comments
 (0)