Implemented boosts, tweaked weights.

main
Paco Hope 2022-11-27 16:30:05 -05:00
parent 65b2ffed50
commit acbe23b4be
1 changed files with 43 additions and 13 deletions

View File

@ -249,9 +249,6 @@ class Tooter(Mastodon):
return( self._favourite( timeline='home') )
def _favourite(self, timeline: str) -> int:
if( args.debug ):
print(f"{self.acct} favourite")
chunk_size = 20
timeline_list = self.read_timeline(timeline=timeline, limit=chunk_size)
if( len(timeline_list) == 0 ):
@ -267,6 +264,37 @@ class Tooter(Mastodon):
return( 0 )
def boost_random_local(self) -> int:
if( args.debug ):
print(f"{self.acct} boost_random_local")
return( self._boost( timeline='local') )
def boost_random_public(self) -> int:
if( args.debug ):
print(f"{self.acct} boost_random_public")
return( self._boost( timeline='public') )
def boost_random_home(self) -> int:
if( args.debug ):
print(f"{self.acct} boost_random_home")
return( self._boost( timeline='home') )
def _boost(self, timeline: str) -> int:
chunk_size = 20
timeline_list = self.read_timeline(timeline=timeline, limit=chunk_size)
if( len(timeline_list) == 0 ):
return( 1 )
fav_post = random.choice(timeline_list)
if( args.dry_run):
print(f"{self.acct} boosts {fav_post.id}")
else:
if( args.debug ):
print(f"{self.acct} boosts {fav_post.id}")
self.status_reblog(id=fav_post.id)
return( 0 )
def report_random_local(self) -> int:
if( args.debug ):
print(f"{self.acct} report_random_local")
@ -275,18 +303,20 @@ class Tooter(Mastodon):
def random_interaction(self):
"""Choose one possible interaction according to the weights, and do it."""
interactions = {
self.reply_random_local: 1,
self.reply_random_home: 1,
self.reply_random_public: 1,
self.follow_random_local: 1,
self.unfollow_random: 0,
self.reply_random_local: 4,
self.reply_random_home: 4,
self.reply_random_public: 4,
self.follow_random_local: 2,
self.unfollow_random: 1,
self.toot_plain_public: 1,
self.toot_tagged_public: 1,
self.toot_tagged_public: 4,
self.toot_plain_unlisted: 1,
self.boost_random_local: 0,
self.favourite_random_local: 1,
self.favourite_random_home: 1,
self.favourite_random_public: 1,
self.favourite_random_local: 2,
self.favourite_random_home: 2,
self.favourite_random_public: 2,
self.boost_random_local: 2,
self.boost_random_home: 2,
self.boost_random_public: 2,
self.report_random_local: 0
}
chosen = random.choices(population=list(interactions.keys()),