Skip to content

sankeer28/DiscordBot-v2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

130 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Discord bot made using Python with many features including AI chat, music playback, video downloader, OSINT tools, and more.

Getting Started

Prerequisites

  • Python 3.12+ 🐍** 3.10 if you want the OSINT tool Maigret
  • FFMPEG: installed onto system PATH
    • Linux (apt): sudo apt install ffmpeg
    • MacOS (via homebrew): brew install ffmpeg
    • Windows: guide:
  • pip

Features

Chat Interaction πŸ’¬:

  • Casual chat with the bot using its name. Not required to call its name if using the bot's DMs.
  • Immediate responses using Gemini AI πŸ€–.
  • Conversation is temporarily saved to memory for realism .
  • 50/50 chance to get a GIF from Giphy based on the context of what is being said in chat using Natural Language Processing (NLP) 🧠.
    • SpaCy NLP identifies the most relevant parts of a message by focusing on random nouns, proper nouns, adjectives, and verbs, excluding personal pronouns which might not contribute much to the context.

Media Retrieval πŸ“Ί:

Image Related πŸ–ΌοΈ:

  • Finds the source of images through reverse image search supporting various formats using SauceNao.
  • Asks questions regarding uploaded images using Gemini AI.

OSINT Tools πŸ”“:

  • Integrates with Sherlock πŸ”
  • Integrates with modified WhatsMyName. Returns either links to chat or creates html file with --html argument.
  • Integrates with socialscan.
  • Integrates with Maigret - Not compatible with modern Python versions, must enable manually
  • Logs info of members in servers, including the user's Discord IDs, server nickname, Discord username, and status/bio, into a folder called Servers as .json files.

Voice Chat πŸŽ™οΈ:

  • Automatically join the first voice chat that is filled in a server after anyone joins.
  • Automatically leaves voice chat after everyone leaves.
Utilizes text-to-speech in voice chat, allowing the bot to vocalize text input
example_v.mp4
  • Plays audio from the various sources in voice chat using the play command.
    • Ability to infinitely loop any audio source played in voice channel πŸ”.
  • For songs in a YouTube playlist, the URL of the specific song is automatically detected.
    • Example:
      • Original Playlist URL:
      https://www.youtube.com/watch?v=pDddlvCfTiw&list=RDqRaqfpKPjIc&index=5
      
      • Extracted Video URL: everything after '&list' is removed
      https://www.youtube.com/watch?v=pDddlvCfTiw
      

This process ensures that only the specific video is played, even if the provided URL is part of a playlist.

Leveling System πŸ“ˆ:

  • Users gain XP by sending messages.
  • Users receive a notification in the current chat when they level up.
  • Commands available:
    • level: Check your current level and experience points.
    • leaderboard: View the top 10 users by level.
  • All user levels and experience points are saved locally to a .json file to ensure persistence even after bot restarts.

Video Manipulation πŸ“Ή:

Running locally

Getting API Keys

  • Google Custom Search Engine API Key: Obtain from the Google Cloud Console. Guide
  • Google API Keys: Necessary for YouTube and Google Search. Obtain from the Google Cloud Console. Guide
  • Saucenao API Key: Get from the SauceNAO website. Guide
  • Pexels API Key: Get from the Pexels website. Guide
  • Google Gemini AI API KEY: Get from Google AI Studio. Here
  • Giphy API KEY: Get from Giphy website

Running the Bot

  1. Clone this repository:
git clone https://github.com/sankeer28/DiscordBot-v2.git
  1. Navigate to the bot directory:
cd DiscordBot-v2

Installing Dependencies

pip install -r requirements.txt

Install NLP model

python -m spacy download en_core_web_sm
  1. Fill in the API Keys on missing lines.

    • Required APIs: Gemini API key, Google API keys, Google search engine ID, Saucenao API, Pexels API, Gify API
    • Last Line: Discord bot token
  2. Rename the bot:

    • change the bot's name from drake to your liking
  3. Run the bot:

python bot.py

Usage: type !help for all commands. There is NO prefix for all commands.

Command Description
drake <prompt> Generate content using the Generative AI model. Name of bot is customizable.
image <query> Search for images using Google Custom Search.
google <query> Perform a Google search.
youtube <query> Search for videos on YouTube.
sauce <image_url> Perform a reverse image search using SauceNAO.
pexels <query> Search for images on Pexels.
play <URL or query>, pause, resume, stop, leave Music commands. Supports URLs from these websites
download <URL> Downloads and returns video to chat. Supports URLs from these websites
cat Random cat gif.
dog Random dog gif.
sherlock <username> Returns all sites where the user has created an account. Uses Sherlock-project
expose <username> --html Returns all sites where the user has created an account. Uses modified WhatsMyName
socialscan <username or email> Accurately querying username and email usage on online platforms. Uses socialscan
/join Joins any specified voice channel, even without joining it yourself
/speak Says anything in voice channel you want using Microsoft's text to speech. Uses edge-tts
/nightcore Creates nightcore video or slowed down video given URL. Uses my personal project

To use the command maigret

  • You are required to use Python 3.10 and must manually install maigret by pip install maigret
  • Has not been added to !help as it is limited to a specific version of python
  • This feature uses maigret takes in a username and returns a pdf report

Releases

No releases published

Packages

 
 
 

Contributors

Languages