Skip to content

Commit

Permalink
work on reactions
Browse files Browse the repository at this point in the history
  • Loading branch information
targoninc-alex committed Jun 5, 2024
1 parent 129c5d7 commit bfe1112
Show file tree
Hide file tree
Showing 9 changed files with 916 additions and 2,351 deletions.
11 changes: 8 additions & 3 deletions emoji-generation/generateJson.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import path from "path";
import {Reaction, ReactionGroup} from "../src/features/database/models";

const source = "emojis.json";
const target = "emojis_db.json";
const reactionGroupsTarget = "../src/enums/reactionGroups.json";
const reactionsTarget = "../src/enums/reactions.json";

const emojis = JSON.parse(fs.readFileSync(source, "utf8"));

Expand All @@ -18,7 +19,7 @@ const groups = groupNames.map((groupName, index) => {
};
});

fs.writeFileSync("groups.json", JSON.stringify(groups, null, 2));
fs.writeFileSync(reactionGroupsTarget, JSON.stringify(groups, null, 2));

let reactions = [];
for (const group of groups) {
Expand All @@ -31,11 +32,15 @@ for (const group of groups) {
content: reaction.emoji,
identifier: reaction.name
.replaceAll(" ", "_")
.replaceAll("-", "_")
.replaceAll(":", "")
.replaceAll("⊛_", "")
.toLowerCase(),
});
}
}
}

fs.writeFileSync(target, JSON.stringify(reactions, null, 2));
console.log(`${reactions.length} reactions generated.`);

fs.writeFileSync(reactionsTarget, JSON.stringify(reactions, null, 2));
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"start": "node dist/main.js",
"build:main": "babel -x .ts -d dist src",
"build:types": "tsc",
"models-from-database": "npx @rmp135/sql-ts -c database-type-generation/sql-to-ts.json"
"models-from-database": "npx @rmp135/sql-ts -c database-type-generation/sql-to-ts.json",
"parse-reactions": "cd emoji-generation && bun generateJson.ts"
},
"author": "",
"license": "ISC",
Expand Down
1,464 changes: 0 additions & 1,464 deletions src/enums/defaultReactions.ts

This file was deleted.

File renamed without changes.
Loading

0 comments on commit bfe1112

Please sign in to comment.