generated from nhcarrigan/template
feat: re-merge (#2)
Reviewed-on: https://codeberg.org/nhcarrigan/tingle-bot/pulls/2 Co-authored-by: Naomi Carrigan <commits@nhcarrigan.com> Co-committed-by: Naomi Carrigan <commits@nhcarrigan.com>
This commit is contained in:
@ -5,6 +5,7 @@
|
||||
*/
|
||||
import { REST, Routes, type Client, WebhookClient } from "discord.js";
|
||||
import { commandList } from "../../commands/_commandList.js";
|
||||
import { loadChannels } from "../../modules/loadChannels.js";
|
||||
import { scheduleForecasts } from "../../modules/scheduleForecasts.js";
|
||||
import { logHandler } from "../../utils/logHandler.js";
|
||||
import type { WeatherCache } from "../../interfaces/weatherCache.js";
|
||||
@ -15,17 +16,17 @@ import type { WeatherCache } from "../../interfaces/weatherCache.js";
|
||||
* @param bot - The bot's Discord instance.
|
||||
* @param cache - The cache of weather data.
|
||||
*/
|
||||
export const onReady = async (
|
||||
export const onReady = async(
|
||||
bot: Client,
|
||||
cache: WeatherCache
|
||||
cache: WeatherCache,
|
||||
): Promise<void> => {
|
||||
const webhook = new WebhookClient({ url: process.env.DEBUG_HOOK as string });
|
||||
|
||||
await webhook.send("Ruu Bot is online!");
|
||||
logHandler.log("info", "Connected to Discord!");
|
||||
|
||||
const rest = new REST({ version: "9" }).setToken(
|
||||
process.env.DISCORD_TOKEN ?? ""
|
||||
const rest = new REST({ version: "10" }).setToken(
|
||||
process.env.DISCORD_TOKEN ?? "",
|
||||
);
|
||||
|
||||
const commandData = commandList.map((command) => {
|
||||
@ -35,12 +36,15 @@ export const onReady = async (
|
||||
await rest.put(
|
||||
Routes.applicationGuildCommands(
|
||||
bot.user?.id ?? "oopsie whoopsie",
|
||||
process.env.HOME_GUILD_ID ?? ""
|
||||
process.env.HOME_GUILD_ID ?? "",
|
||||
),
|
||||
{ body: commandData }
|
||||
{ body: commandData },
|
||||
);
|
||||
|
||||
logHandler.log("info", "Registered commands!");
|
||||
await webhook.send("Registered commands!");
|
||||
|
||||
cache.channels = await loadChannels(bot);
|
||||
|
||||
await webhook.send("Loaded channels!");
|
||||
scheduleForecasts(cache);
|
||||
};
|
||||
|
Reference in New Issue
Block a user