destruc7i0n / shulker

A Discord to Vanilla Minecraft Chat Gateway
ISC License
135 stars 47 forks source link

Error on sending message from discord to mc #65

Closed lukeadams84 closed 3 years ago

lukeadams84 commented 3 years ago

debug log show this error when message is sent from discord to mc:

`yarn run v1.22.5 $ tsc Done in 1.62s. yarn run v1.22.5 $ node build/index.js [INFO] Using configuration file: ../config.json [INFO] Using the Discord bot to send messages [INFO] Using configuration for local log file at "/opt/valhesia/logs/latest.log" [INFO] Authenticated with 127.0.0.1:25575 [DEBUG] Received response: /opt/tools/shulker/build/Discord.js:199 nickname: message.member.nickname ? emoji_strip_1.default(message.member.nickname) : emoji_strip_1.default(message.author.username), ^

TypeError: Cannot read property 'nickname' of null at Discord.makeMinecraftTellraw (/opt/tools/shulker/build/Discord.js:199:38) at Discord. (/opt/tools/shulker/build/Discord.js:169:65) at step (/opt/tools/shulker/build/Discord.js:33:23) at Object.next (/opt/tools/shulker/build/Discord.js:14:53) at fulfilled (/opt/tools/shulker/build/Discord.js:5:58) at processTicksAndRejections (node:internal/process/task_queues:93:5) error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.`

lukeadams84 commented 3 years ago

config.json is as follows:

{ "PORT": 8000,

"USE_WEBHOOKS": false,
"WEBHOOK_URL": "https://discord.com/api/webhooks/#####",
"IGNORE_WEBHOOKS": false,
"DISCORD_TOKEN": "################",
"DISCORD_CHANNEL_ID": "769955004906733610",
"DISCORD_CHANNEL_NAME": "#minecraft",
"DISCORD_MESSAGE_TEMPLATE": "`%username%`: %message%",

"MINECRAFT_SERVER_RCON_IP": "127.0.0.1",
"MINECRAFT_SERVER_RCON_PORT": 25575,
"MINECRAFT_SERVER_RCON_PASSWORD": "#####",
"MINECRAFT_TELLRAW_DOESNT_EXIST": false,
"MINECRAFT_TELLRAW_DOESNT_EXIST_SAY_TEMPLATE": "<%username%> %message%",
"MINECRAFT_TELLRAW_TEMPLATE": "[{\"color\": \"white\", \"text\": \"<%username%> %message%\"}]",

"IS_LOCAL_FILE": true,
"LOCAL_FILE_PATH": "/opt/valhesia/logs/latest.log",

"SHOW_INIT_MESSAGE": true,

"ALLOW_USER_MENTIONS": false,
"ALLOW_HERE_EVERYONE_MENTIONS": false,
"ALLOW_SLASH_COMMANDS": false,
"SLASH_COMMAND_ROLES": [],

"WEBHOOK": "/minecraft/hook",
"REGEX_SERVER_PREFIX": "\\[Server thread/INFO\\] \\[.*\\]:",
"REGEX_MATCH_CHAT_MC": "^<([^>]*)> (.*)",
"REGEX_IGNORED_CHAT": "packets too frequently",
"DEBUG": true,

"SERVER_NAME": "MC-Bot",
"SERVER_IMAGE": "https://##/potato_server.jpg",
"SHOW_SERVER_STATUS": true,
"SHOW_PLAYER_CONN_STAT": true,
"SHOW_PLAYER_ADVANCEMENT": true,
"SHOW_PLAYER_DEATH": true,
"SHOW_PLAYER_ME": true,
"DEATH_KEY_WORDS": ["shot", "fell", "death", "died", "doomed", "pummeled", "removed", "didn't want", "withered", "squashed", "flames", "burnt", "walked into", "bang", "roasted", "squished", "drowned", "killed", "slain", "blown", "blew", "suffocated", "struck", "lava", "impaled", "speared", "fireballed", "finished", "kinetic"]

}

In addition, the bot does not seem to create its own web hook. However a manually created one works.

Screenshot 2020-10-31 at 01 24 15

destruc7i0n commented 3 years ago

The bot itself does not create the webhook, it is currently manual. I suppose that I should look into the bot making the webhook, since webhooks are much more visually appealing 🤔

Apologies for the error there, you can fix that by either re-downloading the project or updating the discord.js version, with yarn add discord.js@^11.6.1

lukeadams84 commented 3 years ago

The bot itself does not create the webhook, it is currently manual. I suppose that I should look into the bot making the webhook, since webhooks are much more visually appealing 🤔

Apologies for the error there, you can fix that by either re-downloading the project or updating the discord.js version, with yarn add discord.js@^11.6.1

Thanks! That worked perfectly, and thanks for putting this together, it is much better standalone than adding another mod.