Skip to content

Commit

Permalink
fix(generateSplitImage): use base role color when no color
Browse files Browse the repository at this point in the history
  • Loading branch information
Ecorte committed Jan 28, 2025
1 parent 72197af commit 43fa3a1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions services/helper/src/commands/chat/lme/rainbow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const roles = {
};

const canFail: Record<Snowflake, number> = {
// "821717486217986098": 0.5, // Test
"821717486217986098": 0.5, // Test
"1150780245151068332": 0.5, // Mamayo
};

Expand Down Expand Up @@ -103,7 +103,7 @@ export default class extends SlashCommand<HelperClient> {
const oldColor = role.color;
const color = resolveColor(getRandomColor());

const buffer = await generateSplitImage(role.color, color);
const buffer = await generateSplitImage(role.color === 0 ? Colors.Greyple : role.color, color);

const attachmentName = `${role.id}-${color}.png`;
const attachment = new AttachmentBuilder(buffer, { name: attachmentName });
Expand Down
4 changes: 2 additions & 2 deletions services/watcher/src/listeners/events/roleUpdate.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Context, Listener } from "@sleepymaid/handler";
import { WatcherClient } from "../../lib/extensions/WatcherClient";
import { APIEmbed, APIEmbedField, AttachmentBuilder, AuditLogEvent, Role } from "discord.js";
import { APIEmbed, APIEmbedField, AttachmentBuilder, AuditLogEvent, Colors, Role } from "discord.js";
import { intToHexColor } from "@sleepymaid/util";
import { generateSplitImage } from "@sleepymaid/shared";

Expand Down Expand Up @@ -46,7 +46,7 @@ export default class extends Listener<"roleUpdate", WatcherClient> {
value: `${intToHexColor(oldRole.color)} -> ${intToHexColor(newRole.color)}`,
inline: true,
});
const buffer = await generateSplitImage(oldRole.color, newRole.color);
const buffer = await generateSplitImage(oldRole.color === 0 ? Colors.Greyple : oldRole.color, newRole.color);

const attachmentName = `${oldRole.id}-${newRole.id}.png`;
attachment = new AttachmentBuilder(buffer, { name: attachmentName });
Expand Down

0 comments on commit 43fa3a1

Please sign in to comment.