diff --git a/.gitignore b/.gitignore index cc68ced..598f998 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,146 @@ -secrets.conf +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +.pybuilder/ +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +# For a library or package, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# .python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# pytype static type analyzer +.pytype/ + +# Cython debug symbols +cython_debug/ + +# mac shenanigan +.DS_Store + +# VS Code files +.vscode + +# project-specific +secrets.ini \ No newline at end of file diff --git a/README.md b/README.md index 565f3c8..986d929 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,13 @@ -# NijiHoloBot -### A Twitter bot that tweets when a Twitter interaction occurs between Nijisanji EN/ID and hololive EN/ID members. -...cause some people are that desperate. Like me! +# NijiHolo_EN_ID_Bot +### Twitter bot that follows interactions between Nijisanji EN/ID and hololive EN/ID members. +...because some folks are that desperate. Like me! ## Roadmap * Read past tweets of members from both companies * Store tweets in a queue file * Create image of tweet, including up to three image attachments from that tweet * Combine image(s) with quote retweet -* Don't tweet already-existing tweets (check quoted RT?) +* Don't tweet already-existing tweets (check quoted RTs?) * Check out new tweets as soon as they post ## Notes diff --git a/src/catchup.py b/src/catchup.py new file mode 100644 index 0000000..e5ad38a --- /dev/null +++ b/src/catchup.py @@ -0,0 +1,6 @@ +## The bot's catch-up mode +# Scan all accounts for cross-company interactions. +# Terminates when finished scanning. + +def run(): + pass \ No newline at end of file diff --git a/src/listen.py b/src/listen.py new file mode 100644 index 0000000..8c23122 --- /dev/null +++ b/src/listen.py @@ -0,0 +1,2 @@ +## The bot's listen mode +# Listen for cross-company interactions. \ No newline at end of file diff --git a/src/main.py b/src/main.py index b07ecde..d4cc43d 100644 --- a/src/main.py +++ b/src/main.py @@ -1,5 +1,40 @@ +import sys +import argparse +from argparse import RawTextHelpFormatter +import TwitterAPI as api +import catchup as catchup + +HELP_TEXT = \ +'''OPTIONS: + -h Displays this help text. + -c, --catchup Scan all tweets from all accounts and makes posts all cross-company + interactions found. + -l, --listern Listen for all new tweets from all accounts. +''' + +def init_argparse(): + p = argparse.ArgumentParser(description='Twitter bot that follows interactions between Nijisanji EN/ID and hololive EN/ID members.', formatter_class=RawTextHelpFormatter) + p.add_argument('mode', nargs='?', \ + help='mode to run the bot at:\n\ + l,listen: (default) listen for new tweets from all accounts; will not terminate unless error occurs\n\ + c,catchup: scan all tweets from all accounts; will terminate when done') + return p + def main(): - print('hello python android') + parser = init_argparse() + if len(sys.argv) < 2: + parser.print_help() + return + + args = parser.parse_args() + print(args.mode) + + match args.mode: + case 'l' | 'listen': + print('LISTEN MODE') + case 'c' | 'catchup': + print('CATCH-UP MODE') + if __name__ == "__main__": main() diff --git a/src/secrets.py b/src/secrets.py index 710e704..8c7af91 100644 --- a/src/secrets.py +++ b/src/secrets.py @@ -1,3 +1,5 @@ +## Twitter developer credentials management. + import os import configparser