diff --git a/src/api/routes/webhooks/#webhook_id/#token/index.ts b/src/api/routes/webhooks/#webhook_id/#token/index.ts index 3dfe514f..692e20d6 100644 --- a/src/api/routes/webhooks/#webhook_id/#token/index.ts +++ b/src/api/routes/webhooks/#webhook_id/#token/index.ts @@ -15,6 +15,7 @@ import { handleFile, ValidateName, EmbedType, + capitalize, } from "@spacebar/util"; import { NextFunction, Request, Response, Router } from "express"; import { HTTPError } from "lambert-server"; @@ -284,7 +285,7 @@ function transformGitHubToDiscord( username: "GitHub", embeds: [ { - title: `➕ ${payload.ref_type} created in ${payload.repository?.full_name}`, + title: `➕ ${capitalize(payload.ref_type)} created in ${payload.repository?.full_name}`, type: EmbedType.rich, description: `A new ${payload.ref_type} named \`${payload.ref}\` was created`, color: 0x7289da, diff --git a/src/util/util/String.ts b/src/util/util/String.ts index 1000ebe9..171bc3b6 100644 --- a/src/util/util/String.ts +++ b/src/util/util/String.ts @@ -22,3 +22,13 @@ export function trimSpecial(str?: string): string { if (!str) return ""; return str.replace(SPECIAL_CHAR, "").trim(); } + +/** + * Capitalizes the first letter of a string. + * @param str The string to capitalize. + * @returns The capitalized string. + */ +export function capitalize(str: string): string { + if (!str) return ""; + return str.charAt(0).toUpperCase() + str.slice(1); +}