Skip to content

Commit

Permalink
Add configurable fm heart
Browse files Browse the repository at this point in the history
  • Loading branch information
abbyfour committed Nov 3, 2024
1 parent 56b65ce commit 88c4deb
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/commands/Lastfm/Friends/Help.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { FriendsChildCommand } from "./FriendsChildCommand";
export class Help extends FriendsChildCommand {
idSeed = "csr yeham";

description = "View help about the fishy minigame";
description = "View help about managing friends";
usage = [""];

slashCommand = true;
Expand Down
5 changes: 4 additions & 1 deletion src/commands/Lastfm/NowPlaying/Config/Help.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ nowplaying config allows you to customize which elements appear in the footer of
\`${this.prefix}npc add <options>\` - Quickly add some options
\`${this.prefix}npc remove <options>\` - Quickly remove some options
You can also use \`${this.prefix}reacts\` to control nowplaying reactions
You can also use \`${this.prefix}reacts\` to control nowplaying reactions.
You can change the username display and heart emoji in user settings. (\`${
this.prefix
}usersettings\`)
**Options**
${sortConfigOptions(getComponents().map((o) => o.componentName))
Expand Down
12 changes: 11 additions & 1 deletion src/lib/emoji/nativeEmojis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@ export const NativeEmoji = {
mendingHeart: "❤️‍🩹",
brokenHeart: "💔",
revolvingHearts: "💞",
heart: "❤️",
sparklingHeart: "💖",
heart: "❤️",
pinkheart: "🩷",
orangeheart: "🧡",
yellowheart: "💛",
greenheart: "💚",
lightblueheart: "🩵",
blueheart: "💙",
purpleheart: "💜",
blackheart: "🖤",
whiteheart: "🤍",
brownheart: "🤎",
} as const satisfies Record<string, string>;
12 changes: 11 additions & 1 deletion src/lib/nowplaying/compoundComponents/LovedAndOwnedComponent.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { ServiceRegistry } from "../../../services/ServicesRegistry";
import { Emoji } from "../../emoji/Emoji";
import { SettingsService } from "../../settings/SettingsService";
import { AnyIn, BaseCompoundComponent } from "../base/BaseNowPlayingComponent";

const lovedAndOwnedDependencies = [
Expand All @@ -16,6 +18,8 @@ export class LovedAndOwnedComponent extends BaseCompoundComponent<
static replaces = new AnyIn(["loved", "card-ownership"]);

async render() {
const settingsService = ServiceRegistry.get(SettingsService);

const loved =
this.values.trackInfo?.loved || !!this.values.cachedLovedTrack;
const owned =
Expand All @@ -27,7 +31,13 @@ export class LovedAndOwnedComponent extends BaseCompoundComponent<
} else if (owned) {
return { size: 0, string: Emoji.sparkles };
} else if (loved) {
return { size: 0, string: Emoji.heart };
return {
size: 0,
string:
settingsService.get("fmLovedEmoji", {
userID: this.ctx.author.id,
}) || Emoji.heart,
};
} else {
return { string: "", size: 0 };
}
Expand Down
21 changes: 21 additions & 0 deletions src/lib/settings/Settings.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { defaultPrefix } from "../../../config.json";
import { ComboService } from "../../services/dbservices/ComboService";
import { Emoji } from "../emoji/Emoji";
import {
BaseSetting,
BotScopedSetting,
Expand Down Expand Up @@ -91,6 +92,26 @@ export const Settings = {
FMMode.VERBOSE,
],
}),
fmLovedEmoji: new UserScopedSetting("fm_loved_emoji", {
friendlyName: "!fm loved emoji",
description: "Control what emoji Gowon shows for loved tracks in your !fms",
category: "Now Playing",
type: SettingType.Choice,
default: Emoji.heart,
choices: [
Emoji.heart,
Emoji.pinkheart,
Emoji.orangeheart,
Emoji.yellowheart,
Emoji.greenheart,
Emoji.lightblueheart,
Emoji.blueheart,
Emoji.purpleheart,
Emoji.blackheart,
Emoji.whiteheart,
Emoji.brownheart,
],
}),
fmUsernameDisplay: new UserScopedSetting("fm_username_display", {
friendlyName: "!fm username display",
description: "Control what username Gowon shows in your !fms",
Expand Down

0 comments on commit 88c4deb

Please sign in to comment.