Skip to content

Commit

Permalink
This makes use of the emoji_aliases library when installed
Browse files Browse the repository at this point in the history
  • Loading branch information
immae committed May 9, 2024
1 parent d76f080 commit 66ece0e
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions wee_slack.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@
except AttributeError:
JSONDecodeError = ValueError

try:
from emoji_aliases import convert_aliases_to_emoji
except:
convert_aliases_to_emoji = None

# hack to make tests possible.. better way?
try:
import weechat
Expand Down Expand Up @@ -5255,6 +5260,12 @@ def modify_buffer_line(buffer_pointer, ts, new_text):

for pointer, line in zip(pointers, lines):
data = w.hdata_pointer(hdata.line, pointer, "data")
if convert_aliases_to_emoji is not None:
try:
line = convert_aliases_to_emoji(None, None, None, line)
except:
dbg("emoji issue: {}\n".format(traceback.format_exc()), level=2)
pass
w.hdata_update(hdata.line_data, data, {"message": line})

return w.WEECHAT_RC_OK
Expand Down

0 comments on commit 66ece0e

Please sign in to comment.