This bot lets you query Neynar for Farcaster user data directly from Discord. It responds to two search flows through a single /search command—wallet addresses and usernames—and includes a /help command for quick usage reminders. The overall structure mirrors the lightweight Discord bot template from snyk-snippets while swapping in Neynar lookups for Wordle logic https://github.com/snyk-snippets/discord-wordle-bot-template.
- Node.js 18+ (Discord.js and Neynar SDK require the active LTS or higher).
- A Discord application with a bot token.
- A Neynar API key with permission to access user lookups.
-
Install dependencies:
npm install
-
Copy
env.exampleto.envand fill in your credentials:DISCORD_TOKEN=your-bot-token DISCORD_CLIENT_ID=discord-app-client-id DISCORD_GUILD_ID=optional-guild-id NEYNAR_API_KEY=your-neynar-api-keyDISCORD_GUILD_IDis optional; include it to register commands to a development server instantly. Omit it for global registration (may take up to an hour to propagate). -
Register slash commands:
npm run register-commands
-
Start the bot:
npm run dev
/search <wallet|username>– Looks up Farcaster profiles by wallet or username and shows recent Clanker deployments for that user when available./casts <keyword>– Returns the earliest cast matching the keyword plus the most recent matching casts (default 2, configurable)./help– Displays a summary of the available commands and configuration requirements.- Posting a Warpcast, fcast.me, or farcaster.xyz cast URL in a channel automatically triggers an embed with the cast text, author details, custody wallet, and verified ETH addresses.
Responses render rich embeds with usernames, FIDs, custody addresses, follower counts, bios, and a link to the user's Warpcast profile.
- Global command registration can take time to synchronize across Discord; for faster feedback during development, set
DISCORD_GUILD_ID. - Neynar rate limits depend on your plan—consider adding retry/backoff or caching if you expect high traffic.
- Use
npm run buildfollowed bynpm startfor production deployments.
The backend/ directory contains an Express-based API for managing guild subscriptions and receiving Neynar webhooks.
cd backend
cp env.example .env # fill in DATABASE_URL, DISCORD_BOT_TOKEN, NEYNAR_API_KEY, WEBHOOK_SECRET
npm install
npm run devThe service exposes:
POST /api/subscriptions– create or update a guild subscription (guildId,channelId,fid).DELETE /api/subscriptions– remove a subscription.GET /api/subscriptions?guildId=– list subscriptions for a guild.POST /webhooks/neynar– webhook endpoint Neynar uses to delivercast.createdevents (secured viax-webhook-secretheader).
When deployed (e.g., on Railway), point Neynar’s webhook configuration at the /webhooks/neynar endpoint.