ad-hoc in-chat commands

Maciej Bursztynowski
Added over 5 years ago


I don't know but probably it's good forum, if not - please move it to good one.

I'm not good in scripting but if there is no such component or something I would try to do it on myself with a little bit of help ;)

I want to use/create some scripts which could be used in any chat window.

what I need, for example:

  1. typing in chat window "/status" to buddy1@myserver

  2. message recieved by XMPP Server and not send to reciver

  3. answer from XMPP server in chat window "System load: 0.01 0.03 0.03"

Is it possible to create such messages ?

Replies (4)


Added by Artur Hefczyc TigaseTeam over 5 years ago

There is a way, undocumented because this is our experimental code.

You have to activate StanzaReceiver component. Once it is working, use Psi client, connect as an admin and browse service discovery.

Expand StanzaReceived component on the service discovery and there will be: Tasks management commands*. Click on Add new task.... Then you get a new window with 2 fields: *Task name: and Task type". Enter 'monitor' as the task name and select 'System Monitor' as the task type. Press *Next" and you should get a new window. The new window will have several fields. I suggest unchecking N270Monitor and LogMonitor, rest of fields leave as they are.

Once you press finish it is done. A new contact should be added automatically to your roster but I have just tested it and for some reason it is not automatic. So, close the service discovery window and open it again. Expand Stanza Receiver component and you should get a new item on it: System Monitor Task. Write down JID of the item and add it to your roster. Once it is there, open a chat window and send a message:


It should reply back with all commands available. It should also send you warnings automatically in case of high CPU or memory usage.

I hope this works for you and helps.

For the final 5.2.0 we plan to add this monitors as a non-experimental and easy to use function.

Added by Maciej Bursztynowski over 5 years ago

Thanks for your reply. It's not exactly what I'm talking about, but still it will be useful. Maybe my question wasn't precised.

sample scenario:

I'm chatting with my co-worker, and we are talking about upcoming meeting, and I want to check if the meeting room is free now. That information is stored in file or mysql database, whatever. It's better to check it fast in chat window, than on intranet. So I'd like to have possibility to type for example "/meeting_room" and get message "Meeting room is: free" - information contained in file or in database.

Chat e.g.:

[09:47:20] What about this meeting today?

[09:47:54] It's starting in 1 hour. I think we should prepare the meeting room

[09:49:07] /meeting_room

*[09:49:08] * Meeting room is: occupied **

[09:49:10] Unfortunately, It's not free yet.

[09:49:30] Check it in 5.

[09:49:33] Ok

[09:54:01] /meeting_room

*[09:54:02] * Meeting room is: free **

[09:54:06] Ok, lets go. It's free now. See you

[09:55:01] I'll be in 10

That's what I'm trying to get.


Added by Artur Hefczyc TigaseTeam over 5 years ago

Then I would suggest to implement a new plugin for processing messages. This plugin would intercept such commands, process them and send data in response. This is probably the best way to have this on 1-1 chat.

However, most ppl/companies do it in a different way. They create a bot which can either connect to a MUC room and can provide some information when requested (quite popular on IRC). There are a few such projects for XMPP available. But this is only for MUC, so you would have to have something like a company MUC room with ppl hanging out on it and the bot on it. You would have to change a chat window to MUC to get the info.

Alternatively the bot could be in your roster so you could send him a message with your question.

The bot solution is kind of more flexible, you do not have to play with Tigase API, load code into the Tigase, so the bot can be easily developed and updated. You can also use any language and technology to implement it.

Added by Maciej Bursztynowski over 5 years ago

Thanks for reply.

Yesterday I've implemented bot with my own commands. It's ok now. First idea was enfoced by my boss, but plans has changed ;)

Bot solution is good for now and easier. Using python I was able to write bot which do what was needed.

Thanks a lot for your interest.