Skip to content
This repository was archived by the owner on Oct 9, 2025. It is now read-only.

Commit 4dbf8b5

Browse files
authored
fix: fix sticker url not being used properly (#228)
1 parent 7f542c4 commit 4dbf8b5

File tree

10 files changed

+25
-18
lines changed

10 files changed

+25
-18
lines changed

.github/workflows/release.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
name: Release
22
on:
3-
push:
4-
tags:
5-
- 'v*'
6-
73
workflow_dispatch:
84
inputs:
95
logLevel:

bun.lockb

14 Bytes
Binary file not shown.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"dependencies": {
2626
"@prisma/client": "^6.1.0",
2727
"@sentry/bun": "^8.47.0",
28-
"canvas": "^3.0.1",
28+
"canvas": "^3.0.0-rc3",
2929
"common-tags": "^1.8.2",
3030
"discord-hybrid-sharding": "^2.2.3",
3131
"discord.js": "^14.17.2",

src/commands/slash/Main/rank.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,10 @@ export default class RankCommand extends BaseCommand {
6767

6868
try {
6969
const targetUser = interaction.options.getUser('user') ?? interaction.user;
70-
const stats = await interaction.client.userLevels.getStats(targetUser.id);
70+
const stats = await interaction.client.userLevels.getStats(
71+
targetUser.id,
72+
targetUser.username,
73+
);
7174
const rankCard = await this.createRankCard(targetUser, stats);
7275

7376
await interaction.editReply({ files: [rankCard] });

src/core/BaseClient.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,11 @@ export default class InterChatClient extends Client {
6060
ApplicationCommandManager: 0,
6161
BaseGuildEmojiManager: 0,
6262
StageInstanceManager: 0,
63-
GuildStickerManager: 0,
6463
ThreadMemberManager: 0,
6564
GuildInviteManager: 0,
6665
GuildEmojiManager: 0,
6766
GuildBanManager: 0,
67+
DMMessageManager: 0,
6868
}),
6969
sweepers: {
7070
messages: {

src/services/BroadcastService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ export class BroadcastService {
5353
hub: HubManager,
5454
hubConnections: ConnectionManager[],
5555
connection: ConnectionManager,
56+
attachmentURL: string | undefined,
5657
) {
57-
const attachmentURL = await this.resolveAttachmentURL(message);
5858
const username = this.getUsername(hub.settings, message);
5959
const censoredContent = censor(message.content);
6060
const referredMessage = await this.fetchReferredMessage(message);

src/services/LevelingService.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@ export class LevelingService {
4343
this.updateUserCooldown(userId);
4444
}
4545

46-
public async getStats(userId: string): Promise<
46+
public async getStats(userId: string, username: string): Promise<
4747
UserData & {
4848
stats: UserStats;
4949
requiredXP: number;
5050
}
5151
> {
52-
const user = await this.getOrCreateUser(userId);
52+
const user = await this.getOrCreateUser(userId, username);
5353
const stats = await this.calculateUserStats(user);
5454

5555
return {
@@ -78,7 +78,7 @@ export class LevelingService {
7878
}
7979

8080
private async processMessageXP(message: Message<true>): Promise<void> {
81-
const user = await this.getOrCreateUser(message.author.id);
81+
const user = await this.getOrCreateUser(message.author.id, message.author.username);
8282
const earnedXP = this.generateXP();
8383
const { newLevel, totalXP } = this.calculateXPAndLevel(user, earnedXP);
8484

@@ -140,10 +140,10 @@ export class LevelingService {
140140
// });
141141
}
142142

143-
private async getOrCreateUser(userId: string): Promise<UserData> {
143+
private async getOrCreateUser(userId: string, username: string): Promise<UserData> {
144144
const user = await this.userService.getUser(userId);
145145

146-
return user ?? (await this.userService.createUser({ id: userId }));
146+
return user ?? (await this.userService.createUser({ id: userId, username }));
147147
}
148148

149149
private async calculateUserStats(user: UserData): Promise<UserStats> {

src/services/MessageProcessor.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@ export class MessageProcessor {
5050
const { passed } = await checkBlockedWords(message, await hub.fetchBlockWords());
5151
if (!passed) return;
5252

53-
await this.broadcastService.broadcastMessage(message, hub, hubConnections, connection);
53+
await this.broadcastService.broadcastMessage(
54+
message,
55+
hub,
56+
hubConnections,
57+
connection,
58+
attachmentURL,
59+
);
5460
}
5561
}

src/services/formatters/CompactMsgFormatter.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ export class CompactMessageFormatter implements MessageFormatterStrategy {
1515
referred: opts.referredContent,
1616
censored: opts.censoredContent,
1717
};
18-
1918
const { referredAuthor } = opts.referredMsgData;
2019

2120
// check if the person being replied to explicitly allowed mentionOnReply setting for themself
@@ -41,7 +40,11 @@ export class CompactMessageFormatter implements MessageFormatterStrategy {
4140
// compact mode doesn't need new attachment url for tenor and direct image links
4241
// we can just slap them right in the content without any problems
4342
// [] has an empty char in between its not magic kthxbye
44-
const attachmentURL = message.attachments.size > 0 ? `\n[⁥](${opts.attachmentURL})` : '';
43+
const attachmentURL =
44+
message.attachments.size > 0 || message.stickers.size > 0
45+
? `\n[⁥](${opts.attachmentURL})`
46+
: '';
47+
4548
const messageContent = `${connection.profFilter ? contents.censored : contents.normal} ${attachmentURL}`;
4649

4750
return {

src/utils/calculateLevel.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
export const calculateRequiredXP = (level: number): number =>
2-
Math.floor(100 * Math.pow(level, 2));
1+
export const calculateRequiredXP = (level: number): number => 50 * Math.pow(level, 2) + 25 * level; // arcane formula

0 commit comments

Comments
 (0)