Skip to content

Commit

Permalink
better creation of unicode emojis that will actually work
Browse files Browse the repository at this point in the history
  • Loading branch information
braindigitalis committed Jul 12, 2023
1 parent 5497415 commit e179555
Show file tree
Hide file tree
Showing 2 changed files with 5,469 additions and 5,468 deletions.
3 changes: 2 additions & 1 deletion buildtools/emojis.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@

$header = "#pragma once\n\nnamespace dpp { namespace unicode_emoji {\n";

/* This JSON is generated originally via the NPM package maintained by Discord themselves at https://www.npmjs.com/package/discord-emoji */
$emojis = json_decode(file_get_contents("https://raw.githubusercontent.com/ArkinSolomon/discord-emoji-converter/master/emojis.json"));
if ($emojis) {
foreach ($emojis as $name=>$code) {
if (preg_match("/^\d+/", $name)) {
$name = "_" . $name;
}
$header .= " constexpr std::string " .$name . "(\"$code\");\n";
$header .= " constexpr const char[] " .$name . " = \"$code\";\n";
}
$header .= "}\n};\n";
file_put_contents("include/dpp/unicode_emoji.h", $header);
Expand Down
Loading

0 comments on commit e179555

Please sign in to comment.