Added Active Half Year data
This commit is contained in:
pare
f1a8acd45e
commit
5e2ebc628a
S'han modificat 1 arxius amb 28 adicions i 11 eliminacions
19
mastobot.py
19
mastobot.py
|
@ -83,6 +83,10 @@ class Mastobot:
|
||||||
|
|
||||||
mau = '{:,}'.format(mau).replace(',','.')
|
mau = '{:,}'.format(mau).replace(',','.')
|
||||||
|
|
||||||
|
ahy = self.mastodon.instance_nodeinfo().usage.users.activeHalfyear
|
||||||
|
|
||||||
|
ahy = '{:,}'.format(ahy).replace(',','.')
|
||||||
|
|
||||||
registers = self.mastodon.instance().stats.user_count
|
registers = self.mastodon.instance().stats.user_count
|
||||||
|
|
||||||
registers = '{:,}'.format(registers).replace(',','.')
|
registers = '{:,}'.format(registers).replace(',','.')
|
||||||
|
@ -113,7 +117,9 @@ class Mastobot:
|
||||||
|
|
||||||
post_text += f"Usuaris actius (mes): {mau}\n"
|
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"
|
post_text += f"Servidors federats: {peers}\n\n"
|
||||||
|
|
||||||
|
@ -144,6 +150,8 @@ class Mastobot:
|
||||||
|
|
||||||
reply = False
|
reply = False
|
||||||
|
|
||||||
|
question = ''
|
||||||
|
|
||||||
keyword = ''
|
keyword = ''
|
||||||
|
|
||||||
content = self.cleanhtml(self, text)
|
content = self.cleanhtml(self, text)
|
||||||
|
@ -153,7 +161,11 @@ class Mastobot:
|
||||||
try:
|
try:
|
||||||
|
|
||||||
start = content.index("@")
|
start = content.index("@")
|
||||||
|
|
||||||
|
if " " in content:
|
||||||
|
|
||||||
end = content.index(" ")
|
end = content.index(" ")
|
||||||
|
|
||||||
if len(content) > end:
|
if len(content) > end:
|
||||||
|
|
||||||
content = content[0: start:] + content[end +1::]
|
content = content[0: start:] + content[end +1::]
|
||||||
|
@ -161,12 +173,17 @@ class Mastobot:
|
||||||
cleanit = content.count('@')
|
cleanit = content.count('@')
|
||||||
|
|
||||||
i = 0
|
i = 0
|
||||||
|
|
||||||
while i < cleanit :
|
while i < cleanit :
|
||||||
|
|
||||||
start = content.rfind("@")
|
start = content.rfind("@")
|
||||||
end = len(content)
|
end = len(content)
|
||||||
content = content[0: start:] + content[end +1::]
|
content = content[0: start:] + content[end +1::]
|
||||||
i += 1
|
i += 1
|
||||||
|
else:
|
||||||
|
|
||||||
|
return reply, question
|
||||||
|
|
||||||
|
|
||||||
content = content.lower()
|
content = content.lower()
|
||||||
question = content
|
question = content
|
||||||
|
|
Loading…
Referencia en una nova incidència