How do I send commands from Command Prompt to Minecraft Bedrock Edition using a Discord Bot and bedrock-protocol

Viewed 45

I am modifying a github project to work for my needs. Essentially, it relays chat between a Discord channel (through a bot) and a Minecraft Bedrock Edition server, using Command Prompt as the middle ground. The problem is that, while it sends the message clearly to Command Prompt, it doesn't send the command to the Minecraft server.

Here is the code:

bot.on("message", function (message) {
    if (message.channel.id == chatchannel) {
        if (message.author != bot.user) {
            client.queue("command_request", {
                command: '/tellraw @a {"rawtext":[{"text":"§r[§9Discord§r] ${message.author.username} >> ${message.content}"}]}',
                origin: {
                    size: 0,
                    type: 0,
                    uuid: "",
                    request_id: "",
                },
                interval: false,
            });
        }
    }
})

This is what shows up in Command Prompt after I type "test" in Discord:


19132 //server port
Connecting to "REDACTED SERVER HOST" "REDACTED SERVER NAME" (Main Survival World), version 1.19.30  (as 1.19.21)
  minecraft-protocol offline mode, not authenticating {
  version: '1.19.21',
  autoInitPlayer: true,
  offline: true,
  connectTimeout: 9000,
  raknetBackend: 'raknet-native',
  useRaknetWorkers: true,
  port: 19132,
  followPort: true,
  host: "REDACTED SERVER HOST",
  username: 'Discord',
  delayedInit: true,
  protocolVersion: 545
} +0ms
  minecraft-protocol [client] connecting to "REDACTED SERVER HOST" {
  name: 'Discord',
  uuid: '"REDACTED UUID",
  xuid: 0
} RakNativeClient {
  _events: [Object: null prototype] {},
  _eventsCount: 0,
  _maxListeners: undefined,
  connected: false,
  onConnected: [Function (anonymous)],
  onCloseConnection: [Function (anonymous)],
  onEncapsulated: [Function (anonymous)],
  raknet: Client {
    _events: [Object: null prototype] {
      encapsulated: [Function (anonymous)],
      connect: [Function (anonymous)],
      disconnect: [Function (anonymous)]
    },
    _eventsCount: 3,
    _maxListeners: undefined,
    client: RakClient {},
    ping: [Function (anonymous)],
    connect: [Function (anonymous)],
    close: [Function (anonymous)],
    [Symbol(kCapture)]: false
  },
  [Symbol(kCapture)]: false
} +3ms
  minecraft-protocol * new status 0 +0ms
  minecraft-protocol C <- Q <-  command_request {
  command: '/tellraw @a {"rawtext":[{"text":"§r[§9Discord§r] ${message.author.username} >> ${message.content}"}]}',
  origin: { size: 0, type: 0, uuid: '', request_id: '' },
  interval: false
} +14m

Note: I am being extra cautious at removing uuids and server info, but I have always replaced it with "REDACTED ____________"

The bot is working fine, but without this issue being resolved, it will be pointless.

Any help would be greatly appreciated.

0 Answers
Related