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
39
mastobot.py
39
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,20 +161,29 @@ class Mastobot:
|
||||||
try:
|
try:
|
||||||
|
|
||||||
start = content.index("@")
|
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
|
if len(content) > end:
|
||||||
while i < cleanit :
|
|
||||||
|
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()
|
content = content.lower()
|
||||||
question = content
|
question = content
|
||||||
|
|
Loading…
Referencia en una nova incidència