A discord googler bot that will help you google stuff and retrieve search history
Majorly has three parts:
- discord_bot : Bot's core and search and database utility modules
- bot.py : Discord bot connection and command handling
- database.py : Utility module for DB connection and required CRUD operations
- google_search.py : Utility module for getting top n google search results
- config : Env specific configurations, common vars in
common.py
, currently only for Logging LEVEL decision, can extend it in future as needed - logging : file logging
- Clone the project and
cd devbot/
- Requirements :
Python3.8+
- Install other requirements :
pip install -r requirements.txt
Currently it is hosted on heroku so you can directly jump to Bot Name and Invitation URL
run.sh
: Executes user command and run parking system algorithm- Configure
DISCORD_BOT_ENV
according to required environment. Default isproduction
- To trace more detailed logs configure
DISCORD_BOT_ENV
todevelopment
orpre-production
- Configure
- Give permissions :
sudo chmod +x run.sh
- Run on terminal
./run.sh
- export environment from terminal :
export DISCORD_BOT_ENV=production
- Default environment :
development
- export other sercrets from terminal (
DISCORD_TOKEN
,GOOGLE_SEARCH_API_KEY
,SEARCH_ENGINE_ID
,DB_USERNAME
,DB_PASSWORD
,DB_NAME
,COLLECTION_NAME
) - Run from filepath :
python -m discord_bot.bot
- Used MongoDB for storing user search history
- DB schema -
{
'_id': autogenerated
'user_id' (string): user_id : user's discord name
'query' (string): search_query
'created_time' (Date) : first time user searched the query
'modified_time' (Date): this is updated when the user searches for the same query again
}
- Used Atlas Mongo for Hosted MongoDB instance
- Used Custom Search JSON API for search results
Name - devbot
Invite-URL - https://discord.com/api/oauth2/authorize?client_id=793449242609319966&permissions=0&scope=bot
Paste the Invite URL in the browser and if you are already logged in, you'll get an option to choose to add the bot to any of your discord servers
- !help - helps you understand the usage of the bot commands implemented
- !google - will return top 5 result links for your query
- !recent - returns results from your search history related to the query