jorgef17 / DiscordBot

Discord bot in Python that can play music in a voice channel using YouTube links. It also has some simple commands for mathematical operations, sending messages and getting information about the server.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Description

The code is a Discord bot written in Python using the discord.py and yt_dlp libraries. It responds to various commands, such as playing music from YouTube, performing arithmetic operations, and displaying server information.

The bot uses the command prefix "!" and includes the following commands:

  • !ping: Sends a message back to the user with the latency of the bot.
  • !sum : Adds two numbers and sends the result back to the user.
  • !div : Divides the first number by the second number and sends the result back to the user.
  • !prod : Multiplies two numbers and sends the result back to the user.
  • !hello: Sends a greeting to the user.
  • !info: Displays information about the server, such as the server name, creation date, owner, and ID.
  • !p : Searches YouTube for the specified video and adds it to the queue.
  • !join: Joins the voice channel the user is currently in.
  • !exit: Disconnects from the voice channel.
  • !loop: Toggles loop mode on or off.
  • !play: Plays the current song in the queue.
  • !next jumps to the next song in the playback queue.
  • !coinflip is used in some games to make random decisions and will randomly choose between "heads" or "tails" and give you the result.
  • !pause, the music will pause temporarily and remain on hold until the "!resume" command is used to resume playback.

The bot uses the yt_dlp library to download audio from YouTube, and the FFmpeg library to play the audio. The class is used to download and play the audio, and the list is used to store the songs in the queue. The variable is used to keep track of whether loop mode is enabled. The bot also uses the OpenAI API to generate responses to messages sent by users via !chat.

Requirements

For the correct installation of FFmpeg on Windows we suggest using the following tutorial Youtube.

for the installation of the dependencies it is suggested to use pip install -r requirements

About

Discord bot in Python that can play music in a voice channel using YouTube links. It also has some simple commands for mathematical operations, sending messages and getting information about the server.

License:MIT License


Languages

Language:Python 100.0%