Spaces:
Sleeping
Sleeping
Download src/events/ready.js from Discord-Core-Bot/gateway-bot: direct link, hf CLI and curl.
- Browser
- Download file 821 Bytes
-
https://huggingface.co/spaces/Discord-Core-Bot/gateway-bot/resolve/main/src/events/ready.js
- Command line
-
hf download hf://spaces/Discord-Core-Bot/gateway-bot/src/events/ready.js
-
curl -L -o ready.js https://huggingface.co/spaces/Discord-Core-Bot/gateway-bot/resolve/main/src/events/ready.js
821 Bytes
| import { ActivityType } from 'discord.js' | |
| import { loadGuildConfig } from '../storage/cache.js' | |
| export const name = 'ready' | |
| export const once = true | |
| export async function execute(client) { | |
| console.log(`[ready] Logged in as ${client.user.tag}`) | |
| client.user.setPresence({ | |
| status: 'online', | |
| activities: [ | |
| { | |
| type: ActivityType.Watching, | |
| name: 'for new members', | |
| }, | |
| ], | |
| }) | |
| let loaded = 0 | |
| for (const [, guild] of client.guilds.cache) { | |
| try { | |
| await loadGuildConfig(guild.id) | |
| console.log(`[ready] Loaded config for guild: ${guild.name}`) | |
| loaded++ | |
| } catch (err) { | |
| console.error(`[ready] Failed to load config for guild ${guild.name}: ${err.message}`) | |
| } | |
| } | |
| console.log(`[ready] Watching ${loaded} guilds`) | |
| } |