Skip to content

A telegram bot to download wallpapers from Wallhaven based on NodeJS

License

Notifications You must be signed in to change notification settings

Yash-Garg/node-wallhaven-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

51 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

What is this bot about?

A telegram bot to download wallpapers from Wallhaven based on NodeJS by Me and Barun.

wallhaven image

Limitations

This bot should not be spammed with commands as Wallhaven API allows only 45 requests per minute, if you hit this limit you will receive a 429 - Too many requests error.

Bot Commands

  • /random : Provides a random image from the wallhaven database
  • /search <keyword> : Provides a random image related to the keyword
  • /nsfw : Provides a random NSFW (not safe for work) image
  • /getwall <id> : Provides the specific wall requested by matching the id provided by user
  • /top <1d/3d/1w/1M/3M/6M/1y> : Provides 5 images from the toplist based on the topRange specified by user
  • /ping : Checks the response time of bot by requesting to telegram api

NOTE : Image previews are not shown in toplist command to prevent API spam

How to deploy?

Installing requirements

  • Clone this repo :
git clone https://github.com/Yash-Garg/node-wallhaven-bot
cd node-wallhaven-bot

Make sure NodeJS and npm is installed

  • Install required npm packages :
npm install

Setting up config file

  • Copy example config as config.js : cp example_config.js config.js

Fill up all the fields. Meaning of each fields are discussed below:

  • TOKEN : The telegram bot token that you get from @BotFather
  • API_WALLHAVEN : Your wallhaven API which you can get by making up an account on Wallhaven. API can be found under the Settings > Account tab
  • AUTH_USERS : Telegram ID of users whom u want to allow access to use this bot
  • AUTH_CHATS : Telegram ID of the chat where u want to allow access of bot by anyone in that particular chat

NOTE : AUTH_CHATS is optional, u can leave it blank or as it is.

Deploying

  • Start the bot by using this command : npm start