added set_bio and made uninitialised accts initialise themselves
parent
4d6f8dcc6d
commit
ec0e414f12
|
@ -59,6 +59,12 @@ class Tooter(mastodon.Mastodon):
|
||||||
# if logging in worked, this will work
|
# if logging in worked, this will work
|
||||||
account = self.me()
|
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']
|
self.id = account['id']
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@ -302,25 +308,32 @@ class Tooter(mastodon.Mastodon):
|
||||||
self.account_update_credentials(display_name=newname)
|
self.account_update_credentials(display_name=newname)
|
||||||
return( 0 )
|
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):
|
def random_interaction(self):
|
||||||
"""Choose one possible interaction according to the weights, and do it."""
|
"""Choose one possible interaction according to the weights, and do it."""
|
||||||
interactions = {
|
interactions = {
|
||||||
self.reply_random_local: 0,
|
self.reply_random_local: 2,
|
||||||
self.reply_random_home: 0,
|
self.reply_random_home: 2,
|
||||||
self.reply_random_public: 0,
|
self.reply_random_public: 2,
|
||||||
self.follow_random_local: 0,
|
self.follow_random_local: 2,
|
||||||
self.unfollow_random: 0,
|
self.unfollow_random: 1,
|
||||||
self.toot_plain_public: 0,
|
self.toot_plain_public: 1,
|
||||||
self.toot_tagged_public: 0,
|
self.toot_tagged_public: 4,
|
||||||
self.toot_plain_unlisted: 0,
|
self.toot_plain_unlisted: 1,
|
||||||
self.favourite_random_local: 0,
|
self.favourite_random_local: 2,
|
||||||
self.favourite_random_home: 0,
|
self.favourite_random_home: 2,
|
||||||
self.favourite_random_public: 0,
|
self.favourite_random_public: 2,
|
||||||
self.boost_random_local: 0,
|
self.boost_random_local: 2,
|
||||||
self.boost_random_home: 0,
|
self.boost_random_home: 2,
|
||||||
self.boost_random_public: 0,
|
self.boost_random_public: 2,
|
||||||
self.set_display_name: 1,
|
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()),
|
chosen = random.choices(population=list(interactions.keys()),
|
||||||
weights=list(interactions.values()))[0]
|
weights=list(interactions.values()))[0]
|
||||||
|
|
Loading…
Reference in New Issue