notes: case insensitive nicks for delivery
This commit is contained in:
parent
48233e5ed3
commit
9f8ed09a5c
|
@ -1,4 +1,5 @@
|
||||||
import re
|
import re
|
||||||
|
import time
|
||||||
|
|
||||||
from edmond.plugin import Plugin
|
from edmond.plugin import Plugin
|
||||||
|
|
||||||
|
@ -71,7 +72,9 @@ class NotesPlugin(Plugin):
|
||||||
def deliver_notes(self, target, nick):
|
def deliver_notes(self, target, nick):
|
||||||
"""Deliver all notes for this user in the target channel/user."""
|
"""Deliver all notes for this user in the target channel/user."""
|
||||||
notes = self.get_storage_value("notes", [])
|
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}.")
|
self.bot.log_d(f"Delivering {len(notes)} notes to {nick}.")
|
||||||
for note in notes:
|
for note in notes:
|
||||||
message = self.config["deliver_format"].format(
|
message = self.config["deliver_format"].format(
|
||||||
|
@ -81,6 +84,7 @@ class NotesPlugin(Plugin):
|
||||||
)
|
)
|
||||||
self.bot.say(target, message)
|
self.bot.say(target, message)
|
||||||
self.remove_storage_list_value("notes", note)
|
self.remove_storage_list_value("notes", note)
|
||||||
|
time.sleep(0.7)
|
||||||
|
|
||||||
def count_user_notes(self, nick):
|
def count_user_notes(self, nick):
|
||||||
"""Count the number of undelivered notes this user has."""
|
"""Count the number of undelivered notes this user has."""
|
||||||
|
|
Loading…
Reference in a new issue