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>
28 lines
731 B
TypeScript
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);
|
|
},
|
|
);
|
|
};
|