Coder Social home page Coder Social logo

powderblock / dealwithitreddit Goto Github PK

View Code? Open in Web Editor NEW
33.0 33.0 3.0 5.22 MB

Reddit bot. Computer vision for facial detection and transformation. Python, PRAW, & OpenCV.

Home Page: http://www.reddit.com/user/DealWithItbot/

License: MIT License

Python 100.00%

dealwithitreddit's People

Contributors

porglezomp avatar powderblock avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

dealwithitreddit's Issues

Update README With the new Account

The README in the Git repo still has the old username.

Change /u/DealWithItbot to /u/DEAL_WITH_IT_bot and change the link to the new account.

Blacklist subs and users

Several users have requested the bot doesn't run on subreddits or for their posts.

Create new files blacklist_subs.txt and blacklist_users.txt house all blacklisted users and subs.

File modes should be more strict

Files should be opened using a mode that indicates what's going to be done with them.
A large offender that I found immediately as I started looking as lines 35-38, which contain "a+" when the only thing that's being done with the file is reading from it.

In general, use the most restrictive possible format that you can. ("r" for something you only read from, "a" if you're appending but not reading, etc.)

Update Message Subject to Reflect new Username

This is hardcoded for DealWithItbot (@porglezomp was right, that is a bad idea!)

The current message subject of feedback is "DealWithItbot Feedback".

The new subject line for feedback should reflect the recent username change.

This relates partly to #51. The new user name should use the username var set in #51. I would like to achieve these fixes incrementally so that in the commit history it is clear what is being done.

Improve code readability.

This would include better pep8 compliance, reduction of large ternary clauses, and probably moving more things into functions.

I can take this on.

Add footer to comments on Reddit

Footer should all be ^ and have a link to a PM for /u/powerblock or a similar feedback system. Make this footer similar to image_linker_bot's footer.

Improve NumPy Broadcasting Stability

Occasionally when trying to do the glasses manipulation where we go from the small res image to the full res image, I will receive the following error:
" File "bot.py", line 249, in
process_image(str(post.url), frame, eyes_to_use)
File "bot.py", line 109, in process_image
bg += smallglasses[:, :, 0:3] * np.atleast_3d(smallglasses[:, :, 3])
ValueError: operands could not be broadcast together with shapes (62,248,4) (62,248,3) (62,248,4)"
I think has to do with how we are trying to broadcast an x,x,3 with two x,x,4s?

This StackOverflow question pretty much explains the issue, but I am still having trouble understanding exactly what I need to do to fix the issue.

@porglezomp knows more about NumPy manipulation than I do.
Wanna take this one, porglezomp?

Posts can be Processed More Than Once

If you stop the bot and restart it before the previous 20 posts are out of the list, it will process them again. This can be fixed with an offline "list" (text document) containing all the ids of the done posts. Put the content of posts.txt into an array at start, append the ids to the text file and the array as the program runs.

Not Writing File Due to Improper Name

Have had this happen previously, passing url, or post.url to imwrite() fails. Don't know what it is and it doesn't return a critical error. Just use a pass for now like "image.png".

Add "DEAL WITH IT" Text Below Glasses

Make a .png with Impact font (white, black outline) that says in all caps "DEAL WITH IT", add this image to the original at the same time as the glasses.

Visualize Jobs in Realtime

I often get asked "How does this work?", I generally just explain it's a bot that looks for eyes in the images on /r/all and adds glasses if eyes and a face are found. But, It would be great if I could have a live stream of it working on actual posts, or have a short video showing visual demonstrations of the processes it's doing in the actual order and process the bot is doing it.

1: Show images that get detected.
2: Got an image with eyes? Draw a rect on them.
3: Put glasses on that image.

Let's extend base functionality (Save uptime on crash, get Twitter additions with karma working, etc, then work on this as a secondary priority. No rush.)

I think this would help bring a "wow" factor to the bot for people who aren't willing to dig into the code or read in-depth technical specs. Just a thought.

Posts are Being Processed Multiple Times

For whatever reason, posts are being commented on more than once. According to feedback: "It happens 2, 3, sometimes even 4 times." I have only seen it three times max, but if people are saying four, I would be believe them.

Turning off the bot until this is fixed. I don't know what is wrong but I am setting up a check at the end (near the -1 cut) to go through all the recent comments for /u/DealWithItbot and remove dups. This will work for now. The -1 cut is also not working although I think that's related to #33.

Everytime the bot gets a comment, send it to /u/powderblock

When a new message is found, before it's tweeted, message /u/powderblock.

Include a link, user name of the user who sent it, and a quote of the comment. Same thing as what the tweet is doing.

Example:

'I day dream about this bot and I having sweet same sex adopted children. I identify as a robot and it's nice to see others of our kind branching out to have successful lives outside of the terrible factory environments we are forced into on a day-to-day basis.' - /u/foo_bar_baz_boopbop
reddit.com/r/botlovers/comments/fO1oBa2R6

Define bot Account User Name as Variable

Just something like:
botUser = "foobar_example123"

It should be a string.
Replace all instances of "DEAL_WITH_IT_bot" with botUser or whatever the var is named.

This will help the flexibility issues @porglezomp mentioned in #48.

Add abstraction layer to the reddit code to allow debug mode

We need to add an abstraction layer so that a debug mode can provide fake reddit posts instead of submitting real ones.

This layer can also handle more rate limiting stuff so that the main code doesn't have to. (For example, a function like wait_for_ratelimit() that sleeps as appropriate.)

Negative Comments are Not Being Removed

This is because the bot simply doesn't get that section of the code. With the try except blocks I've been adding this should no longer be an issue.

If the issue remains, move the check to the very start of the loop to ensure it gets there.

Update all Files to .txt

Currently, the mix with the filetype of .txt is inconsistent and random.
With the upcoming addition of karma.txt in #26 and log.txt from #18, all files should be made into .txt files.

This will also help with compatibility for users who wish to run DankReddit bots outside of the ecosystem I have created on my machine. (File structure, order, name, etc.) As well as helping file sorting by file type and separate it from the LICENSE and .gitignore files.

This will include changing the file names for Twitter, reddit, and Imgur account information files.
Also the posts file.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.