FIX: apreciabot ahora ignora los saltos de línea
This commit is contained in:
parent
c5665da8a2
commit
85be0ca722
|
@ -42,8 +42,9 @@ for i in range(0, max_notifications - 5):
|
||||||
n = notifications[i]
|
n = notifications[i]
|
||||||
if str(n['id']) not in last_ids:
|
if str(n['id']) not in last_ids:
|
||||||
# Mentions data are HTML paragraphs so we delete everything between <> to clean it up
|
# Mentions data are HTML paragraphs so we delete everything between <> to clean it up
|
||||||
rawContent = BeautifulSoup(n['status']['content'], "html.parser").get_text()
|
rawContent = n['status']['content'].replace("</br >", " ")
|
||||||
content = re.sub(no_unicode_spaces_pattern, "", rawContent).split(" ")
|
text = BeautifulSoup(rawContent, "html.parser").get_text()
|
||||||
|
content = re.sub(no_unicode_spaces_pattern, "", text).split(" ")
|
||||||
try:
|
try:
|
||||||
first_mention = content[0]
|
first_mention = content[0]
|
||||||
target = "@" + content[1]
|
target = "@" + content[1]
|
||||||
|
|
|
@ -45,8 +45,13 @@ def get_new_notifications(api, bot_name, types=None):
|
||||||
notifications = api.notifications(types=types)
|
notifications = api.notifications(types=types)
|
||||||
new_notifications = []
|
new_notifications = []
|
||||||
new_notifications_ids = []
|
new_notifications_ids = []
|
||||||
|
max_notification = 0
|
||||||
|
if len(notifications) < 2:
|
||||||
|
max_notification = len(notifications)
|
||||||
|
else:
|
||||||
|
max_notification = len(notifications) // 2
|
||||||
|
|
||||||
for i in range(0, len(notifications) // 2):
|
for i in range(0, max_notification):
|
||||||
if str(notifications[i]['id']) not in last_notifications:
|
if str(notifications[i]['id']) not in last_notifications:
|
||||||
new_notifications.append(notifications[i])
|
new_notifications.append(notifications[i])
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue