|
|
|
@ -59,6 +59,12 @@ class Tooter(mastodon.Mastodon): |
|
|
|
|
# if logging in worked, this will work |
|
|
|
|
account = self.me() |
|
|
|
|
|
|
|
|
|
if( account['display_name'] == '' ): |
|
|
|
|
logger.debug(f"{self.acct} setting display_name for first time" ) |
|
|
|
|
self.account_update_credentials(display_name=self.displayname) |
|
|
|
|
if( account['note'] == '' ): |
|
|
|
|
logger.debug(f"{self.acct} setting bio for first time" ) |
|
|
|
|
self.set_bio() |
|
|
|
|
self.id = account['id'] |
|
|
|
|
|
|
|
|
|
@classmethod |
|
|
|
@ -302,25 +308,32 @@ class Tooter(mastodon.Mastodon): |
|
|
|
|
self.account_update_credentials(display_name=newname) |
|
|
|
|
return( 0 ) |
|
|
|
|
|
|
|
|
|
def set_bio(self) -> int: |
|
|
|
|
newbio = self.new_message() |
|
|
|
|
logger.debug(f"{self.acct} set_bio to {len(newbio)}-character bio") |
|
|
|
|
self.account_update_credentials(note=newbio) |
|
|
|
|
return( 0 ) |
|
|
|
|
|
|
|
|
|
def random_interaction(self): |
|
|
|
|
"""Choose one possible interaction according to the weights, and do it.""" |
|
|
|
|
interactions = { |
|
|
|
|
self.reply_random_local: 0, |
|
|
|
|
self.reply_random_home: 0, |
|
|
|
|
self.reply_random_public: 0, |
|
|
|
|
self.follow_random_local: 0, |
|
|
|
|
self.unfollow_random: 0, |
|
|
|
|
self.toot_plain_public: 0, |
|
|
|
|
self.toot_tagged_public: 0, |
|
|
|
|
self.toot_plain_unlisted: 0, |
|
|
|
|
self.favourite_random_local: 0, |
|
|
|
|
self.favourite_random_home: 0, |
|
|
|
|
self.favourite_random_public: 0, |
|
|
|
|
self.boost_random_local: 0, |
|
|
|
|
self.boost_random_home: 0, |
|
|
|
|
self.boost_random_public: 0, |
|
|
|
|
self.reply_random_local: 2, |
|
|
|
|
self.reply_random_home: 2, |
|
|
|
|
self.reply_random_public: 2, |
|
|
|
|
self.follow_random_local: 2, |
|
|
|
|
self.unfollow_random: 1, |
|
|
|
|
self.toot_plain_public: 1, |
|
|
|
|
self.toot_tagged_public: 4, |
|
|
|
|
self.toot_plain_unlisted: 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.set_display_name: 1, |
|
|
|
|
self.report_random_local: 0 |
|
|
|
|
self.set_bio: 1, |
|
|
|
|
self.report_random_local: 1 |
|
|
|
|
} |
|
|
|
|
chosen = random.choices(population=list(interactions.keys()), |
|
|
|
|
weights=list(interactions.values()))[0] |
|
|
|
|