Sending Messages Outside the Main Client
SkillCommunicationExplains how to send Discord messages from cron jobs that don't have a NypsiClient/gateway connection, covering WebhookClient vs the shared getRest() REST client. Use when writing or editing a scheduled job in src/scheduled/jobs/ that needs to post a message to a channel.
Available today. Use it from your connected AI after setup.
No other account needed.
Connect ahel once, and every AI you use reads what you have installed.
Then ask your AI: use the Sending Messages Outside the Main Client skill
What this skill tells your AI
The instructions your AI receives, as published by mxz7/nypsi in .agents/skills/discord-messaging/SKILL.md and read by ahel’s review.
Two patterns exist in src/scheduled/jobs/ for posting messages from cron jobs (no NypsiClient/gateway connection available):
- WebhookClient (
discord.js) - used when a dedicated webhook URL exists in env (e.g.LOTTERY_HOOK,TOPCOMMANDS_HOOK, per-guildbirthdayHook). Simple, but requires a webhook to be created/stored per destination. - Shared REST client (
src/utils/rest.ts,getRest()) - wraps@discordjs/rest, authed withBOT_TOKEN. Post directly to a channel withrest.post(Routes.channelMessages(channelId), { body: { embeds: [...] } }). Embeds must be plain JSON (.toJSON()onCustomEmbed/EmbedBuilderinstances, not the builder objects themselves). Preferred when you already know a channel ID and don't want to manage a separate webhook URL/secret (e.g.topbalance.tsposts to channel833052442069434429this way).
getRest(client?) returns client.rest if a NypsiClient is passed (has an active gateway connection), otherwise a standalone REST instance - use the standalone version in jobs since they don't have a client instance.
Signals
- GitHub stars
- 69
- Forks
- 31
- Last commit
- Sep 2026
ahel review
S4info
community integration — published by mxz7, not discord
Automated review, not a security audit. Ruleset v1.
Advanced
- Catalog kind
- skill
- Gateway key
discord-messaging- Source
- github.com/mxz7/nypsi