From 1f6c27f458ed9eca41e3920b15c9e32ce831c65b Mon Sep 17 00:00:00 2001 From: Heidar Bernhardsson Date: Mon, 6 Feb 2017 22:11:49 +0800 Subject: update discord.js and fix channel retreival --- index.js | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) 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": { -- cgit 1.4.1 From be3465744f6ad63dbdfaeecbf906daba4e731958 Mon Sep 17 00:00:00 2001 From: Heidar Bernhardsson Date: Mon, 6 Feb 2017 22:12:18 +0800 Subject: add some extra useful info --- README.md | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 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= 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": "", /* 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": "", /* 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 -- cgit 1.4.1