joaquinlpereyra / twitterImgBot

Ever wanted to randomly tweet pictures from a folder? No? Well, maybe you do now.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Option to not let users request images

EpicLPer opened this issue · comments

As far as I've seen there's no way of stopping users from requesting pictures from the bot. I was about to make a bot which simply tweets pictures to a set amount of time.

Hello EpicLPer! I think you are right. But there's a simple workaround. Set your request_command to a very weird string (heck, make it longer than a 140 characters!) and don't share it with anyone and you'll be golden :)

Also, in case you were wondering, to stop the bot from tweeting at random intervals, just set the bot's execution chance at a 100,

Heh, even tho it's a weird recommendation I'll do it :P
Anyways, I saw that, for some reason, the bot simply ignores that I've set the "Tweet numbers" option to false. The log isn't helpful either, I'm running the bot on Windows tho.
All it does is simply adding the number even tho I told it not to do so for some reason.

The post number will always appear on the log, no matter what you set. If you set tweet_post_number to False, the numbers shouldn't be posted to twitter though.

Are they being posted?

Yes, I don't know why tho. Is there a way to let Python scripts run in a verbose mode so I can see if something maybe fails without telling me and it defaults to some settings?

Here's an example of what I mean, the post number option is set to "False": https://twitter.com/CutePonyPic/status/740066745466114048

Okay, so I've edited the config.py now to set the Bool directly to "False" in there. The bot now tweets stuff without the Number, however throws an error at me in the CMD.

C:\twitterbots\cuteponypic\bot>python twitterbot.py Traceback (most recent call last): File "twitterbot.py", line 150, in <module> main() File "twitterbot.py", line 144, in main create_tweet(tweet_text, None, test) File "twitterbot.py", line 34, in create_tweet log_line = logger.logLine(post_number, tweet_id, media, reply_id) NameError: name 'post_number' is not defined

I hope this helps you to track down the error. For some reason it thinks that inside twitterbot.py the post_number variable is not set, I have no idea what exactly this one does or if it's the variable I've set to false earlier on in the config.py

This is very helpful. Thanks @EpicLPer, I'll look into it over the weekend.

Hello EpicLPer!

As a hotfix, could you change the two ifs found in line 134 of twitterbot.py to the following:

    if config.tweet_post_number and manual_post_number is None:
        post_number = getPostNumber(config.log_file)
        tweet_text = "No. " + post_number + tweet_text
    elif manual_post_number is not None:
        post_number = manual_post_number
        tweet_text = "No. " + manual_post_number + tweet_text
    elif not config.tweet_post_number:
        post_number = ""

@EpicLPer did this work?