Advanced Chat by LMD

A library for advanced chatting.

23 downloads

Advanced Chat (adv_chat)

One Mod to rule them all, One Mod to find them,
One Mod to bring them all, and in the darkness bind them

- adapted quote from "Lord of the Rings"

Adds roles, colors, unicode, hud notifications, and chat bridges (IRC & discord).

About

Help can be found under config_help.md in the same folder as this.

Depends on modlib. Modlib has been updated to add features required by this mod, so make sure to get the newest version. Backwards compatibility was kept as far as I know.

Code licensed under the GPLv3 (GNU Public License Version 3). Written by Lars Mueller alias LMD or appguru(eu).

Links

Setup

In order to properly use adv_chat, you'll have to meet the following prerequisites:

Then just install it like any other mod and enjoy your greatly improved chat experience!

Terminology

Chatter: Participant in chat, be it a Minetest player, IRC user, or Discord member
Role: "Group" of chatters
Targets/Mentions: Roles or chatters mentioned using @

Features

Changes

🎃 Halloween Update

API

HUD notifications

See hud_channels.lua for how it works and test.lua for a score change demo running with random values.

Votes

Have not been added and will probably not be added. This belongs somewhere else. There are already some vote mods out there. Will probably release a better one anyways.

IRC Bridge

If enabled, creates a bridge to an IRC channel. For more details see config_help.md.

Discord Bridge

If enabled, creates a bridge to a Discord guild channel. For more details see config_help.md. Note that you need to create your own OAuth application (bot) but can of course use the provided implementation.

More

See the code and config_help.md. Feel free to contact me.

How it works

Unicode support

This mod adds unicode support. Simply use the unicode codepoint in hexadecimal format prefixed by U+. To get a "slight smile" (🙂), you'd use U+1F642. Note that not all fonts fully support Unicode. Use the /chat say command to open a text entry field to paste text.

Real-time chat

Use @ at the beginning to message players or roles before your message. There are 3 special mentions : minetest, irc and discord. Can be separated by comma & whitespace. Examples:

Scheduled messages

Use the chatcommand /msg <playername> <message> to have playername receive a message as soon as they join. Examples :

IRC Bridge

Names of IRC users are suffixed with [irc]. A user singlechatter would be addressed as singlechatter[irc]. Global messages & messages using @irc will be sent to the entire channel. In order to write private messages yourself, use the common prefixes and send a private message to the bot. So if an IRC user singlechatter wanted to chat with singleplayer, they would have to send private messages to the bot prefixed with @singleplayer. On the other end, singleplayer would have to prefix messages with @singleplayer[irc].

Discord Bridge

Names of Discord users are suffixed with [discord]. A user singlechatter would be addressed as singlechatter[discord]. Messages without any mentions will be sent to the channel, publicly readable by any guild member, at any time. In order to write private messages yourself, use the common prefixes and send a direct message to the bot. So if an Discord user singlechatter wanted to chat with singleplayer, they would have to send direct messages to the bot prefixed with @singleplayer. On the other end, singleplayer would have to prefix messages with @singlechatter[discord]. Privileges are represented using roles. Summarized, the Discord Chat Bridge works quite similar to the IRC one, with some exceptions on when to send messages into the public channel.

Constraints

Making Minetest & IRC chat compatible with Discord required the introduction of restrictions to simplify and reduce confusion.

Internal process bridge protocol

I "developed" a simple protocol using files for communication between the processes. There are three files : Output, input and logs. After a process has read it's input, it deletes the content. The connected processes both run two threads, one for handling input, and the other for serving the output. It works message-based. Messages are delimited by newlines (linefeed, \n). They start with a message-type identifier wrapped in square brackets, followed by the parameters, delimited by spaces. Example : [PMS]singlechatter[irc] singleplayer Hi