No need to check if account.acct has an @

This commit is contained in:
spla 2022-03-08 11:30:11 +01:00
pare f06d1e5374
commit 702f750596
S'han modificat 1 arxius amb 4 adicions i 21 eliminacions

Veure arxiu

@ -148,7 +148,7 @@ if __name__ == '__main__':
account_id = bot_notifications[i]
username = bot_notifications[i].account.username
username = notifications[i].account.acct
status_id = bot_notifications[i].status.id
@ -170,33 +170,16 @@ if __name__ == '__main__':
ambiguous_reply = "\n- ".join(str(x) for x in wiki_result)
if '@' in bot_notifications[i].account.acct:
toot_text = f"@{bot_notifications[i].account.acct} '{question}' és una consulta ambigua. Potser et referies a:\n\n{ambiguous_reply}"
else:
toot_text = f"@{username} '{question}' és una consulta ambigua. Potser et referies a:\n\n{ambiguous_reply}"
toot_text = (toot_text[:400] + '... ') if len(toot_text) > 400 else toot_text
except wikipedia.exceptions.PageError as page_error:
if '@' in bot_notifications[i].account.acct:
toot_text = f"@{bot_notifications[i].account.acct} l'article '{question}' no existeix. Varia una mica la consulta o si confirmes que l'article realment no existeix, t'animem a crear-lo. Som l'enciclopèdia lliure que tu també pots editar.\n"
else:
toot_text = "@{username} l'article '{question}' no existeix. Varia una mica la consulta o si comprobes que l'article no existeix t'animem a crear-lo. Som l'enciclopèdia lliure que tu també pots editar.\n"
toot_text += ":viqui:"
else:
if '@' in bot_notifications[i].account.acct:
toot_text = f'@{bot_notifications[i].account.acct}\n'
else:
toot_text = f'@{username}\n'