Renamed config file to config.toml #6

This commit is contained in:
b3yond 2017-12-30 10:32:20 +01:00
parent 3471fa9dd7
commit d188086fc0
8 changed files with 38 additions and 10 deletions

1
.gitignore vendored
View file

@ -2,6 +2,7 @@
*.pyc *.pyc
.idea/ .idea/
last_mention last_mention
config.toml
ticketfrei.cfg ticketfrei.cfg
seen_toots.pickle seen_toots.pickle
seen_toots.pickle.part seen_toots.pickle.part

View file

@ -31,8 +31,8 @@ pip install tweepy pytoml requests Mastodon.py
Configure the bot: Configure the bot:
```shell ```shell
cp ticketfrei.cfg.example ticketfrei.cfg cp config.toml.example config.toml
vim ticketfrei.cfg vim config.toml
``` ```
Edit the account credentials, so your bot can use your accounts. 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. 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 ### 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 - [ ] 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] Write Bots as Classes to be easier implemented
- [x] Create extra Class for the filter - [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] Make both bots run on their own *and* next to each other
- [x] implement trigger class in retootbot - [x] implement trigger class in retootbot
- [x] read config in retweetbot - [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 - [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 - [ ] write a script to setup the bot easily. ask the admin for the necessary information
- [ ] ongoing: solve issues - [ ] ongoing: solve issues

27
config.toml.example Normal file
View file

@ -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'

View file

@ -111,7 +111,7 @@ class RetootBot(object):
if __name__ == '__main__': if __name__ == '__main__':
# read config in TOML format (https://github.com/toml-lang/toml#toml) # 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) config = toml.load(configfile)
filter = trigger.Trigger(config) filter = trigger.Trigger(config)

View file

@ -66,7 +66,7 @@ class RetweetBot(object):
""" """
How to get these keys is described in doc/twitter_api.md 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] [tapp]
consumer_key = "..." consumer_key = "..."
consumer_secret = "..." consumer_secret = "..."
@ -261,7 +261,7 @@ class RetweetBot(object):
if __name__ == "__main__": if __name__ == "__main__":
# create an Api object # create an Api object
with open('ticketfrei.cfg') as configfile: with open('config.toml') as configfile:
config = toml.load(configfile) config = toml.load(configfile)
trigger = trigger.Trigger(config) trigger = trigger.Trigger(config)

View file

@ -14,7 +14,7 @@ from trigger import Trigger
if __name__ == '__main__': if __name__ == '__main__':
# read config in TOML format (https://github.com/toml-lang/toml#toml) # 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) config = toml.load(configfile)
trigger = Trigger(config) trigger = Trigger(config)

View file

@ -59,7 +59,7 @@ class Trigger(object):
if __name__ == "__main__": if __name__ == "__main__":
with open("ticketfrei.cfg", "r") as configfile: with open("config.toml", "r") as configfile:
config = toml.load(configfile) config = toml.load(configfile)
print("testing the trigger") print("testing the trigger")