updated README to version 1.0. you can disable accounts now

This commit is contained in:
b3yond 2018-01-19 16:00:36 +01:00
parent 04e05ee8ca
commit c9e6a35372
3 changed files with 63 additions and 41 deletions

View file

@ -1,25 +1,37 @@
# Ticketfrei micro messaging bot
Version: 1.0
<!-- This mastodon/twitter bot has one purpose - breaking the law. -->
The functionality is simple: it retweets every tweet where it is mentioned.
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.
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.
To this date, we have never heard of this happening though.
In the promotion folder, you will find some promotion material you
can use to build up such a community in your city. It is in german
though =/
Website: https://wiki.links-it.de/IT/Ticketfrei
Website: https://wiki.links-tech.org/IT/Ticketfrei
## Install
Setting up a ticketfrei bot for your city is quite easy. Here are the few steps:
Setting up a ticketfrei bot for your city is quite easy. Here are the
few steps:
First you need to install python3 and virtualenv with your favourite
package manager.
First you need to install python and virtualenv with your favourite package manager.
Create and activate virtualenv:
```shell
sudo apt install python virtualenv
sudo apt install python3 virtualenv
virtualenv -p python3 .
. bin/activate
```
@ -34,19 +46,44 @@ Configure the bot:
cp config.toml.example config.toml
vim config.toml
```
Edit the account credentials, so your bot can use your accounts.
You can use a Twitter, a Mastodon, and Mail with the account. They
will communicate with each other; if someone warns others via Mail,
Twitter and Mastodon users will also see the message. And vice versa.
You have to configure all of the accounts via config.toml; it should
be fairly intuitive to enter the right values.
## Maintaining
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.
To this date, we have never heard of this happening though.
### blacklisting
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.
You also need to edit the goodlist and the blacklist. They are in the
"goodlists" and "blacklists" folders. All text files in those
directories will be used, so you should delete our templates; but
feel free to use them as an orientation.
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.
Just add the words to the goodlist, which you want to require. A
report is only spread, if it contains at least one of them. If you
want to RT everything, just add a ```\*```.
Note that atm the good- & blacklist are still outside of config.toml, in separate files. we will repare this soon.
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.
### screen
To keep the bots running when you are logged out of the shell, you can use screen:
To keep the bots running when you are logged out of the shell, you
can use screen:
```shell
sudo apt-get install screen
@ -57,28 +94,3 @@ python3 ticketfrei.py
To log out of the screen session, press "ctrl+a", and then "d".
## 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
- [x] Twitter: Crawl mentions
- [x] Mastodon: Crawl mentions
- [ ] Write toots/tweets to database/log
- [x] Twitter: retweet people
- [x] Mastodon: boost people
- [x] Twitter: access the API
- [ ] Web UI that lets you easily delete toots/tweets per db id and/or mute the tweet author
- [x] Write Bots as Classes to be easier implemented
- [x] Create extra Class for the filter
- [x] Put as much as possible into config.toml
- [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 config.toml
- [x] 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
- [ ] ongoing: solve issues

View file

@ -3,6 +3,7 @@
name = 'yourcity_ticketfrei' # What you want the app to be called
[muser]
enabled = 'false' # set to true if you want to use Mastodon
email = 'youremail@server.tld' # E-mail address of your Mastodon account
password = 'yourpassword' # Password of your Mastodon account
server = 'yourmastodoninstance' # Instance where you have your Mastodon account
@ -14,12 +15,14 @@ consumer_key = "your_consumer_key"
consumer_secret = "your_consumer_secret"
[tuser]
enabled = 'false' # set to true if you want to use Twitter
# You get those keys when you follow these steps:
# https://developer.twitter.com/en/docs/basics/authentication/guides/access-tokens
access_token_key = "your_access_token_key"
access_token_secret = "your_acces_token_secret"
[mail]
enabled = 'false' # set to true if you want to use Mail notifications
# This is the mail the bot uses to send emails.
mailserver = "smtp.riseup.net"
user = "ticketfrei"
@ -28,11 +31,11 @@ passphrase = "sup3rs3cur3"
# when it breaks down), you should specify a contact email address:
#contact = "your_mail@riseup.net"
# Mailing list where you want to send warnings to
#list = "nbg_ticketfrei@lists.links-tech.org"
list = "yourcity_ticketfrei@lists.links-tech.org"
[logging]
# The directory where logs should be stored.
logpath = "logs"
logpath = "logs/ticketfrei.log"
# [trigger]
# goodlists are one regex per line.

View file

@ -23,7 +23,14 @@ if __name__ == '__main__':
trigger = Trigger(config)
bots = [RetootBot(config), RetweetBot(config), Mailbot(config)]
bots = []
if config["muser"]["enabled"] != "false":
bots.append(RetootBot(config))
if config["tuser"]["enabled"] != "false":
bots.append(RetweetBot(config))
if config["mail"]["enabled"] != "false":
bots.append(Mailbot(config))
try:
statuses = []