diff options
author | destruc7i0n <destruc7i0n@users.noreply.github.com> | 2017-02-09 12:15:41 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-09 12:15:41 -0500 |
commit | ba8fa952343d33b1224bb949f70cc565b491ba22 (patch) | |
tree | c3f422faff8121fe27d87f7ab7a3a8baab027996 | |
parent | Latest node version Travis (diff) | |
parent | add some extra useful info (diff) | |
download | shulker-ba8fa952343d33b1224bb949f70cc565b491ba22.tar.gz shulker-ba8fa952343d33b1224bb949f70cc565b491ba22.zip |
Merge pull request #17 from heidar/master
Update discord.js and improve README
-rw-r--r-- | README.md | 23 | ||||
-rw-r--r-- | index.js | 6 | ||||
-rw-r--r-- | package.json | 2 |
3 files changed, 15 insertions, 16 deletions
diff --git a/README.md b/README.md index 20be8bb..30c4fbb 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ rcon.password=<your password> rcon.port=<1-65535> ``` -Run the following on your server hosting (in a screen, and make sure to replace your URL and your log directory location): +Run the following on your server hosting (in a screen/tmux session or background process, and make sure to replace your URL and your log directory location): ``` sh tail -F /PATH_TO_MINECRAFT_INSTALL/logs/latest.log | grep --line-buffered ": <" | while read x ; do echo -ne $x | curl -X POST -d @- https://YOUR_URL/minecraft/hook ; done @@ -39,16 +39,15 @@ You can also easily Deploy to Heroku or Bluemix. ```js { "PORT": 8000, /* Port you want to run the webserver for the hook on */ - "DISCORD_EMAIL": "example@example.com", /* discord email */ - "DISCORD_PASSWORD": "password123", /* discord password */ - "DISCORD_CHANNEL": "general", /* channel for discord bot */ - "MINECRAFT_SERVER_RCON_IP": "example.com", /* minecraft server ip (make sure you have enabled rcon) */ - "MINECRAFT_SERVER_RCON_PORT": <1-65535>, /* minecraft server rcon port */ - "MINECRAFT_SERVER_RCON_PASSWORD": "<your password>", /* minecraft server rcon password */ - "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_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 */ + "DISCORD_TOKEN": "<12345>", /* Discord bot token. [Click here](https://discordapp.com/developers/applications/me) to create you application and add a bot to it. */ + "DISCORD_CHANNEL_ID": "<12345>", /* Discord channel ID for for the discord bot. Enable developer mode in your Discord client, then right click channel and select "Copy ID". */ + "MINECRAFT_SERVER_RCON_IP": "example.com", /* Minecraft server IP (make sure you have enabled rcon) */ + "MINECRAFT_SERVER_RCON_PORT": <1-65535>, /* Minecraft server rcon port */ + "MINECRAFT_SERVER_RCON_PASSWORD": "<your password>", /* Minecraft server rcon password */ + "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_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 */ } ``` @@ -69,7 +68,7 @@ If you have any suggestions or feature requests, feel free to add an issue and I ## 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 +* [SecretOnline](https://github.com/secretonline) for Rcon reconnecting and for making it only send messages in specified channel ## License diff --git a/index.js b/index.js index f3f9629..2c21524 100644 --- a/index.js +++ b/index.js @@ -39,14 +39,14 @@ shulker.on("ready", function() { console.log("[DEBUG] Text: " + bodymatch[2]); } var message = "`" + bodymatch[1].replace(/(\ยง[A-Z-a-z-0-9])/g, "") + "`:" + bodymatch[2]; - shulker.channels.get("id", channel).sendMessage(message); + shulker.channels.get(channel).sendMessage(message); } response.send(""); }); }); shulker.on("message", function(message) { - if (message.channel.id === shulker.channels.get("name", c.DISCORD_CHANNEL).id) { + if (message.channel.id === shulker.channels.get(c.DISCORD_CHANNEL_ID).id) { if (message.author.id !== shulker.user.id) { var data = { text: "<" + message.author.username + "> " + message.cleanContent @@ -61,7 +61,7 @@ shulker.on("message", function(message) { } }); -shulker.loginWithToken(c.DISCORD_TOKEN); +shulker.login(c.DISCORD_TOKEN); var ipaddress = process.env.OPENSHIFT_NODEJS_IP || process.env.IP || "127.0.0.1"; var serverport = process.env.OPENSHIFT_NODEJS_PORT || process.env.PORT || c.PORT; diff --git a/package.json b/package.json index ceeb121..ca6b319 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ }, "homepage": "https://github.com/destruc7i0n/shulker#readme", "dependencies": { - "discord.js": "^6.1.0", + "discord.js": "^11.0.0", "express": "^4.13.3" }, "devDependencies": { |