More resilient lookup

To improve the user experience:
- on queries of non-existent emotes, fall back to a default
  instead of returning KeyError
- allow lookup of emotes regardless of capitalization

Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
This commit is contained in:
Georg Pfuetzenreuter 2024-08-22 01:04:18 +02:00
parent fbc58b0f7d
commit c35277bf59
Signed by: Georg
GPG Key ID: 1ED2F138E7E6FF57

View File

@ -160,7 +160,9 @@ class UnicodeEmoji(callbacks.Plugin):
Prints the Unicode emoji as listed here https://gist.github.com/mogad0n/476c3880dc0e0a059ed03efa265e50f7 Prints the Unicode emoji as listed here https://gist.github.com/mogad0n/476c3880dc0e0a059ed03efa265e50f7
""" """
re = emoji[emote] re = emoji.get(emote.lower())
if re is None:
re = emoji['fuck-off']
irc.reply('%s' % re, msg=msg, prefixNick=False ) irc.reply('%s' % re, msg=msg, prefixNick=False )
e = wrap(e, ['text']) e = wrap(e, ['text'])