generated from nhcarrigan/template
feat: initial commit
This commit is contained in:
19
src/modules/images/getBannerImage.ts
Normal file
19
src/modules/images/getBannerImage.ts
Normal file
@ -0,0 +1,19 @@
|
||||
import { join } from "path";
|
||||
|
||||
import { AttachmentData } from "../../interfaces/commands/AttachmentData";
|
||||
import { RegionName } from "../../interfaces/weather/names/RegionName";
|
||||
|
||||
/**
|
||||
* Selects one of the random banner images from the banner folder.
|
||||
*
|
||||
* @param {RegionName} region The name of the region.
|
||||
* @returns {AttachmentData} The banner image attachment data.
|
||||
*/
|
||||
export const getBannerImage = (region: RegionName): AttachmentData => {
|
||||
const fileName = `${region}${Math.ceil(Math.random() * 3)}.png`;
|
||||
const filePath = join(process.cwd(), "src", "assets", "banners", fileName);
|
||||
return {
|
||||
attachmentString: `attachment://${fileName}`,
|
||||
filePath,
|
||||
};
|
||||
};
|
Reference in New Issue
Block a user