generated from nhcarrigan/template
Reviewed-on: https://codeberg.org/nhcarrigan/tingle-bot/pulls/1 Co-authored-by: Naomi Carrigan <commits@nhcarrigan.com> Co-committed-by: Naomi Carrigan <commits@nhcarrigan.com>
25 lines
770 B
TypeScript
25 lines
770 B
TypeScript
/**
|
|
* @copyright nhcarrigan
|
|
* @license Naomi's Public License
|
|
* @author Naomi Carrigan
|
|
*/
|
|
import { join } from "node:path";
|
|
import type { AttachmentData }
|
|
from "../../interfaces/commands/attachmentData.js";
|
|
import type { RegionName } from "../../interfaces/weather/names/regionName.js";
|
|
|
|
/**
|
|
* Selects one of the random banner images from the banner folder.
|
|
* @param region - The name of the region.
|
|
* @returns The banner image attachment data.
|
|
*/
|
|
export const getBannerImage = (region: RegionName): AttachmentData => {
|
|
const fileName
|
|
= `${region}${String(Math.ceil(Math.random() * 3))}.png`;
|
|
const filePath = join(process.cwd(), "src", "assets", "banners", fileName);
|
|
return {
|
|
attachmentString: `attachment://${fileName}`,
|
|
filePath,
|
|
};
|
|
};
|