mirror of https://gitlab.com/chaica/feed2toot
Add config option to change toot visibility
Some instances allow bots only if their toots are unlisted, in order to avoid flooding the public timeline (makes sense).
This commit is contained in:
parent
23951ad91f
commit
0e2418ea20
|
@ -40,6 +40,8 @@ Alternatively you can donate cryptocurrencies:
|
||||||
instance_url=https://mastodon.social
|
instance_url=https://mastodon.social
|
||||||
user_credentials=feed2toot_usercred.txt
|
user_credentials=feed2toot_usercred.txt
|
||||||
client_credentials=feed2toot_clientcred.txt
|
client_credentials=feed2toot_clientcred.txt
|
||||||
|
; Default visibility is public, but you can override it
|
||||||
|
toot_visibility=unlisted
|
||||||
|
|
||||||
[cache]
|
[cache]
|
||||||
cachefile=cache.db
|
cachefile=cache.db
|
||||||
|
|
|
@ -26,6 +26,8 @@ In order to configure Feed2toot, you need to create a feed2toot.ini file (or any
|
||||||
; Here you need the two files created by register_feed2toot_app
|
; Here you need the two files created by register_feed2toot_app
|
||||||
user_credentials=/etc/feed2toot/credentials/feed2toot_usercred.txt
|
user_credentials=/etc/feed2toot/credentials/feed2toot_usercred.txt
|
||||||
client_credentials=/etc/feed2toot/credentials/feed2toot_clientcred.txt
|
client_credentials=/etc/feed2toot/credentials/feed2toot_clientcred.txt
|
||||||
|
; Default visibility is public, but you can override it
|
||||||
|
toot_visibility=unlisted
|
||||||
|
|
||||||
[cache]
|
[cache]
|
||||||
cachefile=/var/lib/feed2toot/feed2toot.db
|
cachefile=/var/lib/feed2toot/feed2toot.db
|
||||||
|
|
|
@ -189,13 +189,21 @@ class Main(object):
|
||||||
|
|
||||||
if clioptions.dryrun:
|
if clioptions.dryrun:
|
||||||
if entrytosend:
|
if entrytosend:
|
||||||
logging.warning('Tweet should have been sent: {tweet}'.format(tweet=finaltweet))
|
logging.warning('Would toot with visibility "{visibility}": {toot}'.format(
|
||||||
|
toot=finaltweet,
|
||||||
|
visibility=config.get(
|
||||||
|
'mastodon', 'toot_visibility',
|
||||||
|
fallback='public')))
|
||||||
else:
|
else:
|
||||||
logging.debug('This rss entry did not meet pattern criteria. Should have not been sent')
|
logging.debug('This rss entry did not meet pattern criteria. Should have not been sent')
|
||||||
else:
|
else:
|
||||||
storeit = True
|
storeit = True
|
||||||
if entrytosend and not clioptions.populate:
|
if entrytosend and not clioptions.populate:
|
||||||
logging.debug('sending the following tweet:{tweet}'.format(tweet=finaltweet))
|
logging.debug('Tooting with visibility "{visibility}": {toot}'.format(
|
||||||
|
toot=finaltweet,
|
||||||
|
visibility=config.get(
|
||||||
|
'mastodon', 'toot_visibility',
|
||||||
|
fallback='public')))
|
||||||
twp = TootPost(config, finaltweet)
|
twp = TootPost(config, finaltweet)
|
||||||
storeit = twp.storeit()
|
storeit = twp.storeit()
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -44,7 +44,9 @@ class TootPost:
|
||||||
access_token = self.config.get('mastodon', 'user_credentials'),
|
access_token = self.config.get('mastodon', 'user_credentials'),
|
||||||
api_base_url = self.config.get('mastodon', 'instance_url')
|
api_base_url = self.config.get('mastodon', 'instance_url')
|
||||||
)
|
)
|
||||||
mastodon.toot(self.toot)
|
mastodon.status_post(self.toot,
|
||||||
|
visibility=self.config.get(
|
||||||
|
'mastodon', 'toot_visibility', fallback='public'))
|
||||||
|
|
||||||
def storeit(self):
|
def storeit(self):
|
||||||
'''Indicate if the tweet should be stored or not'''
|
'''Indicate if the tweet should be stored or not'''
|
||||||
|
|
Loading…
Reference in New Issue