Added Active Half Year data

This commit is contained in:
spla 2023-06-28 20:27:11 +02:00
pare f1a8acd45e
commit 5e2ebc628a

Veure arxiu

@ -83,6 +83,10 @@ class Mastobot:
mau = '{:,}'.format(mau).replace(',','.')
ahy = self.mastodon.instance_nodeinfo().usage.users.activeHalfyear
ahy = '{:,}'.format(ahy).replace(',','.')
registers = self.mastodon.instance().stats.user_count
registers = '{:,}'.format(registers).replace(',','.')
@ -113,7 +117,9 @@ class Mastobot:
post_text += f"Usuaris actius (mes): {mau}\n"
post_text += f"Apunts: {posts}\n"
post_text += f"Usuaris actius (6 mesos): {ahy}\n"
post_text += f"Tuts: {posts}\n"
post_text += f"Servidors federats: {peers}\n\n"
@ -144,6 +150,8 @@ class Mastobot:
reply = False
question = ''
keyword = ''
content = self.cleanhtml(self, text)
@ -153,20 +161,29 @@ class Mastobot:
try:
start = content.index("@")
end = content.index(" ")
if len(content) > end:
content = content[0: start:] + content[end +1::]
if " " in content:
cleanit = content.count('@')
end = content.index(" ")
i = 0
while i < cleanit :
if len(content) > end:
content = content[0: start:] + content[end +1::]
cleanit = content.count('@')
i = 0
while i < cleanit :
start = content.rfind("@")
end = len(content)
content = content[0: start:] + content[end +1::]
i += 1
else:
return reply, question
start = content.rfind("@")
end = len(content)
content = content[0: start:] + content[end +1::]
i += 1
content = content.lower()
question = content