notes: case insensitive nicks for delivery

master
Adrien Abraham 5 months ago
parent 48233e5ed3
commit 9f8ed09a5c

@ -1,4 +1,5 @@
import re
import time
from edmond.plugin import Plugin
@ -71,7 +72,9 @@ class NotesPlugin(Plugin):
def deliver_notes(self, target, nick):
"""Deliver all notes for this user in the target channel/user."""
notes = self.get_storage_value("notes", [])
notes = list(filter(lambda n: n["dest"] == nick, notes))
notes = list(filter(
lambda n: n["dest"].lower() == nick.lower(), notes
))
self.bot.log_d(f"Delivering {len(notes)} notes to {nick}.")
for note in notes:
message = self.config["deliver_format"].format(
@ -81,6 +84,7 @@ class NotesPlugin(Plugin):
)
self.bot.say(target, message)
self.remove_storage_list_value("notes", note)
time.sleep(0.7)
def count_user_notes(self, nick):
"""Count the number of undelivered notes this user has."""

Loading…
Cancel
Save