Connect minecraft with discord.js - node.js

Any way to connect discord.js with minecraft server, i wanna type in discord my nickname in channel #reward
and got in minecraft 10 diamonds on my nickname,
i trying to use rest but idk how to implement miencraft + discord.js
someone has idea?

Discord.js does not include any features for Minecraft, however, you could use a webhook plugin (If using spigot/paper/bukkit...) or find an online webhook. You could even set up a hidden discord channel where the bot can read the webhooks and announce them in its own way.
You may be able to link RCon with your discord bot to give you diamond if you did indeed type your nickname in #reward, however, there is no official way to do this (to my knowledge)

You can user the discord java api to create the bot inside a plugin or you can use mineflayer and discord.js to create a minecraft bot and a discord bot and let them communicate using websockets.

You can use a discord java api (ex. JDA) to make a bot, which is gonna take user parameter and gonna process this through rcon

If your bot is able to interact with the commandline, you can use RCon.
MCRcon is a cross-platform rcon client which is run via the commandline.
There may also be a js library for RCon.
Using RCon:
Make sure it is able to access the #reward channel. You need to make it so it can see the messages and find usernames.
You need to execute the following command (mcrcon):
mcrcon -H <hostname> -P <RCon Port> -s (Prevents Feedback) -p <RCon Password> "give <username> diamond"
For MCRCon: https://sourceforge.net/projects/mcrcon/
Note: MCRCon is available for both Windows and Linux

If the other answers don't help, the easiest way to connect Minecraft and Discord is thru a Minecraft Plugin and Addon that lets you control your bot. The plugin is called Skript and the addon is called Vixio. There is a full tutorial on how to set it up here
I hope it works for you :)

If you're hosting your minecraft server on a pterodactyl server then you can just send a request to their api to post a command on the prompt.

Related

NodeRed: How to get reply from Slack app interactive message

I'm trying to make it so that NodeRed uses a webhook to send an interactive message to a slack app to ask permission to activate something. I can POST to the webhook without any issues from my custom node, but how do I get the reply?
Do I need to use the "http in" node to create an endpoint Slack can use? Is there a way to handle it from the same node that POSTs the message?
Also, I'm running NodeRed locally. Can I use ngrok so that Slack can access the http endpoint (in case I need to use that)?
You can define your own http endpoints that are private to your custom node, this is how nodes that need to do oAuth handle the callback. Also nodes like the serial port node do this to supply information to the config dialog.
Make sure to give the endpoint a unique route so it's unlikely to clash with any other nodes.
You can look at the source for the serial port node here
How you ensure that Node-RED is safely made accessible from the internet should be a separate question.
1) Yes, ngrok works nicely for exposing your local webserver securely to the Internet and Slack. I use it every day for my Slack app development. Keep in mind that if your app can't be reached from the Internet, then also Slack can not reach it.
2) Interactive Messages only work with Slack apps. One reason being that you need to provide the route to your app, so that Slack knows where to send the requests when someone uses your interactive messages (e.g. clicks on a button). But you can use interactive messages with webhooks, as long as both are setup within the same Slack app.
3) Don't believe the "http-in node" approach will work. As said, you need to configure the route to your app for receiving messages from Slack in your Slack appp.

Running an IRC bot under current nick?

I'm developing my own irc bot and in a channel I'm in, one of the ops is able to activate a bot but run it under his own nick without a new nick joining the channel.
For example, guy's nick is #James and he activated a bot that says hello when you do .hello:
+John: .hello
#James: Hello, John.
Any idea how is this done possibly? The only way I've been able to run my bot is to connect it to the server & channel with a completely new nick.
This really depends on how the bot is written/implemented. Some IRC clients (like MIRC or HexChat/X-Chat) support scripting. As such you're able to extend them to act just like bots even though someone is actually using them as a standard client. I could also imagine some interface being use, like a bouncer, which allows multiple clients to connect to one permanent IRC session.
there are 2 ways
eggdrops
or mIRCScripting
script like on texts, can't be triggered by yourself
example
on $*:text:/^\.h(i|ello)$/iS:#:{
msg $chan $+(h,$regml(1)) $nick
}
the difference is, when you run your bot on the same mIRC client
you can specify who is the owner of the bot, and who is not
like
on $*:text:/^\.h(i|ello)$/iS:#:{
if ($me == botname) {
msg $chan $+(h,$regml(1)) $nick
}
}
the script will only trigger, if it is running under Bot's name

Execute irc action on computer

Just as the title says, I want a command be done when a certain word is said in my irc channel.
Ex: If someone types "Hey!" in the channel, the server performs an action like restarting an services.
The channel is private and only I will be getting access to it.
The purpose of it will be that if I send a command from my office that I want to restart Apache (example).
Then I'll type apacherst, the irc sends the command to my server and restarts apache.
Any idea?
Thanks!
/Phew
Check out a program called Hubot. It has a plug-in mechanism to let make your chat server extensible. It supports IRC and many other protocols.

How do I run a node IRC bot?

I'd like to run this IRC Eliza bot but I lack some fundamental understanding of how to do it.
https://github.com/isaacs/node-eliza
I don't know anything about IRC or how to connect to them. Could someone explain how I connect to this bot? Do I need to host it remotely? Is there a way to run an IRC client locally and connect to it locally? Currently the program just runs without error but does nothing.
I understand node.js, but I seem to missing some fundamentals in understanding IRC on how to get an IRC bot running.
The readme gives me code that executes but doesn't do anything, quoted below:
Usage
var Eliza = require('eliza/irc.js')
new Eliza({ server: 'irc.freenode.net'
, nick: 'Eliza'
, channels: ['##turtles']
, userName: 'eliza'
, realName: 'eliza' })
IRC is the a global chat system, comprised of many individual hosts, all (eventually) linked. You usually don't run a part of IRC yourself, rather you use a client to connect to one of the hosts and thus gain access to the network and everyone on it.
An IRC bot is a piece of machine code that has its own logic (Eliza's logic, in your case), and is also connected to IRC and issues IRC commands that let it join channels, talk to other people/bots, received messages, etc.
In your case, you would simply need to run the bot, and let it know which IRC server to join (that the server parameter in new Eliza({...), what nick name to choose for itself, etc.
To run the bot just run node, in any environment (your home PC? hosting?) with the contents of the sample file.

A way to transfer IRC chatter/pm to gtalk

I'd like to know if some sort of bot/tool/service exists that would allow people on (regular) IRC chat to me on gtalk
so: irc user X sends a pm to MyBot (f.e.); that pm forwards to me
a irc room to chat would also work fine (so everything said in channel #abc gets into my gtalk conversation with mybot#domain.com
hope I was clear enough for you to understand what I'm looking for and that anyone knows a way for me to solve it.
Thanks!
You can use PircBotX to create an IRC bot in Java yourself, and use pm events to send gtalk messages using any old Jabber library. A quick search finds me Smack.
I did something similar once, but I made two instances of PircBotX, one to connect to the IRC server, and another to connect to this special IRC server somewhere that was configured to automatically pass on messages to popular IM protocols. I can't seem to remember what that service was called, perhaps you'll have better luck.
Well, there's the hans-irc-gtalk bot which does something like that. People need to subscribe to the messages in order to get them from gtalk. Not sure how well supported the project is.

Resources