Handle duplicates

Duplicate dictionary elements are not supported in Python, replace
duplicates with a list which is then randomly picked from.

Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
This commit is contained in:
Georg Pfuetzenreuter 2024-09-20 17:57:44 +02:00
parent b6a02bef56
commit 8f7515fb30
Signed by: Georg
GPG Key ID: 1ED2F138E7E6FF57

View File

@ -28,6 +28,7 @@
### ###
from random import choice
from supybot import utils, plugins, ircutils, callbacks from supybot import utils, plugins, ircutils, callbacks
from supybot.commands import * from supybot.commands import *
try: try:
@ -101,7 +102,10 @@ emoji = {'innocent':'ʘ‿ʘ',
'shy':'(๑•́ ₃ •̀๑)', 'shy':'(๑•́ ₃ •̀๑)',
'fly-away':'⁽⁽ଘ( ˊᵕˋ )ଓ⁾⁾', 'fly-away':'⁽⁽ଘ( ˊᵕˋ )ଓ⁾⁾',
'careless':'◔_◔', 'careless':'◔_◔',
'love':'♥‿♥', 'love': [
'♥‿♥',
'-`ღ´-',
],
'ididit':'ԅ(≖‿≖ԅ)', 'ididit':'ԅ(≖‿≖ԅ)',
'kissing':'( ˘ ³˘)♥', 'kissing':'( ˘ ³˘)♥',
'shark-face':'( ˇ෴ˇ )', 'shark-face':'( ˇ෴ˇ )',
@ -140,7 +144,6 @@ emoji = {'innocent':'ʘ‿ʘ',
'fuck-off':'(° ͜ʖ͡°)╭∩╮', 'fuck-off':'(° ͜ʖ͡°)╭∩╮',
'smiley-toast':'ʕʘ̅͜ʘ̅ʔ', 'smiley-toast':'ʕʘ̅͜ʘ̅ʔ',
'exorcism':'ح(•̀ж•́)ง †', 'exorcism':'ح(•̀ж•́)ง †',
'love':'-`ღ´-',
'taking-a-dump':'(⩾﹏⩽)', 'taking-a-dump':'(⩾﹏⩽)',
'dab':'ヽ( •_)ᕗ', 'dab':'ヽ( •_)ᕗ',
'wave-dance':'~(^-^)~', 'wave-dance':'~(^-^)~',
@ -167,6 +170,8 @@ class UnicodeEmoji(callbacks.Plugin):
re = emoji.get(emote.lower()) re = emoji.get(emote.lower())
if re is None: if re is None:
re = emoji['fuck-off'] re = emoji['fuck-off']
elif isinstance(re, list):
re = choice(re)
irc.reply('%s' % re, msg=msg, prefixNick=False ) irc.reply('%s' % re, msg=msg, prefixNick=False )
e = wrap(e, ['text']) e = wrap(e, ['text'])