This repository has been archived on 2025-06-27. You can view files and clone it, but cannot push or open issues or pull requests.
Files
tingle-bot/src/events/handleEvents.ts

28 lines
731 B
TypeScript

/**
* @copyright nhcarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
import { onInteraction } from "./handlers/onInteraction.js";
import { onReady } from "./handlers/onReady.js";
import type { WeatherCache } from "../interfaces/weatherCache.js";
import type { Client } from "discord.js";
/**
* Mounts listeners for the Discord gateway events.
* @param bot - The bot's discord instance.
* @param cache - The cache of weather data.
*/
export const handleEvents = (bot: Client, cache: WeatherCache): void => {
bot.on("ready", async() => {
await onReady(bot, cache);
});
bot.on(
"interactionCreate",
async(interaction) => {
await onInteraction(interaction, cache);
},
);
};