Coder Social home page Coder Social logo

zoekbot's Introduction

zoekbot

A discord googler bot that will help you google stuff and retrieve search history

Project Structure

Majorly has three parts:

  1. 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
  2. config : Env specific configurations, common vars in common.py, currently only for Logging LEVEL decision, can extend it in future as needed
  3. logging : file logging

Getting started

  • 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

Shell

  • run.sh : Executes user command and run parking system algorithm
    • Configure DISCORD_BOT_ENV according to required environment. Default is production
    • To trace more detailed logs configure DISCORD_BOT_ENV to development or pre-production
  • Give permissions : sudo chmod +x run.sh
  • Run on terminal ./run.sh

Python

  • 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

TechStack Used

  • 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

Bot Name and Invitation URL

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

Bot commands

  • !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

zoekbot's People

Contributors

swatimodi avatar

Stargazers

Roman avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.