Skip to content

CoBr8/discord_bot

Repository files navigation

Discord_bot

Auth: Colton Broughton

Description

DiscordBot is a Discord bot designed to demonstrate custom logging, message handling, and fun interactive behavior inside a Discord server.

The bot can:

  • Log activity to both console and file.
  • Respond to simple commands (e.g., !hello).
  • Randomly send messages from a predefined list.
  • Monitor for banned words and react accordingly.
  • Include an Easter egg triggered by repeated mentions of a word.

This project is a starting point for experimenting with Discord bots using Python and discord.py. It can be extended with additional commands and features.

This bot is also equipped with a progress saved game. A user can use the !guess command followed (in the same message) by a sentence, paragraph, or grouping of words. If any of those words are in the "theme" sets, the bot will respond (currently set up as the "botting" channel) with a success message and what words were correct. The bot stores the user's guessed words in a json file, as well as the guild's total guessed words. Python's regex module is used to seperate the words in the message.


Installation

Requirements

Steps

  1. Clone the repository:

    git clone https://github.com/CoBr8/discord_bot.git
    cd discord_bot
  2. Install dependencies:

    uv sync
  3. Create a config.py file in the project root. This file is not included in the repository and must be created by you.

    At minimum, it must contain values for:

    • Your bot token: int
    • Channel IDs: dict("channel-name":channel-id)
    • Banned words: list(str,...)
    • Sad messages: list(str,...)
    • EASTER_EGG_WORD: str
  4. Run the bot:

    python DiscordBot.py

Usage

  • Check if the bot is online Type:

    !hello
    

    The bot will respond with:

    Hello World!
    
  • Random messages Occasionally, the bot will send one of the SAD_MSGS into your configured channel.

  • Banned words If a user types a word from BAN_WORDS, the bot will respond with:

    You're going to jail <username>
    
  • Easter Egg Mentioning the easter egg word three times in a row will trigger:

    I'm the ghost with the most, babe.
    

Support

If you encounter issues:


Roadmap

Planned improvements:

  • Add more configurable triggers and responses.
  • Implement persistent storage (e.g., database).
  • Expand logging to structured formats (e.g., JSON).

Contributing

Contributions are welcome!

  1. Fork the repo.
  2. Create a new branch for your feature/bugfix.
  3. Submit a pull request.

Before contributing, please ensure your changes:

  • Run without errors.
  • Follow Python best practices (PEP8).
  • Include documentation for new features.

Authors and Acknowledgment

  • Author: Colton Broughton
  • Thanks to the maintainers of discord.py.

License

This project is licensed under the MIT License. See the LICENSE file for details.


Project Status

"Active" — under development and open to contributions.


Example config.py

# config.py
# Example configuration file for DiscordBot.
# You must provide your own values here.

# Discord bot token (from the Discord Developer Portal)
TOKEN = "your-bot-token-here"

# Channels the bot should use (replace with real channel IDs from your server)
channels = {
    "Botting": 123456789012345678  # Example channel ID
}

# List of banned words (the bot will respond if these are used)
BAN_WORDS = [
    "badword1",
    "badword2",
    "anotherword"
]

# List of random sad messages the bot may send occasionally
SAD_MSGS = [
    "I'm feeling a bit down today.",
    "Not every day is great, but I'm still here.",
    "Sometimes, silence is the loudest response.",
    "Do robots dream of electric sheep?"
]

channels = {"Name 1":1234567..., "IRL":1234567..., "Interesting":1234567..., ...}

user_ids = [1234...,5678...,...]

EASTER_EGG_WORD = "single-word"

About

Basic discord bot class and logging

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages