Send random anime images from multiple sources (waifu.im, nekosapi.com, waifu.pics, pic.re, nekos.best, danbooru, rule34, tbib) to Discord channels via webhooks.
- πΌοΈ 8 (6) Image Sources - Fetches from waifu.im, nekosapi.com, waifu.pics, pic.re, nekos.best, danbooru,
rule34, andtbib - π SFW/NSFW Support - Separate webhooks for SFW and NSFW content
- π·οΈ Tag Filtering - Filter images by specific tags (varies by source)
- β° Scheduling - Automated posting via cron jobs or GitHub Actions
- π₯οΈ CLI Interface - Easy-to-use command line interface
- π Rich Embeds - Discord embeds with artist credits, source links, and resolution info
- π¨ Image Accent Colors - Extracts dominant colors from images for embed styling (like waifu.im)
- π Fallback Mechanism - Automatically switches sources if one fails
- π Webhook Profiles - Source-specific webhook usernames and avatars for all sources
- Node.js >= 18.0.0
- Discord webhooks (see Setup Discord Webhooks)
# Clone the repository
git clone https://github.com/sang765/Random-Waifu-Image.git
cd Random-Waifu-Image
# Install dependencies
npm install
# Build TypeScript
npm run build- Copy the example environment file:
cp .env.example .env- Edit
.envwith your Discord webhook URLs:
SFW_WEBHOOK_URL=https://discord.com/api/webhooks/YOUR_SFW_ID/YOUR_SFW_TOKEN
NSFW_WEBHOOK_URL=https://discord.com/api/webhooks/YOUR_NSFW_ID/YOUR_NSFW_TOKEN
DEFAULT_TAGS=waifu,maid
POST_SFW=true
POST_NSFW=false# Post SFW image (uses env config)
npm start
# Post NSFW image
npm start -- --nsfw
# Post both SFW and NSFW
npm start -- --sfw --nsfw
# Post with specific tags
npm start -- --tags "waifu,maid"
# Use specific source
npm start -- --source nekos.best
npm start -- --source waifu.pics
npm start -- --source pic.re
npm start -- --source nekosapi
npm start -- --source danbooru
npm start -- --source rule34
# Use danbooru with tags
npm start -- --source danbooru --tags "1girl,smile"
# Use rule34 with tags (NSFW only)
npm start -- --source rule34 --nsfw --tags "1girl,solo"
# Use tbib with tags
npm start -- --source tbib --tags "1girl,solo"
npm start -- --source tbib --nsfw --tags "1girl,solo rating:explicit"
# Random source selection
npm start -- --source random
# Dry run (fetch but don't post)
npm start -- --dry-run
# Show help
npm start -- --helpRun the scheduler for automatic posting:
# Uses CRON_SCHEDULE from .env (default: every 6 hours)
npm run schedule| Variable | Description | Default |
|---|---|---|
SFW_WEBHOOK_URL |
Discord webhook URL for SFW channel | (required) |
NSFW_WEBHOOK_URL |
Discord webhook URL for NSFW channel | (required) |
IMAGE_SOURCE |
Image source: waifu.im, nekosapi, waifu.pics, pic.re, nekos.best, danbooru, rule34, tbib, both, random | random |
DANBOORU_USERNAME |
Danbooru username (optional, required for danbooru source) | (empty) |
DANBOORU_API_KEY |
Danbooru API key (optional, required for danbooru source) | (empty) |
RULE34_USER_ID |
Rule 34 user ID (optional, required for rule34 source) | (empty) |
RULE34_API_KEY |
Rule 34 API key (optional, required for rule34 source) | (empty) |
R34_DISABLE_AI_POST |
Disable AI-generated images from Rule 34 | true |
TBIB_DISABLE_AI_POST |
Disable AI-generated images from TBIB | true |
DEFAULT_TAGS |
Comma-separated tags to filter by | (empty) |
CRON_SCHEDULE |
Cron expression for scheduling | 0 */6 * * * |
POST_SFW |
Enable SFW posting | true |
POST_NSFW |
Enable NSFW posting | false |
FETCH_LIMIT |
Number of images per request (1-30) | 1 |
0 */6 * * *- Every 6 hours0 0 * * *- Daily at midnight0 */12 * * *- Every 12 hours0 0,12 * * *- At midnight and noon
This project includes GitHub Actions workflows for automated posting:
- Fork/clone this repository to GitHub
- Go to Settings > Secrets and variables > Actions
- Add your webhook URLs as Repository secrets:
SFW_WEBHOOK_URLNSFW_WEBHOOK_URLDANBOORU_USERNAME(optional, for danbooru source)DANBOORU_API_KEY(optional, for danbooru source)PAT- Personal Access Token for keep-alive (see below)
- Add configuration as Repository variables:
POST_SFW:trueorfalsePOST_NSFW:trueorfalseDEFAULT_TAGS: e.g.,waifu,maidIMAGE_SOURCE: e.g.,random,waifu.im,nekos.best
GitHub disables scheduled workflows after 60 days of repository inactivity. To prevent this:
- Create a Personal Access Token (PAT):
- Go to GitHub Settings β Developer settings β Personal access tokens β Tokens (classic)
- Generate new token with
reposcope
- Add the PAT as a repository secret named
PAT - The workflow will automatically update a
.last-runfile on each run, keeping the repository "active"
Note: Without the PAT, scheduled workflows may be disabled by GitHub after 60 days of inactivity.
-
Scheduled Post (
.github/workflows/scheduled-post.yml)- Runs automatically every 6 hours
- Can be triggered manually from Actions tab
-
Manual Dispatch (
.github/workflows/manual-dispatch.yml)- Trigger from Actions tab with custom options
- Choose SFW/NSFW, tags, image source, and dry-run mode
The bot supports multiple anime image APIs. Choose your source via the IMAGE_SOURCE environment variable or --source CLI option.
| Source | API | Features | NSFW | Content Types |
|---|---|---|---|---|
waifu.im |
waifu.im | 100K+ images, artist credits, dominant color | β Yes | Static images |
nekosapi |
nekosapi.com | Character & artist data, ratings | β Yes | Static images |
waifu.pics |
waifu.pics | Action categories (hug, kiss, etc.) | β Yes | Static images |
pic.re |
pic.re | 66K+ images, AI-filtered SFW only | β No | Static images |
nekos.best |
nekos.best | GIF reactions, image categories | β No | Images & GIFs |
danbooru |
danbooru.donmai.us | 6M+ images, extensive tagging | β Yes | Static images |
rule34 |
rule34.xxx | 5M+ images, tag-based search | β Yes | Static images |
tbib |
tbib.org | 20M+ images, no auth required | β Yes | Static images |
both / random |
- | Randomly selects from all sources | β Yes* | Mixed |
*Pic.re, nekos.best are always SFW. Rule34 is always NSFW (no SFW content). TBIB supports both SFW and NSFW.
# Use specific source
npm start -- --source pic.re
npm start -- --source nekos.best
npm start -- --source danbooru
npm start -- --source tbib
# Use random source selection
npm start -- --source random
# From .env
IMAGE_SOURCE=nekos.bestTo use Danbooru as an image source, you need to obtain API credentials:
- Create an account at danbooru.donmai.us
- Go to your Profile and click Generate API key
- Add your credentials to
.env:DANBOORU_USERNAME=your_username DANBOORU_API_KEY=your_api_key
Note: Danbooru requires a valid User-Agent header. The bot automatically sets this to BotName/Version (+Contact URL) format to comply with their API requirements.
To use Rule 34 as an image source, you need to obtain API credentials:
- Create an account at rule34.xxx
- Go to My Account > Options (direct link)
- Copy your User ID and API Key
- Add your credentials to
.env:RULE34_USER_ID=your_user_id RULE34_API_KEY=your_api_key
Note: Rule 34 is an NSFW-only source. When using this source:
- SFW requests will return null and fall back to other sources
- Always use with
--nsfwflag or setPOST_NSFW=truein.env
AI Content Filtering: By default, AI-generated images are filtered out from Rule 34 results. To allow AI-generated images, set:
R34_DISABLE_AI_POST=falseTo use TBIB (The Big ImageBoard) as an image source:
-
No authentication required! Just set your image source:
IMAGE_SOURCE=tbib
-
TBIB supports both SFW and NSFW content with ratings:
rating:safe- SFW content onlyrating:questionable- Borderline/mild NSFWrating:explicit- NSFW content
Example usage:
# Get SFW images
npm start -- --source tbib --tags "1girl rating:safe"
# Get NSFW images
npm start -- --source tbib --nsfw --tags "1girl rating:explicit"AI Content Filtering: By default, AI-generated images are filtered out from TBIB results. To allow AI-generated images, set:
TBIB_DISABLE_AI_POST=falseNote: TBIB has a Danbooru-like API and supports the same tag system. Use spaces to separate multiple tags.
Tags vary by source. Here are the available tags for each:
Popular tags include:
waifu- Classic waifu charactersmaid- Maid outfitsmarin-kitagawa- Marin from My Dress-Up Darlingraiden-shogun- Raiden from Genshin Impactoppai- Large-breasted charactersselfies- Selfie-style imagesuniform- Uniform outfitsmori-calliope- Calliope from Hololivehentai,ecchi,ero- NSFW tags
See all available tags: curl https://api.waifu.im/tags
- Character tags:
girl,boy - Hair tags:
blonde_hair,blue_hair,brown_hair,green_hair,pink_hair,purple_hair,red_hair,white_hair,long_hair,short_hair,animal_ears - Eye tags:
blue_eyes,brown_eyes,green_eyes,purple_eyes,red_eyes,yellow_eyes - NSFW uses
rating=explicitparameter
- SFW:
waifu,neko,shinobu,megumin,bully,cuddle,cry,hug,awoo,kiss,lick,pat,smug,bonk,yeet,blush,smile,wave,highfive,handhold,nom,bite,glomp,slap,kill,kick,happy,wink,poke,dance,cringe - NSFW:
waifu,neko,trap,blowjob
- Hair:
long_hair,short_hair,blonde_hair,blue_hair,brown_hair,green_hair,pink_hair,purple_hair,red_hair,white_hair,black_hair - Eyes:
blue_eyes,brown_eyes,green_eyes,purple_eyes,red_eyes,yellow_eyes - Other:
girl,boy,original,blush,smile,open_mouth,ahoge,animal_ears,bangs,breasts,uniform,school_uniform
- Image categories:
neko,waifu,husbando,kitsune - GIF reactions:
hug,kiss,cuddle,pat,poke,tickle,slap,bonk,wave,wink,smile,blush,cry,happy,sleep,dance,kick,punch,shoot,stare,think,confused,angry,baka,bite,blowkiss,clap,facepalm,feed,handhold,handshake,highfive,laugh,lurk,nod,nom,nope,peck,pout,run,salute,shrug,sip,smug,spin,tableflip,teehee,thumbsup,wag,yawn,yeet,shocked,bleh,bored,nya,lappillow,carry,kabedon,shake
Danbooru has an extensive tag system with millions of tags. Common tags include:
- Character counts:
1girl,1boy,solo,multiple_girls,multiple_boys - Hair:
long_hair,short_hair,blonde_hair,blue_hair,brown_hair,pink_hair,white_hair,black_hair - Eyes:
blue_eyes,red_eyes,green_eyes,purple_eyes,brown_eyes - Features:
blush,smile,open_mouth,looking_at_viewer,bangs - Content:
breasts,thighhighs,swimsuit,school_uniform,maid
Note: Combine tags with spaces: --tags "1girl solo long_hair"
Rule 34 uses a similar tagging system to Danbooru. Common tags include:
- Character counts:
1girl,1boy,solo,duo,group - Hair:
long_hair,short_hair,blonde_hair,blue_hair,brown_hair,black_hair,pink_hair,white_hair - Eyes:
blue_eyes,red_eyes,green_eyes,brown_eyes,purple_eyes - Features:
blush,smile,open_mouth,looking_at_viewer,bangs,large_breasts,small_breasts - Content:
nude,swimsuit,lingerie,uniform,stockings,thighhighs - Ratings:
rating:explicit,rating:questionable(Note: No SFW content on Rule 34)
Note: Rule 34 supports the full tag system. Combine tags with spaces: --tags "1girl solo blue_hair"
TBIB uses a similar tagging system to Danbooru and Rule 34. Common tags include:
- Character counts:
1girl,1boy,solo,duo,group,multiple_girls - Hair:
long_hair,short_hair,blonde_hair,blue_hair,brown_hair,black_hair,pink_hair,white_hair - Eyes:
blue_eyes,red_eyes,green_eyes,brown_eyes,purple_eyes - Features:
blush,smile,open_mouth,looking_at_viewer,bangs,large_breasts,small_breasts - Content:
nude,swimsuit,lingerie,uniform,stockings,thighhighs - Ratings:
rating:safe,rating:questionable,rating:explicit
Note: TBIB supports the full tag system with rating filters. Combine tags with spaces: --tags "1girl solo rating:safe"
# Run in development mode
npm run dev
# Build TypeScript
npm run build
# Lint code
npm run lintRandom-Waifu-Image/
βββ .github/
β βββ workflows/
β βββ scheduled-post.yml # Automated posting workflow
β βββ manual-dispatch.yml # Manual trigger workflow
βββ src/
β βββ clients/
β β βββ waifu-client.ts # waifu.im API integration
β β βββ nekos-client.ts # nekosapi.com API integration
β β βββ waifu-pics-client.ts # waifu.pics API integration
β β βββ picre-client.ts # pic.re API integration
β β βββ nekos-best-client.ts # nekos.best API integration
β β βββ danbooru-client.ts # danbooru API integration
β β βββ rule34-client.ts # rule34 API integration
β β βββ tbib-client.ts # tbib API integration
β β βββ discord-webhook.ts # Discord webhook sender
β βββ types/
β β βββ waifu.ts # waifu.im types
β β βββ nekos.ts # nekosapi.com types
β β βββ waifupics.ts # waifu.pics types
β β βββ picre.ts # pic.re types
β β βββ nekosbest.ts # nekos.best types
β β βββ danbooru.ts # danbooru types
β β βββ rule34.ts # rule34 types
β β βββ tbib.ts # tbib types
β β βββ source.ts # Unified source interface
β βββ utils/
β β βββ config.ts # Environment config & tags
β β βββ color-extractor.ts # Image dominant color extraction
β βββ main.ts # CLI entry point
β βββ scheduler.ts # Cron scheduler
βββ .env.example
βββ .gitignore
βββ package.json
βββ tsconfig.json
βββ README.md
- Open Discord and go to your server
- Navigate to the channel where you want to post images
- Click Settings (gear icon) next to the channel name
- Go to Integrations > Webhooks
- Click New Webhook
- Give it a name (e.g., "Waifu Bot")
- Copy the webhook URL
- Paste it in your
.envfile
Repeat for NSFW channel if desired.
MIT License - see LICENSE file for details.
- Added: TBIB (The Big ImageBoard) support with 20M+ images, no auth required
- Added: Rule 34 support with 5M+ images and tag-based search
- Added: Image accent color extraction for Discord embeds (like waifu.im)
- Added: Danbooru support with 6M+ images and extensive tagging
- Added: nekos.best support with 60+ GIF reaction categories
- Added: Source-specific webhook profiles (usernames and avatars)
- Fixed: NekosAPI tag filtering now works correctly
- Fixed: Resolution display in Discord embeds
- Improved: Fallback mechanism when sources fail