Coder Social home page Coder Social logo

rhnvrm / constassemblybot Goto Github PK

View Code? Open in Web Editor NEW
13.0 5.0 5.0 6.2 MB

A twitter bot that tweets a sentence from the Indian Constituent Assembly Debates every 10 minutes.

Home Page: https://twitter.com/ConstAssembly

License: MIT License

Python 93.48% Shell 6.52%
twitter bot twitter-bot constitution india

constassemblybot's Introduction

@ConstAssembly Twitter Bot

A twitter bot that tweets a sentence from the Indian Constituent Assembly Debates every 10 minutes.

Development Docs

The bot resides in bot.py and uses the Tweepy library to tweet text. The bot depends on the following files:

  1. data.txt - This file contains the raw text, which is used by the bot.
  2. last_line.txt - This file is the memory of the bot. This is used so that the bot can dump its state to disk between each run. The bot currently runs as a cron job. Eg.
12
0

Where line 0 represents the row and line 1 represents the column in the data.txt file.

  1. .env - This file contains the secrets required by the bot, such as Twitter API keys.

Getting Started

You can get started by cloning this repository.

git clone [email protected]/rhnvrm/ConstAssemblyBot

After this, you can install dependencies using:

cd ConstAssemblyBot
pipenv shell
pipenv install

You can now, install a cronjob like this:

*/10 * * * * cd $HOME/apps/ConstAssemblyBot && /usr/local/bin/pipenv run python bot.py

constassemblybot's People

Contributors

dependabot[bot] avatar khaleelkhan avatar kumbhakaran avatar rhnvrm avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar

constassemblybot's Issues

Handle sentences with multiple dots at the end

The bot fails at the following example:

Dr. P. S. Deshmukh
I see the objection to my amendment, and do not press it. But, I think it would sound far better if the first word "an
other" is changed into "a" and the word "third" altered into "another". I am afraid that it might look as if I am sugg
esting too many changes. But we are making a constitution, and I do not want that anything should go out of this House
....

Add data

The bot has run out of data to tweet. If any one wants to volunteer and contribute to adding data feel free to ping either me or @kumbhakaran on this thread and we can help you get started and things to take care of while adding data.

Bot split tweet mid-word

Bot split the word here:

I know that. That is exactly the point for which I have praised Dr. Rajendra Prasad and hope he will extend to us the same consideration for placing our point of view as you would to any others, because it has always been our experience that when it com

es to a question of our placing our views we are invariably asked to be brief.

Char count of first sentence: 253

Bot broke at line 2514

Middle tweet is out of place :

const_bug

Line for reference:

I would like just to say a few words with regard to another aspect of the question. The Resolution is there, but, how are we going to implement it? What are the impediments that we already see before us which may prevent us from carrying this Resolution into effect? Now, one, of course, is the status of the Constituent Assembly in the absence of the Muslim League. Dr. Jayakar yesterday referred to some analogy of a dinner party. He said, "If guests are invited and some guests do not come, then how can you have the dinner party?" But he forgot to say what will be the fate of the guests who have already arrived?

Looks like bot rolled back to an earlier point in the same line, it continues from there. Possibly an error writing to last_line.txt ?

Handle `”` quotes

The unicode quote should be replaced by "
The Muslim League can come in later after we pass this Resolution”

Bot failed at line 2157

The bot broke at line 2157 after tweeting

"Until yesterday, Dr. Jayakar, I was entirely in favour of your Resolut
ion but Mr. Jinnah's Press Conference in London as made the whole difference
". I said, "What difference has it made?"

Better handling of duplicate tweets

Tweets like:

Hear, hear ...
Applause ...

Which are repeated often are currently handled by adding a . at the end and trying again. We need to come up with a better way to handle these.

Sample Last Line Text File

Please add a sample last_line.txt file or add some more description in the Readme file regarding the nature of the data in this file. It is not very clear from the description provided so far.

Add alerts

Now that the bot has been running for a while without too many manual interventions, I think we can add alerts for the following:

  • If tweets are getting duplicated and twitter is not allowing to tweet. This usually happens when some bug like #16 happens.
  • If the last_line is about to be reached. at about say 5% is left.

The alerts, I think, can be configured using environment variables and sending can be done via email.

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.