View on GitHub

altBotUY

Es un bot de Twitter para promover el uso de alt_text para describir imágenes en Twitter.

altBot

@AltBotUY is a twitter bot to promote the usage of alt_text to describe images in Twitter.

Alternative text (alt_text) is text associated with an image that serves the same purpose and conveys the same essential information as the image. In situations where the image is not available to the reader, perhaps because they have turned off images in their web browser or are using a screen reader due to a visual impairment, the alternative text ensures that no information or functionality is lost.

Here you can find an article from @mili_costabel that perfectly describes how important are those alt_texts.

Logic

Currently, the logic goes like follows:

A Follower is any user that follows the bot @AltBotUY, a friend is any user followed by the bot. If a user is both friend and follower, it is processed as follower.

altBot_main.py module contains all logic to run this, all you need is to implement a main function to run all this, then its execution must be someway chroned, for instance with chron or chrontab in linux.

You need also to supply your tweeter credentials in settings module, read here how to do it.

Change log

This section summarizes the differences and improvements from version to version. Notice that not all of them are currently in production (prod branch). Some of them are closed issues in master, waiting to be released

V1.0.

[prod] Initial version: check for some hardcoded accounts only and reply them publicly if alt_text is not used.

V1.1

[prod] Those changes are not in production yet. A database is first needed to make it robust enough.

## V1.2 [prod] Those changes are to put into production next Monday 19th April, after notifying followers with a DM on changes.

## V2.0 [master] This version implies some changes in the bot usage, since the use cases implemented up to the moment did not fit tweeter policies with respect to automated messages. In particular, the bot can not reply to tweets of arbitrary users and only can contact users who doesn’t previously accept to be contacted. The same is true for DMs, and following the bot is not enough. Also, the followers need a clear mechanism to opt-out. So, the use case to watch for friends accounts will be disabled and substituted with the process mentions. DMs are still available, but now followers need to explicitly accept to receive DMs by retweeting a special tweet.

V3.0

[master] This version implements some new use cases while modify an existing one. This also fixes some small bugs.

ROAD MAP (prioritized):

Feel free to tackle any of those or even add new ones!

Requirements

Requirements can be installed with pip install -r requirements.txt, developed under python 3.7.7.

Also need to provide the appropiated credentials to connect with Twitter, defined in settings.py. The interaction with twitter is done through tweepy API. Here you can find a complete tutorial on this API.

running the bot

Information on how to run can be checked with help command, as follows:

$ python altBot_main.py --help 
usage: altBot_main.py [-h] [-u] [-wfr] [-wfw] [-m MESSAGE] [-l] [-p]
                      [-t {friends,followers}]

This script runs AltBotUY.

optional arguments:
  -h, --help            show this help message and exit
  -u, --update-users    Update the local list of followers and friends.
  -wfr, --watch-alt-texts-friends
                        Run the watch-alt-text use case in friends.
  -wfw, --watch-alt-texts-followers
                        Run the watch-alt-text use case in followers.
  -m MESSAGE, --message MESSAGE
                        Send given message to followers. Can also be the path
                        to a text file containing the message.
  -l, --live            Actually send DMs, tweets and favs, otherwise just
                        logs it. Must use it for production.
  -p, --process-mentions
                        Process tweets where the bot is mentioned.
  -t {friends,followers}, --top-users {friends,followers}
                        Compute top-3 users of alt-texts.

Related work:

@ImageAltText and @get_altText are both Twitter bots for Image captioning: once you call them from a tweet, they answer with their best effort image caption. However, both of them only work in English.

@AltTxtReminder is another bot which just suggest the usage of alt_text when not used. They also offer a service for their followers: suggest alt_text usage on DMs. Similarly, @AltTextCrew offer a similar service, which also provides a bot to inspect external links and report the usage of alt_text on those links