Skip to content

tee-community/cat-react-cpp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cat React Bot

A simple Discord bot that reacts with a configured emoji to messages containing images, videos, or stickers in a specific channel.


Features

  • Automatic Reaction: Automatically adds a specified emoji reaction to messages that contain attachments (images, videos) or embeds with images/thumbnails, or stickers.
  • Configurable Emoji: Supports default Unicode emojis, custom server emojis, and animated custom server emojis.
  • Dedicated Channel: Only reacts to messages in a pre-configured channel.
  • Easy Setup: Configuration is handled via a config.json file, which is automatically generated if it doesn't exist.

Setup and Installation

Prerequisites

  • C++ Compiler: A C++20 compatible compiler (e.g., GCC, Clang, MSVC).
  • CMake: Version 3.22 or higher.
  • D++ Library: The Discord++ library.

Building the Bot

  1. Clone the Repository:

    git clone <repository_url>
    cd cat-react
  2. Create Build Directory and Build:

    mkdir build
    cd build
    cmake ..
    cmake --build .

    This will compile the bot executable. The executable will be named cat-react (or cat-react.exe on Windows).


Configuration

The bot uses a config.json file for its settings. If this file doesn't exist when you run the bot, a template config.json will be created for you.

config.json Example

{
    "channel_id": 0,
    "emoji_id": 0,
    "emoji_type": "default",
    "emoji_unicode": "🐱",
    "token": "NONE"
}

Configuration Options

  • token (string, required): Your Discord bot token. You can get this from the Discord Developer Portal.
  • channel_id (integer, required): The ID of the channel where the bot should react to messages. To get a channel ID, enable Developer Mode in Discord settings, then right-click on the channel and select "Copy ID".
  • emoji_type (string, required): Specifies the type of emoji to use for reactions.
    • "default": Use a standard Unicode emoji.
    • "custom": Use a custom emoji from your server (non-animated).
    • "custom_animated": Use a custom animated emoji from your server.
  • emoji_unicode (string, required for default emoji_type): The Unicode representation of the emoji to use (e.g., "🐱", "👍"). You can find these on websites like Emojipedia.
  • emoji_id (integer, required for custom or custom_animated emoji_type): The ID of your custom emoji. To get a custom emoji's ID, type \:emoji_name: in Discord chat, then add a backslash before it (\:emoji_name: ). This will display the emoji in the format <:emoji_name:emoji_id>or<a:emoji_name:emoji_id> . Copy the emoji_id.

Running the Bot

After building the bot and configuring config.json, simply run the executable from your build directory:

./cat-react # On Linux/macOS
.\cat-react.exe # On Windows

The bot will log its status to the console.


Important Notes

  • Bot Permissions: Ensure your bot has the necessary permissions in your Discord server, specifically:
    • Read Message History
    • Add Reactions
  • Message Content Intent: This bot uses dpp::i_message_content intent, which is a privileged intent. Make sure it's enabled in your bot's settings on the Discord Developer Portal if you are running into issues.
  • Error Handling: The bot provides basic error handling for configuration file issues. If config.json is missing, it will create a template.
  • Custom Emoji Availability: For custom emojis, the bot must be in a server where the custom emoji is available. If using an animated custom emoji, ensure you set emoji_type to "custom_animated".

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages