WildPHP / irc-bot

A simple and modular PHP IRC bot
MIT License
84 stars 24 forks source link

Control panel for the bot #33

Open NanoSector opened 9 years ago

NanoSector commented 9 years ago

I've been looking into opening ports with php. Apparently we can open ports with sockets.

Because the bot can't listen to input by itself, we could make it listen to input from another socket and associated port.

The advantage to this would be we could use control panels in all kinds of formats. We can make a web based panels, graphical platform independent panels, mobile panels, you name it. You're not bound to PHP as programming language. And you can remotely control the bot instead of just locally.

Disadvantage would be that the bot needs additional components to be managed and we need a standard for interpreting commands, plus implementations for commands (and probably authentication in the meantime, so random idiots can't connect and control it).

We could possibly make this a module.

NanoSector commented 9 years ago

With the new non blocking socket implementation we can just let this hook into the Loop event and go with the flow :)

I've been trying to work on a module like this but can't get a desktop application done, my C# knowledge is too limited. We should also be able to make a web control panel though.

Amunak commented 9 years ago

A web-based control panel would be the best as it would be very easily accessible from anywhere without being bound to a specific platform.

NanoSector commented 9 years ago

Okay. Would you have an idea of what protocol to use to talk to the bot?

Amunak commented 9 years ago

Basically there are two options - we either make an API that can be used by anything else, in which case I'd try to go with REST and use JSON to pass the data and stuff, but that would mean having a full-featured webserver running. In which case we may as well just serve the webpages directly from the bot. Or just go with whatever, implement our own protocol that would be easiest for us, but it may not be ideal.

We could use something like https://github.com/reactphp/react to handle that for us (it could actually handle the bot loop and stuff for us too... should've found out about that earlier).

NanoSector commented 9 years ago
[01:59] <NanoSector> amunak: i like the idea of using react, is it too late to do that?
[02:02] <NanoSector> yup, it is
[02:02] <NanoSector> meh.
[02:02] <amunak> well
[02:02] <amunak> probably not too late
[02:02] <NanoSector> but a lot of work to port
[02:02] <amunak> the bot is written well (I hope! :P) so it shouldn't be too bad
[02:03] <amunak> depends
[02:03] <NanoSector> i hope so too :P
[02:03] <NanoSector> also, what do you think of passing objects as outgoing data instead of just strings
[02:03] <NanoSector> like
[02:03] <amunak> I mean we can just use its server for now, perhaps the application loop and stuff, and we can rewrite whatever else is left later
[02:03] <NanoSector> $this->bot->out(new IRCCommands::notify($user, $message));
[02:03] <amunak> yeah sounds great
[02:03] <NanoSector> or w/e
[02:04] <NanoSector> yeah
[02:04] <NanoSector> perhaps it's possible to integrate the server part into a module
[02:04] <NanoSector> so it's just plug and play
[02:04] <amunak> it should be
NanoSector commented 7 years ago

Removing the 3.0 milestone because this really is a module request and not a core feature.