A simple discord bot written in Python (discord.py rewrite)
- Python 3 (written in Python 3.6 within a Conda environment)
discord1.3.3:pip install discord.pydiscord[voice]1.3.0:pip install discord.py[voice](More info here)youtube-dl2020.3.24:pip install youtube-dlspotdl1.2.6:pip install spotdlspotipy2.11.1:pip install spotipynumpy1.18.2:pip install numpypymongo3.9.0: `pip install pymongodnspython1.16.0: `pip install pymongo[srv]libopus.soopus library if you're using linux (included by default for windows)(optional, voice only)- FFmpeg is required to stream audio. It can be downloaded from here
- The files
runtime.txt,requirements.txt,Procfileandlibopus.soare required to deploy it on Heroku. Check the Heroku Docs to find out how to deploy this on Heroku - The updates folder contains Cogs which will be added sometime in the future
- To host the bot on Heroku, you need the ffmpeg buildpack. Click here and follow the instructions to add the buildpack
- Files in the folder
kadlemonandkadlepicshave been removed to respect privacy. Image files were named asIMG1,IMG2and so on while video files were namedVID1,VID2and so on. Video files uploaded to discord need to be below 8MB. - Your bot requires a Token to run, which can be obtained at discordapp.com/developers/applications/me
- Changes to the file system on Heroku are temporary and last only till the dyno is shut down or restarted. Hence,
spawnbot.pyuses MongoDB to store data. If you don't know how to do this, here's a good tutorial to get you started. - If you're wondering what a Kadle is, it's my friend's nickname. This bot was basically built to mock him
- Creates the bot with prefix kadle.
- Loads files
gaybot.py,musicbot.py,message_filter.py,help.py,spawnbot.py - The default help command has been removed and a new one was created and added to a cog Help
Cog: GayStuff
-
kadle.message
Sends a random message from given list into the same channel as requested by the user -
kadle.image
Sends a random image from the given list into the same channel as requested by the user -
kadle.video
Sends a random video from the given list into the same channel as requested by the user -
kadle.howgay
Replies back to the user saying how gay they are (Replies with 100% gay only for kadle) -
kadle.say
Repeats back the text entered by the user -
kadle.whisper
DM's the user with a random secret defined in the list -
kadle.date
Returns the percentage compatibility with the mentioned user -
kadle.dateme
Returns the percentage compatibility with Kadle himself
Cog: Music
-
kadle.join
Joins the voice channel the user is in -
kadle.play
Plays the song searched for (searches either through Spotify or YouTube, default is YouTube). If no song is mentioned, it plays one randomly from a pre-defined list of URLs -
kadle.volume
Adjusts the volume of the music being played (An integer between 0 to 100) -
kadle.pause
Pauses audio -
kadle.resume
Resumes audio -
kadle.stop
Stops playing any audio -
kadle.add
Adds the searched song to the queue -
kadle.leave
Leaves the voice channel -
kadle.queue
Displays the queue -
kadle.next
Plays the next song in queue -
kadle.setsearch
Sets the search option as either Spotify or YouTube
Cog: Message
Runs a chat filter for certain swear words and the word wonderla
Cog: Spawn
This Cog is a basic implementation trying to mimic Pokecord. Check out Pokecord here.
Everytime a message is sent on a server a random number between 1 to 1000 is generated. If the number is greater than 920, it spawns a Kadle. Different images spawn with different probabilities as defined by the list weights under the function spawn_image
-
kadle.spawn
Sets the text channel for Kadle to spawn in (basically to avoid spam in one channel) -
kadle.list
Displays all the Kadles caught till now -
kadle.select
Selects a Kadle as your active companion for battles, levelling up, etc (to be introduced in future updates) -
kadle.moves
Lists all the moves of your selected Kadle
Note: kadle.catch kadle is used to catch a Kadle. However, this is not included as a command
Cog: Help
This is the replacement for the default help command. It sends an elegantly formatted embed, which for some reason is lacking in the default help command.