Skip to content

Commit

Permalink
Merge pull request #176 from iminlikewithyou/highlighter-themes
Browse files Browse the repository at this point in the history
Add highlighter themes
  • Loading branch information
iminlikewithyou authored Jul 28, 2024
2 parents f8589f3 + 38b0b01 commit dd408db
Show file tree
Hide file tree
Showing 24 changed files with 1,659 additions and 398 deletions.
45 changes: 0 additions & 45 deletions assets/emoji-maps/highlighters/default/highlighted.ts

This file was deleted.

45 changes: 0 additions & 45 deletions assets/emoji-maps/highlighters/default/present.ts

This file was deleted.

45 changes: 0 additions & 45 deletions assets/emoji-maps/highlighters/default/wildcard.ts

This file was deleted.

45 changes: 0 additions & 45 deletions assets/emoji-maps/highlighters/vivi/highlighted.ts

This file was deleted.

45 changes: 0 additions & 45 deletions assets/emoji-maps/highlighters/vivi/present.ts

This file was deleted.

45 changes: 0 additions & 45 deletions assets/emoji-maps/highlighters/vivi/wildcard.ts

This file was deleted.

12 changes: 9 additions & 3 deletions lame-bot/src/word-bomb-mini.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import {
solverCache
} from "../../src/dictionary/dictionary";
import { getRemarkEmoji, getStreakNumbers } from "../../src/emoji-renderer";
import { DefaultHighlighter, Highlighter } from "../../src/highlighting/Highlighter";
import { escapeRegExp, getPromptRegexDisplayText, getPromptRepeatableText } from "../../src/regex";
import { Highlighters } from "../../src/themes/highlighter";
import { createEnglishList, escapeDiscordMarkdown, formatNumber, formatPercentage, formatPlacement, getCleanName } from "../../src/utils";
import { getChannel, getGuild, lameBotClient, sendMessage, sendMessageAsReply } from "./client";

Expand Down Expand Up @@ -128,7 +128,7 @@ async function startRound() {
replyMessage,
(
getRemarkEmoji("bomb") + " **Quick!** Type a word containing:" +
"\n\n" + getPromptRegexDisplayText(prompt, Highlighters.Default) + " ***。✲゚** (" + formatNumber(solutions) + (solutions === 1 ? " solution)" : " solutions)") +
"\n\n" + getPromptRegexDisplayText(prompt, DefaultHighlighter) + " ***。✲゚** (" + formatNumber(solutions) + (solutions === 1 ? " solution)" : " solutions)") +
(lengthRequired ? "\n\n• Must be **" + promptWord.length + "** characters!" : "")
)
);
Expand Down Expand Up @@ -610,6 +610,11 @@ async function endRound() {
});
};

let highlighter: Highlighter;
const retrieveHighlighterTheme = async () => {
highlighter = await Highlighter.fromServerInteraction(winnerUser);
};

let startTime2 = Date.now();

await Promise.all([
Expand All @@ -622,6 +627,7 @@ async function endRound() {
),
lateRemarks(),
roundRemarks(),
retrieveHighlighterTheme()
]);

console.log("Remarks completed in " + (Date.now() - startTime2) + "ms");
Expand All @@ -636,7 +642,7 @@ async function endRound() {
)} <@${winnerUser}> solved it! ${getRemarkEmoji("solvedIt")}**\n\n` +
getRemarkEmoji("roundEnded") +
" **Round ended!**\n" +
Highlighters.Default.highlight(winnerSolution, prompt) +
highlighter.highlight(winnerSolution, prompt) +
"\n" +
getRemarkText()
);
Expand Down
5 changes: 5 additions & 0 deletions src/database/db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ export async function getCash(user) {
return profile.cash || 0;
}

export async function getHighlighterTheme(user) {
let profile = await getProfile(user);
return profile.highlighterTheme || "Default";
}

export async function spendCash(user, amount) {
if (amount < 0) return false;
let profile = await getProfile(user);
Expand Down
Loading

0 comments on commit dd408db

Please sign in to comment.