haxball / haxball-issues

115 stars 43 forks source link

I was wondering if there is a way to connect haxball between the discord, being able to use node.js #1298

Open MasterOfCuriosity opened 3 years ago

MasterOfCuriosity commented 3 years ago

I was wondering if there is any way to connect haxball with Discord and do a lot of cool things, like the bot having its nickname with the number of players in the room Example: [12/20] And also create commands where it would involve discord and haxball together, thus creating such examples as registering new players

I can even use the puppeteer, but unfortunately I don't know how to use it, if by chance someone can help, I will be very grateful, I just want to bridge the gap between Discord and Haxball

TurboFalafel commented 3 years ago

I think browserify.org might help you

Lyfhael commented 3 years ago

browserify won't work. You need a bridge. In simple words you need to make a webserver with 'Express' node.js module, in this webserver you'll also include Discord.js module.

Once it is on, on your haxball room script you need to send HTTP requests to this webserver to tell it what to do.

For example you send in the body {"mode":"discord", "action":"sendmessage", "channelID":32324545} etc, then you can read this on your webserver and use Discord.js like that.

That's exactly what I'm doing right now, I almost finished to do it

MasterOfCuriosity commented 3 years ago

browserify won't work. You need a bridge. In simple words you need to make a webserver with 'Express' node.js module, in this webserver you'll also include Discord.js module.

Once it is on, on your haxball room script you need to send HTTP requests to this webserver to tell it what to do.

For example you send in the body {"mode":"discord", "action":"sendmessage", "channelID":32324545} etc, then you can read this on your webserver and use Discord.js like that.

That's exactly what I'm doing right now, I almost finished to do it

@teisseire117 Would I be able to kind of recreate what @toderitagcristian created?

Lyfhael commented 3 years ago

browserify won't work. You need a bridge. In simple words you need to make a webserver with 'Express' node.js module, in this webserver you'll also include Discord.js module. Once it is on, on your haxball room script you need to send HTTP requests to this webserver to tell it what to do. For example you send in the body {"mode":"discord", "action":"sendmessage", "channelID":32324545} etc, then you can read this on your webserver and use Discord.js like that. That's exactly what I'm doing right now, I almost finished to do it

@teisseire117 Would I be able to kind of recreate what @toderitagcristian created?

What did he create ?

MasterOfCuriosity commented 3 years ago

image

and more...

MasterOfCuriosity commented 3 years ago

This project

MasterOfCuriosity commented 3 years ago

Or this

TurboFalafel commented 3 years ago

browserify won't work. You need a bridge. In simple words you need to make a webserver with 'Express' node.js module, in this webserver you'll also include Discord.js module.

Once it is on, on your haxball room script you need to send HTTP requests to this webserver to tell it what to do.

For example you send in the body {"mode":"discord", "action":"sendmessage", "channelID":32324545} etc, then you can read this on your webserver and use Discord.js like that.

That's exactly what I'm doing right now, I almost finished to do it

Well, I've created the bridge between Discord and Haxball using browserify more than a year ago, and it still works ;)

MasterOfCuriosity commented 3 years ago

browserify won't work. You need a bridge. In simple words you need to make a webserver with 'Express' node.js module, in this webserver you'll also include Discord.js module. Once it is on, on your haxball room script you need to send HTTP requests to this webserver to tell it what to do. For example you send in the body {"mode":"discord", "action":"sendmessage", "channelID":32324545} etc, then you can read this on your webserver and use Discord.js like that. That's exactly what I'm doing right now, I almost finished to do it

Well, I've created the bridge between Discord and Haxball using browserify more than a year ago, and it still works ;)

Can you help me with that? I just need to make the connection and so my server is complete

TurboFalafel commented 3 years ago

Create Haxball Headless Script with functions from discord.js (you can just copy-paste the discord bot script) in the same direction where config.json and node_modules are, then bundle it up using browserify and run on haxball.com/headless

MasterOfCuriosity commented 3 years ago

Do you have Discord? @TurboFalafel

Zenit225 commented 1 year ago

Create Haxball Headless Script with functions from discord.js (you can just copy-paste the discord bot script) in the same direction where config.json and node_modules are, then bundle it up using browserify and run on haxball.com/headless

Can you help me with this?