Skip to content

A simple discord bot written in Python (discord.py rewrite)

License

Notifications You must be signed in to change notification settings

foreverallama/kadlebot

Repository files navigation

kadlebot_new

A discord bot written in Python (discord.py rewrite). Can stream music, videos, contains text filters, can play Kadlecord (like Pokecord) and some other fun commands to pass the time.

This was actually modelled after my friend, whom we call Kadle. The bot steadily grew over time based on requested features, and then integrated a whole of bunch of stuff including some games like Pokecord (called Kadlecord in this version) as well as some board games like Secret Hitler.

However, I'm afraid the bot's "behaviour" is unacceptable in today's day and age (we were typical college students when the bot was first created), hence a lot of the content has been sanitized to stay neutral.

Requirements

  • Python 3 (written in Python 3.6 within a Conda environment)
  • discord 1.3.3: pip install discord.py
  • discord[voice] 1.3.0: pip install discord.py[voice] (More info here)
  • youtube-dl 2020.3.24: pip install youtube-dl
  • spotdl 1.2.6: pip install spotdl
  • spotipy 2.11.1: pip install spotipy
  • numpy 1.18.2: pip install numpy
  • pymongo 3.9.0: `pip install pymongo
  • dnspython 1.16.0: `pip install pymongo[srv]
  • libopus.so opus 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, Procfile and libopus.so are 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

Some Information

  • 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 kadlemon and kadlepics have been removed to respect privacy. Image files were named as IMG1, IMG2 and so on while video files were named VID1, VID2 and 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.py uses 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

mainbot.py

  • Creates the bot with prefix kadle.
  • Loads files messagebot.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

messagebot.py

Cog: MessageBot

Commands

  • 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.howcompatible Replies with the compatibility between two mentioned users

  • 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

musicbot.py

Cog: Music

Commands

  • 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

message_filter.py

Cog: Message

Runs a chat filter for certain swear words and the word wonderla

spawnbot.py

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

Commands

  • 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

help.py

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.

About

A simple discord bot written in Python (discord.py rewrite)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages