Commit Graph

33 Commits

Author SHA1 Message Date
Andrew Rogers 5788c6aba8 fix Command attrs, wrapping fixes, new actions
Updated CLI to enforce -i requirement for run_cmd_tweet,
get_tweet_parents, and test_parser.

Twitter bot actions:
- Added new run_cmd_tweet action
- Fixed behavior of pasta_tweet action
- Updated docstring on test_parser
2021-12-07 16:51:25 -06:00
Andrew Rogers ea7aab9402 🧹🧹🧹 2021-12-07 16:51:25 -06:00
Andrew Rogers eba16ff414 modify pasta format, reply all with auto-wrapping
PseudBot's "_make_pasta_chain" method has been rewritten for
auto-wrapping instead of pasta selection.  Pasta selection has been
moved to the Command class in pseudbot/command.py.

PseudBot Twitter bot class additions:
- test_parser method: runs parser on a status ID in dry debug mode
- get_tweet_parents: prints a list of parents to reply to (for testing
  reply-all feature)
2021-12-07 16:51:25 -06:00
Andrew Rogers 173a5c1c08 fix longstanding unused -i bug in CLI 2021-12-07 16:51:25 -06:00
Andrew Rogers 1ae289975f scooped out command parser for later consumption
New Command() class handles this.
2021-12-07 16:51:25 -06:00
Andrew Rogers 14b21fc417 makefile cleanup 2021-12-07 16:51:25 -06:00
Andrew Rogers 9071065310 added new fake Discord screenshot generator
Other memes:
- SoyPhone

Utility functions added:
- Square aspect ratio cropper (square_crop)
- Circle profile pic maker (circle_pfp)
- PIL alpha_composite helper (alpha_comp_prep)
- Text wrapping and bounding helpers
- Tuple adder (tuple_add)
- iPhone timestamp generator for top bar (get_iphone_time_s)

Also added:
- Meme abstract base class (in pseudbot/meme/abc.py)
- Post styling information (in pseudbot/meme/post_styles.py)
2021-12-07 16:51:16 -06:00
Andrew Rogers c4838d5b34 pasta: quiet Jerry! 2021-12-07 16:50:08 -06:00
Andrew Rogers 4a5e65b957 Slight tweak in pseud.json config format 2021-12-07 16:50:08 -06:00
Andrew Rogers 30d69c6888 extended tweet parsing, parser fixes, cleanup
We can now parse and dump the entire 280 characters of a tweet!

Also added: a -d flag for running the bot in debug mode.
2021-12-07 16:50:08 -06:00
Andrew Rogers db064684b3 added new multi-command feature
You can now run multiple commands on a thread from a single tweet using
the `|` delimiter!

I also renamed bot.py to tweet_bot.py to make future expansion plans
less confusing.
2021-12-07 16:50:08 -06:00
Andrew Rogers 44345c65df reword media README 2021-12-07 16:50:08 -06:00
Andrew Rogers 4083bfc2e1 pasta: added two new R&M quotes 2021-12-07 16:50:08 -06:00
Andrew Rogers 95c8726cbb added new multimedia superpowers
On startup, the code now initializes MEDIA with suitable media files
found in the `media` directory that satisfy Twitter's media file
requirements.  The `filetype` Python module has been added as a
dependency to ensure that files in `media` are what they claim to be.

In the bot class I added a new _parse_mention method, broke up the
pasta chain builder method, and added a new recursive _tweet_media
method.  The _parse_mention method had to have some `stupid_emoji`
hackery thanks to the way the 🖼 emoji gets encoded in some tweets.

A new fetch-media script has been added along with a new util function
named `download_tweet_media`

See media/README.md for more information on how to use the newly-added
multimedia superpowers.
2021-12-07 16:50:08 -06:00
Andrew Rogers 9371a37bf8 pastas: more content 2021-12-07 16:50:08 -06:00
Andrew Rogers 3802c49778 better JSON dump filenames 2021-12-07 16:50:08 -06:00
Andrew Rogers 062807b996 user_timeline dump, SOCKS support, list_actions
This commit involves a lot of refactoring that should've been moved to
a separate commit.  Some PseudBot methods that don't need to use
PseudBot attributes have been moved to the newly-created `util.py`.

The real_main function and its associated paraphernalia have been moved
to the also newly-created `cli.py`.

All PseudBot internal methods have been prepended with an underscore
(_).

A new method called list_actions has been added.  It generates a list
of CLI-callable methods and prints each and its accompanying docstring
to the terminal.

SOCKS proxy support has been added to Pseudbot.  The CLI now has a new
`-p` flag that supports fully-qualified SOCKS proxy urls.  For example:
    $ pseudbot run_bot -p socks5://username:password@host:port/

A user timeline dumper action named `user_timeline` has also been added
to PseudBot.  Here's an example of it in action:
    $ pseudbot user_timeline -s CheckmarkLs
2021-12-07 16:50:08 -06:00
Andrew Rogers a6dceb227a pastas: red is sus 2021-12-07 16:50:08 -06:00
Andrew Rogers 11ccb999ab README fixes for GitHub's bad MD parser 2021-12-07 16:50:08 -06:00
Andrew Rogers c5f7abb32b added README 2021-12-07 16:50:08 -06:00
Andrew Rogers 0e62a58bee add dump_tweet action 2021-12-07 16:50:08 -06:00
Andrew Rogers 2535bf7cfd add direct pasta reply action, CLI tweaks
Now you invoke pseudbot like so:
    pseudbot ACTION [OPTIONS]

Config file parameter now defaults to a file named `pseud.json` in
the current working directory.  It is now set with the `-c` flag.

The code for picking and building a pasta chain to send has been
moved from the `reply_mentions` method to a new one named
`_send_pasta_chain`.
2021-12-07 16:50:08 -06:00
Andrew Rogers 3d3cedb676 added mentions dumper, logging tweaks 2021-12-07 16:50:08 -06:00
Andrew Rogers cba10a910d improved logging of tweets, start/shutdown msgs
New logging features have been added.  Tweets and their URLs are now printed to
the console's log.  Added new keyboard interrupt signal handler that tweets out
a shutdown message with a timestamp.
2021-12-07 16:50:08 -06:00
Andrew Rogers d30054a7a4 added more delicious pasta 2021-12-07 16:50:08 -06:00
Andrew Rogers a1527e4f61 basic bot functionality
The bot mostly works.  Not exactly happy with the code thus far,
may rewrite in the future.  I also am not using the tweepy 2.0 API...

run the bot with:
  pseudbot -a run_bot pseud_cfg.json
2021-12-07 16:50:08 -06:00
Andrew Rogers fc85c81449 black pastas 2021-12-07 16:50:08 -06:00
Andrew Rogers 60e9985edd reflow pastas 2021-12-07 16:50:08 -06:00
Andrew Rogers 6fb0fc3a75 add pasta getter 2021-12-07 16:50:08 -06:00
Andrew Rogers a5f6103eeb add some copypastas 2021-12-07 16:50:08 -06:00
Andrew Rogers 94c39fe58d basic plumbing 2021-12-07 16:49:56 -06:00
Andrew Rogers da8ffbe20c ignore JSON dumps 2021-12-06 14:21:40 -06:00
Andrew Rogers e6e2e4b1a6 added AGPLv3+CHRIST license and ignore file 2021-12-06 14:21:34 -06:00