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).
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).
- GitHub - sources, issue tracking, contributing
- Discord - discussion, chatting
- Minetest Forum - (more organized) discussion
- ContentDB - releases (downloading from GitHub is recommended)
In order to properly use adv_chat
, you'll have to meet the following prerequisites:
modlib
Minetest mod installed and enabled as hard dependency and additionally alsocmdlib
(recommended)adv_chat
needs to be installed, enabled and added to the trusted mods in settings/minetest.conf
- LuaSocket should be installed (
sudo luarocks install luasocket
on Ubuntu) - Complete Java 8 or ideally newer installation under your system path (accessible from terminal via
java
)
Then just install it like any other mod and enjoy your greatly improved chat experience!
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 @
- Discord & IRC chat bridges, login & commands
- Blocking
- Colorization
- Style preservation
- Unicode
- Mentions
- HUD channels/notifications
- Scheduled messages for offline players
- Proper formatting support
- More configuration options
- Remote login for chatcommand execution
- Many under-the-hood changes cleaning up stuff & fixing bugs (improving the code & architecture)
- Merged
config_help.md
into the Readme - Adds
adv_chat.register_on_chat_message
which works much likeminetest.register_on_chat_message
- Adds basic logging (of global messages)
- Various fixes
- API additions
- Replaced deprecated
modlib
andcmdlib
calls
- Replaced
goto
s for increased compatibility
- Supports configuring case insensitive roles
- Removed outdated
config_help.md
- Fixes [
rolling-8
]
- Supports sending messages instead of embeds (discord bridge)
- Fixes
- Does not require disabling mod security anymore
- Fixes "attempt to perform arithmetic on field 'last_ping' (a nil value)" crash
See hud_channels.lua
for how it works and test.lua
for a score change demo running with random values.
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.
If enabled, creates a bridge to an IRC channel. For more details see the [Configuration].
If enabled, creates a bridge to a Discord guild channel. For more details see the [Configuration]. Note that you need to create your own OAuth application (bot) but can of course use the provided implementation.
See the code and [Configuration] options. Feel free to contact me.
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.
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:
@singleplayer hi, singleplayer !
- messagehi, singleplayer !
is sent to singleplayerlol(or whitespaces) @singleplayer hi
- message is just sent in global chat@singleplayer, secondplayer, a_role Hmm...
- messageHmm...
will be sent tosingleplayer
,secondplayer
and all players with the rolea_role
@a role message
- messagerole message
(!) will be sent to player/rolea
@p1, p2 , p4 lol
- messagelol
will be sent top1
,p2
,p3
Use the chatcommand /msg <playername> <message>
to have playername receive a message as soon as they join.
Examples :
/msg singleplayer hi
- when singleplayer rejoins, he is sent the message, even if he is already online.
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]
.
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.
Making Minetest & IRC chat compatible with Discord required the introduction of restrictions to simplify and reduce confusion.
- No double nicknames on Discord. If there are double nicknames, one of them gets an appendix, which is not guaranteed to be the same each time. So better make sure this doesn't happen.
- Spaces (
,
) in Discord nicknames are replaced by underscores (_
)
JSON Configuration: <worldpath>/config/adv_chat.json
Text Logs: <worldpath>/logs/adv_chat/<date>.json
Readme: <modpath/gamepath>/adv_chat/Readme.md
Located under <modpath/gamepath>/adv_chat/default_config.json
{
"schemes" : {
"minetest" : {"message_prefix": "", "message_suffix": "", "mention_prefix": "#FFFF00@", "mention_delim": "#FFFF00, ", "content_prefix": "#FFFF00: #FFFFFF"},
"other" : null
},
"bridges" : {
"discord" : null,
"irc" : null
},
"roles_case_insensitive": true
}
{
"schemes" : {
"minetest" : {"message_prefix": "Somebody - namely ", "mention_prefix": "#FFFF00 - wrote to ", "mention_delim": "#FFFF00 and ", "content_prefix": "#FFFF00: #FFFFFF", "message_suffix": " :D"},
"other" : null
},
"bridges" : {
"discord" : {"channelname":"allgemein", "prefix": "?", "minetest_prefix": "!", "token":"S.U.Pxxs.E.R.T.9998OKEN", "blacklist":{"~~new_role~~":true}, "guild_id": 580416319703351296, "send_embeds": true},
"irc" : {"channelname":"#mtchatbridgetest", "prefix": "?", "minetest_prefix": "!", "nickname": "MT_Chat_Bridge", "network": "irc.freenode.net", "port": 7000, "ssl": true}
}
}
Specifies the chat message format, minetest
is for the one used on the Minetest chat, irc
is IRC, and discord
for Discord.
message_prefix
- Prefix for the messagemention_prefix
- Prefix for mentionpart.mention_delim
- Mention delimiter.content_prefix
- Message/sendername delimiter.message_suffix
- Suffix for the message
If you want to use color escape sequences, type something like #66FF00 colorized text here
, and replace #66FF00
with your color of choice in hex format.
Messages are formatted as message_prefix + sendername + mention_prefix + {mentions, mention_delim} + delim + message + message_suffix
Configuration for IRC/Discord chat bridges. If irc
or discord
are set to false
or null
, the corresponding chat bridges aren't created.
Table with the following entries :
token
: Discord bot token, requiredchannelname
: Name of bridge channel, required as wellprefix
,minetest_prefix
: Prefixes for Discord/Minetest commands, requiredrole_blacklist
/role_whitelist
: Blacklist/whitelist of Discord roles. If both or none are set, Discord roles are ignored.guild_id
: Guild ID, string. If swines add your bot to other servers, force it to use the server with the specified Guild ID. Optional. If unset, bot will use the guild it joined first.bridge
: Optional. Forces type of process bridge to use. Choices are"file"
and"socket"
. Sockets are recommended but requireluasocket
.convert_internal_markdown
/convert_minetest_markdown
: Optional boolean. Whether Markdown sent from Minetest/internal chat messages should be left untouched as if it was Discord Markdownhandle_irc_styles
: Optional string. How IRC styles should be converted to Discord Markdown. Possible values:"disabled"
,"escape_markdown"
and"convert"
strip_discord_markdown_in_minetest
: Optional boolean. Whether Discord Markdown should be stripped from Minetest chat.send_embeds
: Optional boolean, whether the bot should send embeds or messages.
Example :
{
"discord": {
"prefix": "?",
"minetest_prefix": "!",
"token": "Ao.663438supers.76trange8343",
"channelname": "ingame-chat",
"blacklist":{"~~new_role~~":true},
"guild_id": "580416319703351296"
}
}
Table with fields. Required are:
network
: IRC network, for exampleirc.freenode.net
port
: Port, on Freenode it would be7000
if SSL is used, or else6667
. Just google "connecting to network" for your IRC network of choice to get detailed information.ssl
: Whether to use encryption (SSL) to communicate with the IRC network. Setting this totrue
is recommended.nickname
: Bot nicknamechannelname
: IRC channel name, for example#minetest-server
prefix
,minetest_prefix
: Prefixes for IRC bot/Minetest chatcommands, required
Optional fields are:
bridge
: Type of process bridge to use can be forced here. Choices are"file"
and"socket"
. Sockets are recommended but requireluasocket
.convert_minetest_colors
: How colors from Minetest chat messages should be converted to IRC. Possible values are"disabled"
,"safest"
,"safe"
and"hex_safe"
and"hex"
handle_internal_markdown
: How Markdown sent from internal MT should be converted to IRC text styles. Possible values are"disabled"
,"strip"
and"convert"
handle_minetest_markdown
: How Markdown sent from Minetest should be converted to IRC text styles. Possible values are"disabled"
,"strip"
and"convert"
handle_discord_markdown
: How Markdown sent from Discord should be converted to IRC text styles. Possible values are"disabled"
,"strip"
and"convert"
Example:
{
"irc": {
"prefix": "?",
"minetest_prefix": "!",
"channelname": "#minetest-server",
"nickname": "SERVERNAME_Chat",
"port": 7000,
"ssl": true,
"network": "irc.freenode.net"
}
}
Whitelist/blacklist of chatcommands which are not available from Discord or IRC. If both or none are set, all chatcommands are blacklisted.
It is recommended to keep consistency. To do so, channel & chat bot names could be similar across Discord and IRC. The same goes for prefixes.
You should try to keep prefixes similar and memorable, while ensuring that there are no collisions. I recommend the combination of ?
for Discord/IRC commands and !
for Minetest commands.
Other neat combinations I have thought of are +
and -
, or ;
and :
. Keep in mind that prefixes should be easy to type as well, and that others might have a different keyboard layout.
Pixel-art Minetest skin heads always work well as avatars. For an example look you could look at my Robby-Head. There are tons of skins out there and it's fairly easy to extract the faces (but make sure you don't violate the licenses when using the images). A good starting point is Addis Open MT-Skin Database. You can, however, of course also design it yourself. Just grab your favorite pixel-art program and draw a 8x8 head. You should also make sure to scale the small image up (to at least 256x256), because else Discord scales it up "for you" which makes it lose it's sharp edges.
Only two basic hints : Always enable SSL, and don't give your bot token to anyone. And of course make sure your server isn't hacked. Messages are sent as plain text over the sockets or file bridges.
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