diff --git a/.gitignore b/.gitignore index c8d47d2..466f1e9 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ *.pyc .idea/ last_mention +config.toml ticketfrei.cfg seen_toots.pickle seen_toots.pickle.part diff --git a/README.md b/README.md index c507ecb..da93933 100644 --- a/README.md +++ b/README.md @@ -31,8 +31,8 @@ pip install tweepy pytoml requests Mastodon.py Configure the bot: ```shell -cp ticketfrei.cfg.example ticketfrei.cfg -vim ticketfrei.cfg +cp config.toml.example config.toml +vim config.toml ``` Edit the account credentials, so your bot can use your accounts. @@ -42,7 +42,7 @@ Also add the words to the goodlist, which you want to require. A tweet is only r 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. +Note that atm the good- & blacklist are still outside of config.toml, in separate files. we will repare this soon. ### screen @@ -74,11 +74,11 @@ Desktop/pycharm-community-2017.1.4/bin/pycharm.sh - [ ] 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 ticketfrei.cfg +- [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 ticketfrei.cfg +- [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 diff --git a/ticketfrei.cfg.example b/config.toml similarity index 100% rename from ticketfrei.cfg.example rename to config.toml diff --git a/config.toml.example b/config.toml.example new file mode 100644 index 0000000..10176df --- /dev/null +++ b/config.toml.example @@ -0,0 +1,27 @@ +[mapp] +name = 'yourcity_ticketfrei' # :todo: where do you receive the app name? + +[muser] +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 + +[tapp] +consumer_key = "OD0CLn6twBxHjN2DqMkKuSvli" +consumer_secret = "XkvbViwjBWoWoJzIlseJLXmg2fqluq4HYqvwOwoSHGwxdTNi4l" + +shutdown_contact_userid = 801098086005243904 +shutdown_contact_screen_name = 'links_tech' + +[tuser] +access_token_key = "876046057721008128-J35moxFXUvLb24MnaMVbVpqiEtxBlcc" +access_token_secret = "I7PQZMHuJDS5WslgUhqEeZbEWGhwLhmOetvwFoTn8YDKW" + +# [trigger] +# goodlists are one regex per line. +# badlists are one badword per line. +# a message musst match at least one regex in goodlist and contain none of the badwords. +# the variables mention the directory where the lists are located, not the filenames. + +# goodlist_path = 'goodlists' +# blacklist_path = 'blacklists' diff --git a/retootbot.py b/retootbot.py index cf01e2d..bf7366c 100644 --- a/retootbot.py +++ b/retootbot.py @@ -111,7 +111,7 @@ class RetootBot(object): if __name__ == '__main__': # read config in TOML format (https://github.com/toml-lang/toml#toml) - with open('ticketfrei.cfg') as configfile: + with open('config.toml') as configfile: config = toml.load(configfile) filter = trigger.Trigger(config) diff --git a/retweetbot.py b/retweetbot.py index 3bb46df..cd773da 100644 --- a/retweetbot.py +++ b/retweetbot.py @@ -66,7 +66,7 @@ class RetweetBot(object): """ How to get these keys is described in doc/twitter_api.md - After you received keys, store them in your ticketfrei.cfg like this: + After you received keys, store them in your config.toml like this: [tapp] consumer_key = "..." consumer_secret = "..." @@ -261,7 +261,7 @@ class RetweetBot(object): if __name__ == "__main__": # create an Api object - with open('ticketfrei.cfg') as configfile: + with open('config.toml') as configfile: config = toml.load(configfile) trigger = trigger.Trigger(config) diff --git a/ticketfrei.py b/ticketfrei.py index e16ebdb..a5c55b4 100644 --- a/ticketfrei.py +++ b/ticketfrei.py @@ -14,7 +14,7 @@ from trigger import Trigger if __name__ == '__main__': # read config in TOML format (https://github.com/toml-lang/toml#toml) - with open('ticketfrei.cfg') as configfile: + with open('config.toml') as configfile: config = toml.load(configfile) trigger = Trigger(config) diff --git a/trigger.py b/trigger.py index ffe3bee..864256c 100644 --- a/trigger.py +++ b/trigger.py @@ -59,7 +59,7 @@ class Trigger(object): if __name__ == "__main__": - with open("ticketfrei.cfg", "r") as configfile: + with open("config.toml", "r") as configfile: config = toml.load(configfile) print("testing the trigger")