From 9ac2bbe9781f7ab5a798621cc9dd46b4ff8befda Mon Sep 17 00:00:00 2001 From: destruc7i0n Date: Tue, 4 Feb 2020 00:51:15 -0500 Subject: Refactor and rebuild to TypeScript --- package.json | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'package.json') diff --git a/package.json b/package.json index 0b03fca..7da3554 100644 --- a/package.json +++ b/package.json @@ -1,10 +1,11 @@ { "name": "shulker", - "version": "2.0.0", + "version": "2.1.0", "description": "A Discord to Minecraft Chat Gateway", - "main": "index.js", + "main": "build/index.js", "scripts": { - "start": "node index.js", + "start": "node build/index.js", + "build": "tsc", "test": "standard" }, "repository": { @@ -22,13 +23,18 @@ }, "homepage": "https://github.com/destruc7i0n/shulker#readme", "dependencies": { - "axios": "^0.18.0", - "discord.js": "^11.4.2", + "axios": "^0.19.2", + "discord.js": "^11.5.1", "emoji-strip": "^1.0.1", - "express": "^4.16.4", - "tail": "^2.0.1" + "express": "^4.17.1", + "tail": "^2.0.3" }, "devDependencies": { - "standard": "^12.0.1" + "@types/emoji-strip": "^1.0.0", + "@types/express": "^4.17.2", + "@types/tail": "^2.0.0", + "standard": "^14.3.1", + "tslint-config-standard": "^9.0.0", + "typescript": "^3.7.5" } } -- cgit 1.4.1 From 85e8c38f51d14a669cc5d7bb24c210d9d72654da Mon Sep 17 00:00:00 2001 From: destruc7i0n Date: Tue, 4 Feb 2020 10:21:17 -0500 Subject: Docs updates --- README.md | 41 ++++++++++++++++++++++++++++++++++++----- package.json | 2 +- src/MinecraftHandler.ts | 2 +- 3 files changed, 38 insertions(+), 7 deletions(-) (limited to 'package.json') diff --git a/README.md b/README.md index 5917a3c..68d7555 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,12 @@ ## In Action ![discord-mc](http://i.thedestruc7i0n.ca/I5anbg.gif) +## Features +- Sends message to and from Vanilla Minecraft servers +- Can send messages regarding advancements, when players join and leave, and player deaths +- Allows admins to send commands to Minecraft through Discord + + ## Installation and usage Create a Discord bot here: https://discordapp.com/developers/applications/me @@ -24,15 +30,16 @@ rcon.port=<1-65535> Clone repository onto a server, edit ```config.json``` (see below for more info) and change any options, and then, in the repository folder: ```sh $ yarn -$ yarn start +$ yarn build && yarn start ``` -If you are running this locally, check the `IS_LOCAL_FILE` flag and related options below. Otherwise, perform the following command: +If you are running this locally, enable the `IS_LOCAL_FILE` flag and related options below. Otherwise, perform the following command: On your server hosting (in a screen/tmux session or background process, make sure to replace your `YOUR_URL` with whatever URL you're using (`localhost:8000` if running on the same server and default config) and `PATH_TO_MINECRAFT_SERVER_INSTALL` with the path to the Minecraft server installation, such as `/usr/home/minecraft_server/`): ``` sh tail -F /PATH_TO_MINECRAFT_SERVER_INSTALL/logs/latest.log | grep --line-buffered ": <" | while read x ; do echo -ne $x | curl -X POST -d @- http://YOUR_URL/minecraft/hook ; done ``` +(The above command will also be given to you if you are not using a local file when you start up Shulker) You can also easily Deploy to Heroku and the like, just be sure to edit `YOUR_URL` in the command to match accordingly. @@ -57,25 +64,49 @@ You can also easily Deploy to Heroku and the like, just be sure to edit `YOUR_UR "IS_LOCAL_FILE": false, /* should tail the local file, may be a little buggy. please report any you find */ "LOCAL_FILE_PATH": "/usr/home/minecraft_server/logs/latest.log", /* the path to the local file if specified */ + + "SHOW_INIT_MESSAGE": true, /* Sends the message on boot if not a local file of what command to run */ + "ALLOW_USER_MENTIONS": false, /* should replace @mentions with the mention in discord */ + "ALLOW_HERE_EVERYONE_MENTIONS": false, /* replaces @everyone and @here with "@ everyone" and "@ here" respectively */ + "ALLOW_SLASH_COMMANDS": false, /* whether to allow users to run slash commands from discord */ + "SLASH_COMMAND_ROLES": [], /* if the above is enabled, the names of the roles which can run slash commands */ "WEBHOOK": "/minecraft/hook", /* Web hook, where to send the log to */ - "REGEX_MATCH_CHAT_MC": "\\[Server thread/INFO\\]: <(.*)> (.*)", /* What to match for chat (best to leave as default) */ + "REGEX_SERVER_PREFIX": "\\[Server thread/INFO\\]:", /* What the lines of the log should start with */ + "REGEX_MATCH_CHAT_MC": "^<([^>]*)> (.*)", /* What to match for chat (best to leave as default) */ "REGEX_IGNORED_CHAT": "packets too frequently", /* What to ignore, you can put any regex for swear words for example and it will be ignored */ - "DEBUG": false /* Dev debugging */ + "DEBUG": false, /* Dev debugging */ + + "SERVER_NAME" : "Shulker", /* The username used when displaying any server information in chat, e.g., Server - Shulker : Server message here*/ + "SERVER_IMAGE": "", /* Image for the server when sending such messages (if enabled below). Only for WebHooks. */ + "SHOW_PLAYER_CONN_STAT" : false, /* Shows player connection status in chat, e.g., Server - Shulker : TheMachine joined the game */ + "SHOW_PLAYER_ADVANCEMENT" : false, /* Shows when players earn achievements in chat, e.g., Server - Shulker : TheMachine has earned the achievement [MEME - Machine] */ + "SHOW_PLAYER_DEATH" : false, /* Shows when players die in chat, e.g., Server - Shulker : TheMachine was blown up by creeper */ + "SHOW_PLAYER_ME" : false, /* Shows when players use the /me command, e.g. **destruc7i0n** says hello */ + "DEATH_KEY_WORDS" : ["shot", "fell", "etc".] /* Key words to look for when trying to identify a death message. (As of 3/11/2019 this list is up to date) */ } ``` +## FAQ +* How do I make this work on a modded server? + - Try replacing `REGEX_SERVER_PREFIX` with `"\\[Server thread/INFO\\] \\[.*\\]:"` + +* Why can't I send commands even if I have the option enabled? + - Make sure that you have a role on the server which is put in the array `SLASH_COMMAND_ROLES` case-sensitive. + - e.g. `"SLASH_COMMAND_ROLES": ["Admin"],` + ## Upcoming None ## Suggestions -If you have any suggestions or feature requests, feel free to add an issue and I will take a look and possibly add it to the "Upcoming" section! +If you have any suggestions or feature requests, feel free to add an issue and I will take a look. ## Thanks * [hydrabolt](https://github.com/hydrabolt) for discord.js * [qrush](https://github.com/qrush) for the idea of this ([wither](https://github.com/qrush/wither)) * [SecretOnline](https://github.com/secretonline) for Rcon reconnecting and for making it only send messages in specified channel +* [TheZackCodec](https://github.com/TheZackCodec/) for the updates in server based messages ## License diff --git a/package.json b/package.json index 7da3554..e4b799c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "shulker", - "version": "2.1.0", + "version": "3.0.0", "description": "A Discord to Minecraft Chat Gateway", "main": "build/index.js", "scripts": { diff --git a/src/MinecraftHandler.ts b/src/MinecraftHandler.ts index 79ad81b..aa4f2f7 100644 --- a/src/MinecraftHandler.ts +++ b/src/MinecraftHandler.ts @@ -149,7 +149,7 @@ class MinecraftHandler { console.log('[INFO] Please enter the following command on your server running the Minecraft server.') console.log(' Replace "PATH_TO_MINECRAFT_SERVER_INSTALL" with the path to your Minecraft server install') console.log(' and "YOUR_URL" with the URL/IP of the server running Shulker!') - console.log(` \`tail -F /PATH_TO_MINECRAFT_SERVER_INSTALL/logs/latest.log | grep --line-buffered "${this.config.REGEX_SERVER_PREFIX}" | while read x ; do echo -ne $x | curl -X POST -d @- http://YOUR_URL:${port}${this.config.WEBHOOK} ; done\``) + console.log(` \`tail -F /PATH_TO_MINECRAFT_SERVER_INSTALL/logs/latest.log | grep --line-buffered ": <" | while read x ; do echo -ne $x | curl -X POST -d @- http://YOUR_URL:${port}${this.config.WEBHOOK} ; done\``) } }) } -- cgit 1.4.1 > sndioctl is nice and easy. 2021-02-09Use w3m to open other URLsJune McEnroe 2021-02-09Disable mouse mode in xtermJune McEnroe I do not ever want to use this feature. 2021-02-09Add pbcopy, pbpaste, open dispatch scriptsJune McEnroe 2021-02-09Use flags for pbd client behaviourJune McEnroe 2021-02-08Add macOS-like copy and paste to xtermJune McEnroe 2021-02-08Only update clock script every minuteJune McEnroe 2021-02-08Use 4M- for window resizing in cwmJune McEnroe 2021-02-08Tweak trackpad scaling, mouse accelerationJune McEnroe This feels more comfortable. 2021-02-08Use xsel in up and add it do install.shJune McEnroe 2021-02-07Swap root window coloursJune McEnroe 2021-02-07Add -X flag to install X stuff on OpenBSDJune McEnroe 2021-02-07Adjust brightness by smaller incrementsJune McEnroe 2021-02-07Fix cwm window cycling, move big by defaultJune McEnroe 2021-02-07Use class names for Foreground, Background, BorderColorJune McEnroe I'm not really sure what difference this makes, but it seems like the right thing to do to be generic? 2021-02-07Add simple battery status and clock to xsessionJune McEnroe I love how simple this is. 2021-02-07Set cursor theme and sizeJune McEnroe 2021-02-07Use scrot for up -s if no screencaptureJune McEnroe Still missing putting the URL in an X selection. 2021-02-07Enable mouse acceleration in XJune McEnroe 2021-02-07Set colours for Xt and cwmJune McEnroe And increase XTerm internalBorder. 2021-02-07Set urgency on bell in xtermJune McEnroe 2021-02-07Add bindings for brightness controlJune McEnroe Weirdly the Fn key doesn't change how the F row registers... I wonder if I can do something about that. 2021-02-07Set X key repeat rateJune McEnroe 2021-02-07Bump font size to 12June McEnroe 11 is what I use on macOS, but I feel like my eyes are working harder here. 2021-02-07Fully configure and rebind cwmJune McEnroe This is sort of a mix of trying to emulate macOS somewhat for my muscle memory and just rebinding some of the cwm defaults to use 4- rather than M-. 2021-02-07Add BintiJune McEnroe 2021-02-07Finish configuring xtermJune McEnroe 2021-02-06Enable tapping, reverse scroll, set scaling in wsconsctlJune McEnroe 2021-02-06Set root window to black on purple snowJune McEnroe 2021-02-06Add xmodmap configurationJune McEnroe 2021-02-06Add initial OpenBSD X configurationJune McEnroe cwm still needs a lot more rebinding, and I need to actually look at its other options. xterm definitely still needs some configuration, but I at least managed to get it to use a decent looking font. Very happy that OpenBSD includes Luxi Mono, which is what my usual font, Go Mono, is based on anyway. Still missing is xmodmap and such. 2021-02-06Add xterm output to schemeJune McEnroe