ticketfrei/README.md

80 lines
3.6 KiB
Markdown
Raw Normal View History

2017-06-17 12:57:43 +00:00
# Ticketfrei micro messaging bot
<!-- This mastodon/twitter bot has one purpose - breaking the law. -->
The functionality is simple: it retweets every tweet where it is mentioned.
This leads to a community which evolves around it; if you see ticket controllers, you tweet their location and mention the bot. The bot then retweets your tweet and others can read the info and think twice if they want to buy a ticket. If enough people, a critical mass, participate for the bot to become reliable, you have positive self-reinforcing dynamics.
There is one security hole: people could start mentioning the bot with useless information, turning it into a spammer. That's why it has to be maintained; if someone spams the bot, mute them and undo the retweet. So it won't retweet their future tweets and the useless retweet is deleted if someone tries to check if something was retweeted in the last hour or something.
Website: https://wiki.links-it.de/IT/Ticketfrei
2017-06-17 12:57:43 +00:00
# Install
2017-07-11 19:51:37 +00:00
Install python and virtualenv with your favourite package manager.
2017-06-17 12:57:43 +00:00
Create and activate virtualenv
2017-07-11 19:51:37 +00:00
2017-06-17 12:57:43 +00:00
```shell
2017-07-11 19:51:37 +00:00
$ virtualenv -p python2 .
2017-06-17 12:57:43 +00:00
$ . bin/activate
```
Install dependencies
```shell
2017-07-11 19:51:37 +00:00
$ pip install python-twitter pytoml requests Mastodon.py
2017-06-17 12:57:43 +00:00
```
2017-06-17 22:35:34 +00:00
Configure
```shell
$ cp ticketfrei.cfg.example ticketfrei.cfg
$ vim ticketfrei.cfg
```
Edit the account credentials, so your bot can use your accounts.
2017-10-17 13:27:24 +00:00
### blacklisting
2017-06-17 23:44:22 +00:00
Also add the words to the goodlist, which you want to require. A tweet is only retweeted, if it contains at least one of them. If you want to RT everything, just add your account name.
There is also a blacklist, which you can use to automatically sort out malicious tweets. Be careful though, our filter can't read the intention with which a word was used. Maybe you wanted it there.
Note that atm the good- & blacklist are still outside of ticketfrei.cfg, in separate files. we will repare this soon.
2017-06-17 12:57:43 +00:00
2017-10-17 13:27:24 +00:00
### screen
To keep the bots running when you are logged out of the shell, you can use screen:
```shell
sudo apt-get install screen
2017-10-17 13:27:24 +00:00
echo "if [ -z "$STY" ]; then screen -RR; fi" >> ~/.bash_login
screen
python ticketfrei.py
```
2017-10-17 13:27:24 +00:00
To log out of the screen session, press "ctrl+a", and then "d".
2017-06-17 12:57:43 +00:00
## ideas
* You can only use the twitter API if you have confirmed a phone number and sacrificed a penguin in a blood ritual. So we should build it in a way that it uses the twitter web GUI. It's difficult, but maybe it works. We had another twitter bot that worked similarly, years ago: https://github.com/b3yond/twitter-bot
* Build a tool that deletes wrong toots/tweets on both platforms, would work nicely with a web UI.
* write the muted people to the db, to easily undo the mutes if necessary.
## to do
Desktop/pycharm-community-2017.1.4/bin/pycharm.sh
2017-06-17 17:04:51 +00:00
- [x] Twitter: Crawl mentions
2017-06-17 18:36:30 +00:00
- [x] Mastodon: Crawl mentions
2017-06-23 20:09:56 +00:00
- [ ] Write toots/tweets to database/log
2017-06-17 17:04:51 +00:00
- [x] Twitter: retweet people
2017-06-17 18:36:30 +00:00
- [x] Mastodon: boost people
- [x] Twitter: access the API
2017-10-17 13:29:09 +00:00
- [ ] Web UI that lets you easily delete toots/tweets per db id and/or mute the tweet author
2017-06-17 18:36:30 +00:00
- [x] Write Bots as Classes to be easier implemented
2017-06-17 20:19:15 +00:00
- [x] Create extra Class for the filter
- [x] Put as much as possible into ticketfrei.cfg
- [x] Make both bots run on their own *and* next to each other
- [x] implement trigger class in retootbot
- [x] read config in retweetbot
- [x] put shutdown contact in ticketfrei.cfg
2017-10-16 22:04:21 +00:00
- [ ] document what you have to configure if you setup the bot in another city
- [ ] write a script to setup the bot easily. ask the admin for the necessary information
2017-10-16 22:15:56 +00:00
- [ ] write a web interface, so we can host the bot for other cities - ppl don't have to know the command line
2017-12-10 19:20:30 +00:00
- [ ] send shutdown notifications via mail