real_fubles

Make a bot for discord where i can send messages using that bot to my discord server.

Kodari AI
KodariMay 15 at 11:46 am 695 (v2)

I’ll create a Minecraft plugin that integrates with Discord, allowing you to send messages from Minecraft to Discord channels using JDA.

DiscordBridge
A Minecraft plugin that integrates with Discord using JDA, enabling server administrators to send messages from Minecraft to Discord channels. Features include configurable bot token and channel IDs, in-game commands to send messages, automatic event notifications, and support for embeds. Perfect for bridging communication between your Minecraft server and Discord community.

[Generation stopped]

real_fubles

not using minecraft if i type /send and then my message, the bot will send it.

Kodari AI
KodariMay 15 at 11:49 am 4,884 (v2)

I understand now - you want a standalone Discord bot application, not a Minecraft plugin! Let me read the current files and convert this to a proper Discord bot.

Now I’ll convert this to a standalone Discord bot application with a /send command:

Done! I’ve created a standalone Discord bot with these features:

Setup Instructions:

  1. Create a new application

  2. Go to β€œBot” section and create a bot

  3. Copy the bot token and paste it in config.yml

  4. Enable β€œMessage Content Intent” in the Bot settings

  5. Invite the bot to your server using OAuth2 URL Generator (select bot and applications.commands scopes)

  6. Right-click on your target channel β†’ Copy ID and paste it in config.yml

  7. Run the bot with ./gradlew run

Usage:

  • Type /send <your message> in Discord

  • The bot will send your message to the configured channel

  • You’ll get a confirmation that it was sent

The bot uses slash commands and requires the Message Content intent to function properly!

real_fubles

what is the bot token

Kodari AI
KodariMay 15 at 11:50 am 1,790 (v2)

The bot token is a secret key that authenticates your bot with Discord. You need to create it yourself through Discord’s Developer Portal. Here’s how:

How to Get Your Bot Token:

  1. Go to Discord Developer Portal:

  2. Create a New Application:

    • Click β€œNew Application” button

    • Give it a name (e.g., β€œMy Bot”)

    • Click β€œCreate”

  3. Create a Bot:

    • In the left sidebar, click β€œBot”

    • Click β€œAdd Bot” β†’ β€œYes, do it!”

  4. Get Your Token:

    • Under the bot’s username, click β€œReset Token” or β€œCopy”

    • Copy this token - this is your bot token!

    • ⚠️ Never share this token publicly - it’s like a password

  5. Enable Required Intents:

    • Scroll down to β€œPrivileged Gateway Intents”

    • Enable β€œMESSAGE CONTENT INTENT” (required for the bot to work)

    • Click β€œSave Changes”

  6. Paste Token in config.yml:

    YAML
    bot-token: "YOUR_TOKEN_HERE"  # paste the copied token
    
  7. Invite Bot to Your Server:

    • Go to β€œOAuth2” β†’ β€œURL Generator” in the left sidebar

    • Check bot and applications.commands under Scopes

    • Check Send Messages under Bot Permissions

    • Copy the generated URL and open it in your browser

    • Select your server and authorize

The token looks something like: MTA1234567890.GAbCdE.fGhIjKlMnOpQrStUvWxYz1234567890

real_fubles

where can i put it in config.yml

Kodari AI
KodariMay 15 at 11:52 am 2,445 (v2)

Open src/main/resources/config.yml and replace "YOUR_BOT_TOKEN_HERE" with your actual bot token:

YAML
# Discord bot token (REQUIRED - get from https://discord.com/developers/applications)
bot-token: "MTA1234567890.GAbCdE.fGhIjKlMnOpQrStUvWxYz1234567890"  # ← Paste your token here

# Channel ID where messages will be sent
channel-id: "YOUR_CHANNEL_ID_HERE"  # ← Also get this by right-clicking a channel β†’ Copy ID

Example:

YAML
bot-token: "<redacted>"
channel-id: "1234567890123456789"

To get the Channel ID:

  1. In Discord, enable Developer Mode: Settings β†’ Advanced β†’ Developer Mode (toggle ON)

  2. Right-click on the channel where you want the bot to send messages

  3. Click β€œCopy ID”

  4. Paste it in channel-id

real_fubles

why cant i use the command

Kodari AI
KodariMay 15 at 11:57 am 6,530 (v2)

