Skip to content
This repository has been archived by the owner on Nov 19, 2022. It is now read-only.

Releases: jessicarod7/XKCDAltTextBot

2.0.0

23 Jun 03:23
2.0.0
f33dd6c
Compare
Choose a tag to compare

The Customization Update

After months of planning, version 2.0.0 is now live! This update makes the XKCDAltTextBot porgram a truly customizable program, with a new configuration file to replace the old method of hunting through the source code. It even works with Heroku, thanks to a new, smaller program packaged with the Twitter bot.

Note: this update is not compatible with previous versions of XKCDAltTextBot. It is strongly recommended to replace your current setup with the new bot for simplicity. Just replace the existing files with the new ones, no previous changes to the code need to be kept.

To learn more, check out the updated Wiki.

1.9.0

20 Jun 00:12
1.9.0
e2098cb
Compare
Choose a tag to compare

This is the latest (last?) attempt at a fix for the XKCDAltTextBot retweet issue. This time, the idea is to double-check that a Tweet is new. All updates are below:

  • Add the following code before line 219 and tab all following code to the right:
    new_tweet_check = None
    
    for i in range(2):
  • On the new line 229 replace continue with break.
  • Add the following code before the new line 231 and tab all following code to the right:
            if new_tweet_check is None: # Unverified new Tweet
                new_tweet_check = original_tweet
                print('Potential new comic. Waiting 15 seconds to verify...')
                continue
            elif new_tweet_check == original_tweet: # Confirmed new Tweet

1.8.2

19 Apr 19:04
1.8.2
237a3c1
Compare
Choose a tag to compare

1.8.2 updates the urllib3 library, which previously contained a security vulnerability. Current users should replace Pipfile.lock and requirements.txt as soon as possible.

1.8.1

19 Apr 04:56
1.8.1
dcf2537
Compare
Choose a tag to compare

This minor update catches a missing exception.

  • Replace line 79 with the following:
            except ValueError: # Supposedly valid comment
  • Add the following after line 74:
            try:

1.8.0

16 Apr 03:04
1.8.0
bb7cf1c
Compare
Choose a tag to compare

This update replaces the 1.7.0 duplicate Tweet fix with a more effective method. You will need to replace the Pipfile, Pipfile.lock, and requirements.txt files. Updates are as follows:

  • Remove lines 7-9.
  • Replace lines 75-100 (formerly 78-103):
            if alt_replies.index(comic['statuses'][0]['id']) is not ValueError:
                # This tweet has already been replied to
                del alt_payload, comic_payload, alt_raw, comic_raw, alt, comic
                return None # Sleep for 15 seconds
            else: # Supposedly valid Tweet
                return comic['statuses'][0] # Return comic Tweet
  • Add after line 106 (formerly line 128):
                if tweet.json()['errors'][0]['code'] == 187: # Duplicate Tweet
                    print('Duplicate Tweet detected, ending attempt.')
                    return None
  • Remove blank line 237 (formerly 257).

1.7.2

02 Apr 03:18
1.7.2
2b60c65
Compare
Choose a tag to compare

Well, this is embarrassing. The final fix to the 1.7 update is below and painfully obvious:

Update line 98 to the following:

                del alt_payload, comic_payload, alt_raw, comic_raw, alt

And add this line after line 99:

                    del comic

🤦

1.7.1

31 Mar 23:25
1.7.1
84e3e0d
Compare
Choose a tag to compare

This minor update introduces time adjustments for UTC. The fixes are below.

  • Replace line 95 with the following:
                # Twitter API adds 3 hours for some painful reason
                tweet_time = time.mktime(tweet_time_str.timetuple()) - 10800
  • Replace lines 99-100, formerly lines 98-99:
               if time.mktime(datetime.datetime.utcnow().timetuple()) - tweet_time > 43200:
                   return None # Cancel Tweet attempt

[BROKEN] 1.7.0

29 Mar 01:36
1.7.0
5ea7ee7
Compare
Choose a tag to compare

THIS UPDATE DOES NOT WORK, PLEASE DO NOT INSTALL.

This major update institutes a 12 hour limit on replies from the Twitter bot. This should reduce incidents of the bot replying to an old Tweet when the bot's own reply is not surfaced by Twitter search.

The following section will explain the necessary changes and should only be used if you are updating an existing bot.

You must replace the Pipfile, Pipfile.lock, and requirements.txt files, as the bot now uses the dateutil module. Then make the following changes in the bot code:

  • Add the following imports:
import datetime # Cancels Tweet if older than 12 hours
import calendar # Converts calendar abbreviation to integer
from dateutil.tz import gettz # Switches to UTC in recent Tweet check
  • Replace lines 84-86 (formerly lines 81-83) with the following code, replacing variable names as needed:
                # This tweet does not appear in the search results, check if <12 hrs
                tweet_time_str = datetime.datetime(
                    int(comic['statuses'][0]['created_at'][-4:]),
                    list(calendar.month_abbr).index(comic['statuses'][0]['created_at'][4:7]),
                    int(comic['statuses'][0]['created_at'][8:10]),
                    int(comic['statuses'][0]['created_at'][11:13]),
                    int(comic['statuses'][0]['created_at'][14:16]),
                    int(comic['statuses'][0]['created_at'][17:19]),
                    0,
                    gettz('UTC')
                )
                tweet_time = time.mktime(tweet_time_str.timetuple())


                 del alt_payload, comic_payload, alt_raw, comic_raw, alt, comic
                if time.time() - tweet_time > 43200: # Cancel Tweet attempt
                    return None
                else:
                    return comic['statuses'][0] # Return comic Tweet

1.6.0

16 Mar 00:45
1.6.0
7efd851
Compare
Choose a tag to compare

This latest release adds support for regular tweets, by removing a check that your latest tweet is a reply. It also provides a fix for a bug requiring the bot to start on an account that already had a Tweet.

Remove line 67 and update line 66 to the following, modifying to your own variables:

                if comic['statuses'][0]['id'] is None:

Then update lines 80-81 (formerly 81-82):

            except (ValueError, NameError):
                # This tweet has not been replied to or no tweets have been posted yet

1.5.1

25 Jan 19:53
1.5.1
c218f0c
Compare
Choose a tag to compare

This release fixes a bug that causes the bot to crash if it does not find a new Tweet. Replace lines 76-83 with the following, modifying as needed:

            try:
                if alt_replies.index(comic['statuses'][0]['id']) is not ValueError:
                    # This tweet has already been replied to
                    del alt_payload, comic_payload, alt_raw, comic_raw, alt, comic
                    return None # Sleep for 15 seconds
            except ValueError:
                # This tweet has not been replied to
                del alt_payload, comic_payload, alt_raw, comic_raw, alt
                return comic['statuses'][0] # Return comic Tweet