feat: add announcement channels, publishing and following (#3090)

This commit is contained in:
Hampus authored and GitHub committed 2026-10-01 16:57:21 +02:00
1 parent 376afd2ad6
commit 7e4d5137f8
381 files changed
+45650 -14076

No files matched your search

@@ -253,6 +253,45 @@ export class AvatarService {
});
}
async copyGuildIconToWebhookAvatar(params: {
guildId: bigint;
iconHash: string | null;
webhookId: bigint;
}): Promise<string | null> {
const {guildId, iconHash, webhookId} = params;
if (!iconHash) return null;
const key = this.stripAnimationPrefix(iconHash);
try {
await this.storageService.copyObject({
sourceBucket: Config.s3.buckets.cdn,
sourceKey: `icons/${guildId}/${key}`,
destinationBucket: Config.s3.buckets.cdn,
destinationKey: `avatars/${webhookId}/${key}`,
});
} catch (error) {
if (error instanceof Error && (error.name === 'NoSuchKey' || error.name === 'NotFound')) {
return null;
}
throw error;
}
return iconHash;
}
async ensureWebhookAvatarFromGuildIcon(params: {
guildId: bigint;
iconHash: string | null;
webhookId: bigint;
}): Promise<string | null> {
const {iconHash, webhookId} = params;
if (!iconHash) return null;
const existing = await this.storageService.getObjectMetadata(
Config.s3.buckets.cdn,
`avatars/${webhookId}/${this.stripAnimationPrefix(iconHash)}`,
);
if (existing) return iconHash;
return this.copyGuildIconToWebhookAvatar(params);
}
async processSticker(params: {errorPath: string; base64Image: string; guildFeatures: Iterable<string>}): Promise<{
imageBuffer: Uint8Array;
animated: boolean;