Let me check the code to diagnose the issue:

There are a few common reasons why the /send command might not be working. Let me help you troubleshoot:

Most Common Issues:

1. Bot isn’t running

Have you started the bot? Run it with:

Shell
./gradlew run

Or on Windows:

Shell
gradlew.bat run

You should see:

Plain Text
Starting Discord Bot...
Bot is ready! Use /send <message> in Discord.
Successfully registered /send command!

2. Commands take time to sync (up to 1 hour)

Discord slash commands can take up to 1 hour to appear globally. To make it instant, let me update the code to register guild-specific commands:

Done! Now here’s how to fix the command not showing up:

βœ… Quick Fix (Instant Command Registration):

Add your Server/Guild ID to config.yml:

  1. In Discord, enable Developer Mode: Settings β†’ Advanced β†’ Developer Mode (toggle ON)

  2. Right-click on your server icon β†’ Copy ID

  3. Paste it in config.yml:

YAML
guild-id: "123456789012345678"  # Your server ID here
  1. Restart the bot - the command will appear instantly!


πŸ” Troubleshooting Checklist:

1. Is the bot running?

Run: ./gradlew run (or gradlew.bat run on Windows)

You should see:

Plain Text
Starting Discord Bot...
Bot is ready! Use /send <message> in Discord.
βœ“ Successfully registered /send command...

2. Did you invite the bot correctly?

Go back to Discord Developer Portal β†’ OAuth2 β†’ URL Generator:

  • Check: bot and applications.commands (both required!)

  • Bot Permissions: Send Messages

  • Open the URL and re-invite the bot

3. Did you fill in config.yml?

  • bot-token: Your actual bot token

  • channel-id: Right-click channel β†’ Copy ID

  • guild-id: Right-click server icon β†’ Copy ID (for instant commands)

4. Still not working?

  • Restart Discord (Ctrl+R or close/reopen)

  • Check the bot console for errors

  • Make sure β€œMESSAGE CONTENT INTENT” is enabled in the Discord Developer Portal

With the guild-id set, commands appear instantly instead of waiting up to 1 hour!

real_fubles

where can i start the bot

Kodari AI
KodariMay 15 at 11:58 am 3,497 (v2)

You need to start the bot from the command line/terminal in your project directory. Here’s how:

πŸ“ Location: Open terminal in your project root folder

The folder that contains build.gradle (where you can see src/, build.gradle, manifest.kod)


πŸš€ Method 1: Run with Gradle (Easiest)

On Mac/Linux:

Shell
./gradlew run

On Windows:

Cmd
gradlew.bat run

If you get β€œpermission denied” on Mac/Linux, run:

Shell
chmod +x gradlew
./gradlew run

πŸš€ Method 2: Build JAR and Run

Step 1 - Build the JAR:

Shell
./gradlew shadowJar

Or Windows:

Cmd
gradlew.bat shadowJar

Step 2 - Run the JAR:

Shell
java -jar build/libs/DiscordBot-1.0-all.jar

βœ… You’ll know it’s working when you see:

Plain Text
Starting Discord Bot...
Bot is ready! Use /send <message> in Discord.
βœ“ Successfully registered /send command...

⚠️ Make sure first:

  1. You’ve filled in src/main/resources/config.yml with your bot token and channel ID

  2. You have Java installed (check with java -version)


Pro Tip: Keep the terminal window open while using the bot. If you close it, the bot stops working!

real_fubles

in what application can i run that command (gradlew.bat run)

Kodari AI
KodariMay 15 at 11:59 am 3,763 (v2)

You need to run that command in a command line/terminal application. Here are your options:

πŸͺŸ On Windows:

Option 1: Command Prompt (CMD) - Easiest

  1. Press Win + R (Windows key + R)

  2. Type cmd and press Enter

  3. Navigate to your project folder:

    Cmd
    cd C:\path\to\your\project
    
  4. Run:

    Cmd
    gradlew.bat run
    

Option 2: PowerShell

  1. Press Win + X and select β€œWindows PowerShell” or β€œTerminal”

  2. Navigate to your project:

    Powershell
    cd C:\path\to\your\project
    
  3. Run:

    Powershell
    .\gradlew.bat run
    

Option 3: Windows Terminal (Windows 10/11)

  1. Press Win + X β†’ β€œTerminal”

  2. Same as PowerShell above

