Skip to content

Commit 1485855

Browse files
committed
Update sponsor posts
1 parent 9bcf412 commit 1485855

File tree

1 file changed

+47
-7
lines changed

1 file changed

+47
-7
lines changed

src/pages/api/media/sponsors/posts.ts

Lines changed: 47 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ export const GET: APIRoute = async () => {
2727
] as const;
2828

2929
const commercialMessages = [
30-
"🎉✨ We are pleased to welcome SPONSOR_NAME as a sponsor for EuroPython 2025! Your support is making a huge difference. We are so grateful for your sponsorship and are thrilled to have you with us. 🙌SPONSOR_HANDLE SPONSOR_URL",
31-
"🚀✨ We are delighted to welcome SPONSOR_NAME as a sponsor for EuroPython 2025! Your support helps make this event extraordinary. We are so grateful for your sponsorship and are thrilled to have you with us. 🙌SPONSOR_HANDLE SPONSOR_URL",
32-
"🎉✨ A big thank you to SPONSOR_NAME for joining us as a sponsor for EuroPython 2025! Your support is making a huge impact. We are so grateful for your sponsorship and are thrilled to have you with us. 🙌SPONSOR_HANDLE SPONSOR_URL",
30+
"🎉✨ We are pleased to welcome SPONSOR_NAME as a sponsor for EuroPython 2025! Your support is making a huge difference. We are so grateful for your sponsorship and are thrilled to have you with us. 🙌 SPONSOR_HANDLE SPONSOR_URL",
31+
"🚀✨ We are delighted to welcome SPONSOR_NAME as a sponsor for EuroPython 2025! Your support helps make this event extraordinary. We are so grateful for your sponsorship and are thrilled to have you with us. 🙌 SPONSOR_HANDLE SPONSOR_URL",
32+
"🎉✨ A big thank you to SPONSOR_NAME for joining us as a sponsor for EuroPython 2025! Your support is making a huge impact. We are so grateful for your sponsorship and are thrilled to have you with us. 🙌 SPONSOR_HANDLE SPONSOR_URL",
3333
"🚀✨ Big shoutout and heartfelt thanks to SPONSOR_NAME for sponsoring EuroPython 2025! Your support is crucial in bringing the European Python 🐍 community closer together. We are so grateful for your sponsorship and are thrilled to have you with us. 🙌SPONSOR_HANDLE SPONSOR_URL",
34-
"🎉✨ Thank you to SPONSOR_NAME for sponsoring EuroPython 2025! Your support is making a huge difference. We are so grateful for your sponsorship and are thrilled to have you with us. 🙌SPONSOR_HANDLE SPONSOR_URL",
35-
"🚀✨ A huge thank you to SPONSOR_NAME for sponsoring EuroPython 2025! Your support helps make this event extraordinary. 🙌SPONSOR_HANDLE SPONSOR_URL",
34+
"🎉✨ Thank you to SPONSOR_NAME for sponsoring EuroPython 2025! Your support is making a huge difference. We are so grateful for your sponsorship and are thrilled to have you with us. 🙌 SPONSOR_HANDLE SPONSOR_URL",
35+
"🚀✨ A huge thank you to SPONSOR_NAME for sponsoring EuroPython 2025! Your support helps make this event extraordinary. 🙌 SPONSOR_HANDLE SPONSOR_URL",
3636
];
3737

3838
const communityMessages = [
@@ -48,11 +48,47 @@ export const GET: APIRoute = async () => {
4848
};
4949

5050
const message_template = {
51+
x: ({ name, handle, url, tier }) => {
52+
const isCommercial = isCommercialTier(tier);
53+
const messages = isCommercial ? commercialMessages : communityMessages;
54+
const template = messages[0];
55+
56+
return template
57+
.replace(/SPONSOR_NAME/g, name)
58+
.replace(/SPONSOR_HANDLE/g, handle)
59+
.replace(/SPONSOR_URL/g, url)
60+
.replace(/SUPPORTER_HANDLE/g, handle)
61+
.replace(/SUPPORTER_URL/g, url);
62+
},
5163
linkedin: ({ name, handle, url, tier }) => {
5264
const isCommercial = isCommercialTier(tier);
5365
const messages = isCommercial ? commercialMessages : communityMessages;
5466
const template = getRandomMessage(messages);
5567

68+
return template
69+
.replace(/SPONSOR_NAME/g, name)
70+
.replace(/SPONSOR_HANDLE/g, handle)
71+
.replace(/SPONSOR_URL/g, url)
72+
.replace(/SUPPORTER_HANDLE/g, handle)
73+
.replace(/SUPPORTER_URL/g, url);
74+
},
75+
bsky: ({ name, handle, url, tier }) => {
76+
const isCommercial = isCommercialTier(tier);
77+
const messages = isCommercial ? commercialMessages : communityMessages;
78+
const template = getRandomMessage(messages);
79+
80+
return template
81+
.replace(/SPONSOR_NAME/g, name)
82+
.replace(/SPONSOR_HANDLE/g, handle)
83+
.replace(/SPONSOR_URL/g, url)
84+
.replace(/SUPPORTER_HANDLE/g, handle)
85+
.replace(/SUPPORTER_URL/g, url);
86+
},
87+
fosstodon: ({ name, handle, url, tier }) => {
88+
const isCommercial = isCommercialTier(tier);
89+
const messages = isCommercial ? commercialMessages : communityMessages;
90+
const template = getRandomMessage(messages);
91+
5692
return template
5793
.replace(/SPONSOR_NAME/g, name)
5894
.replace(/SPONSOR_HANDLE/g, handle)
@@ -73,12 +109,13 @@ export const GET: APIRoute = async () => {
73109

74110
const sponsorImage = `https://ep2025.europython.eu/media/sponsors/social-${sponsor.id}.png`;
75111

76-
// Extract handles for each platform
77112
const handles = {
113+
x: socials?.twitter,
78114
linkedin: socials?.linkedin,
115+
bsky: socials?.bluesky,
116+
fosstodon: socials?.mastodon,
79117
};
80118

81-
// Generate appropriate messages for each platform
82119
const generateMessage = (platform: keyof typeof message_template) => {
83120
const templateFn = message_template[platform];
84121
const handle = handles[platform as keyof typeof handles] || "";
@@ -99,7 +136,10 @@ export const GET: APIRoute = async () => {
99136
image: sponsorImage,
100137
handles: handles,
101138
channel: {
139+
x: generateMessage("x"),
102140
linkedin: generateMessage("linkedin"),
141+
bsky: generateMessage("bsky"),
142+
fosstodon: generateMessage("fosstodon"),
103143
},
104144
};
105145

0 commit comments

Comments
 (0)