Skip to content

Commit

Permalink
Merge pull request #106 from jwheare/custom-emoji
Browse files Browse the repository at this point in the history
Convert custom emoji to the code and URL
  • Loading branch information
sm00th committed Sep 27, 2017
2 parents fdc2c83 + e2f8345 commit 4f1671c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/discord-handlers.c
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,13 @@ static gboolean discord_prepare_message(struct im_connection *ic,
}
}

// Replace custom emoji with code and a URL
GRegex *emoji_regex = g_regex_new("<(:[^:]+:)(\\d+)>", 0, 0, NULL);
gchar *emoji_msg = g_regex_replace(emoji_regex, msg, -1, 0, "\\1 https://cdn.discordapp.com/emojis/\\2.png", 0, NULL);
g_free(msg);
msg = emoji_msg;
g_regex_unref(emoji_regex);

GRegex *cregex = g_regex_new("<#(\\d+)>", 0, 0, NULL);
gchar *fmsg = g_regex_replace_eval(cregex, msg, -1, 0, 0,
discord_replace_channel,
Expand Down

0 comments on commit 4f1671c

Please sign in to comment.