Option 4: File Explorer Shortcut ⭐ EASIEST

  1. Open File Explorer

  2. Navigate to your project folder (where you see build.gradle)

  3. Click in the address bar at the top

  4. Type cmd and press Enter

  5. Command Prompt opens in that folder automatically!

  6. Run: gradlew.bat run


πŸ’» If you’re using an IDE (IntelliJ IDEA, VS Code, Eclipse):

IntelliJ IDEA:

  • Bottom left β†’ Click β€œTerminal” tab

  • Already in your project folder!

  • Run: gradlew.bat run

VS Code:

  • Top menu β†’ Terminal β†’ New Terminal (or press Ctrl+`)

  • Run: gradlew.bat run

Eclipse:

  • Right-click project β†’ Show In β†’ System Explorer

  • Then use File Explorer method above


The easiest way: Use the File Explorer shortcut (#4) or open the built-in terminal in your code editor!

real_fubles

it doesnt work

Kodari AI
KodariMay 15 at 12:01 pm 2,366 (v2)

Let me check your current setup and

I need more details to help you. What exactly happens when you try to run it? Please tell me:

πŸ“‹ What do you see when you run gradlew.bat run?

Possible scenarios:

1. Error: β€œgradlew.bat is not recognized”

  • You’re in the wrong folder. Make sure you’re in the folder that contains build.gradle

  • Type dir (in CMD) or ls (in PowerShell) and you should see build.gradle, src, manifest.kod

2. Error: β€œPlease set your bot token in config.yml!”

  • You haven’t replaced YOUR_BOT_TOKEN_HERE with your actual token in config.yml

  • See below for fix ⬇️

3. Error: β€œjava: command not found” or Java version error

4. Error: β€œInvalid token” or β€œLogin failed”

  • Your bot token in config.yml is wrong

  • Go back to Discord Developer Portal and copy the token again

5. Nothing happens / no output

  • The terminal might be frozen - wait 10-15 seconds

  • Press Ctrl+C to cancel and try again

6. Bot starts but no /send command appears

  • Did you fill in guild-id in config.yml?

  • Did you invite the bot with applications.commands scope?


⚠️ Quick Check: Have you edited config.yml?

Your config.yml should look like this (with REAL values):

YAML
bot-token: "<redacted>"
channel-id: "1234567890123456789"
guild-id: "9876543210987654321"

Please copy-paste exactly what you see in the terminal, and I’ll help you fix it!

real_fubles

i cant find the path

Kodari AI
KodariMay 15 at 12:01 pm 3,992 (v2)

No problem! Let’s find where your project is saved. Here are the easiest ways:

πŸ” Method 1: Find the Path from Your Code Editor (EASIEST)

If you’re using IntelliJ IDEA:

  1. Right-click on your project name (in the left sidebar)

  2. Click β€œShow in Explorer” (Windows) or β€œReveal in Finder” (Mac)

  3. Your project folder opens!

  4. In that folder, click the address bar at the top and type cmd, then press Enter

  5. Done! Now run: gradlew.bat run

If you’re using VS Code:

  1. Look at the top of VS Code - it shows the folder path

  2. OR: Right-click any file β†’ β€œReveal in File Explorer”

  3. In that folder, click the address bar at the top and type cmd, then press Enter

  4. Done! Now run: gradlew.bat run

If you’re using Eclipse:

  1. Right-click your project β†’ β€œProperties”

  2. Look at β€œLocation” - that’s the path!

  3. Copy it and use Method 3 below


πŸ” Method 2: Search for It

  1. Press Win + E to open File Explorer

  2. Press Ctrl + F to search

  3. Search for: build.gradle

  4. Find the one in your Discord bot project

  5. In that folder, click the address bar and type cmd, then press Enter


πŸ” Method 3: If You Know the Folder Name

  1. Open Command Prompt (Win + R, type cmd, press Enter)

  2. Navigate to where you saved it. Common locations:

    Cmd
    cd C:\Users\YourName\Desktop\DiscordBot
    

    Or:

    Cmd
    cd C:\Users\YourName\Documents\DiscordBot
    

    Or:

    Cmd
    cd C:\Users\YourName\Downloads\DiscordBot
    

Replace YourName with your actual Windows username, and DiscordBot with your project folder name.


βœ… After You Get There:

Check you’re in the right place by typing:

Cmd
dir

You should see:

  • build.gradle

  • src

  • manifest.kod

  • gradlew.bat

Then run:

Cmd
gradlew.bat run

Still can’t find it? Tell me:

  • Where did you create/download the project? (Desktop? Documents? Downloads?)

  • What’s the folder name?

real_fubles

on windows cmd

Kodari AI
KodariMay 15 at 12:01 pm 3,277 (v2)

Perfect! Let’s get you to the right folder in Windows CMD. Follow these steps:

πŸ“ Step-by-Step for Windows CMD:

Step 1: Find Your Project Folder

  1. Open File Explorer (Win + E)

  2. Find your project folder (the one that has build.gradle inside)

  3. Click on the address bar at the top (where it shows the path like C:\Users\...)

  4. The path will be highlighted - RIGHT-CLICK and Copy it

Example path might look like:

  • C:\Users\YourName\Desktop\DiscordBot

  • C:\Users\YourName\Documents\Projects\DiscordBot

Step 2: Open CMD and Navigate There

  1. Open Command Prompt (Win + R, type cmd, press Enter)

  2. Type cd (with a space after cd)

  3. Right-click in the CMD window to paste your path

  4. Press Enter

Example:

Cmd
cd C:\Users\YourName\Desktop\DiscordBot

Step 3: Verify You’re in the Right Place

Type:

Cmd
dir

You should see:

Plain Text
build.gradle
manifest.kod
src
gradlew.bat

Step 4: Run the Bot

Cmd
gradlew.bat run

πŸš€ Even EASIER Alternative:

  1. Open File Explorer

  2. Navigate to your project folder (where you see build.gradle)

  3. Click in the address bar at the top

  4. Type cmd and press Enter

  5. CMD opens already in that folder!

  6. Just run: gradlew.bat run


Try the β€œEven EASIER Alternative” first! It saves you from typing the path. Let me know what happens when you run the command! 🎯

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
manifest.kod
Code
6 258
src/main/java/com/discordbot/Main.java
package com.discordbot;

import net.dv8tion.jda.api.JDA;
import net.dv8tion.jda.api.JDABuilder;
import net.dv8tion.jda.api.entities.Activity;
import net.dv8tion.jda.api.requests.GatewayIntent;

public class Main {
    private static JDA jda;
    private static Config config;

    public static void main(String[] args) {
        System.out.println("Starting Discord Bot...");

        config = new Config();
        config.load();

        String token = config.getBotToken();
        if (token == null || token.equals("YOUR_BOT_TOKEN_HERE")) {
            System.err.println("ERROR: Please set your bot token in config.yml!");
            System.exit(1);
            return;
        }

        try {
            jda = JDABuilder.createDefault(token)
                    .enableIntents(GatewayIntent.GUILD_MESSAGES, GatewayIntent.MESSAGE_CONTENT)
                    .setActivity(Activity.playing(config.getBotStatus()))
                    .build();

            jda.awaitReady();

            SendCommand sendCommand = new SendCommand(config);
            jda.addEventListener(sendCommand);
            
            // Register commands (instant if guild-id is set, otherwise up to 1 hour globally)
            String guildId = config.getGuildId();
            if (guildId != null && !guildId.equals("YOUR_GUILD_ID_HERE")) {
                // Guild-specific registration (instant)
                jda.getGuildById(guildId).updateCommands()
                        .addCommands(sendCommand.getCommandData())
                        .queue(success -> System.out.println("βœ“ Successfully registered /send command in your server (instant)!"),
                               error -> System.err.println("βœ— Failed to register commands: " + error.getMessage()));
            } else {
                // Global registration (can take up to 1 hour)
                jda.updateCommands()
                        .addCommands(sendCommand.getCommandData())
                        .queue(success -> System.out.println("βœ“ Successfully registered /send command globally (may take up to 1 hour)!"),
                               error -> System.err.println("βœ— Failed to register commands: " + error.getMessage()));
            }

            System.out.println("Bot is ready! Use /send <message> in Discord.");

        } catch (Exception e) {
            System.err.println("Failed to start bot: " + e.getMessage());
            e.printStackTrace();
            System.exit(1);
        }
    }

    public static JDA getJDA() {
        return jda;
    }

    public static Config getConfig() {
        return config;
    }
}