Mods/IRC: Difference between revisions

From Minetest
>ROllerozxa
No edit summary
 
>ROllerozxa
No edit summary
(No difference)

Revision as of 13:29, 23 December 2022

IRC
Blank.png
A mod
Mod Type Server
Author kaeza
Latest version ?
Forum topic 3905
Source code Github
ContentDB N/A
Technical name irc

This mod lets you connect the chat between in-game and an arbitrary IRC channel via an IRC bot.

Installation

Requirements

This mod can run in any Minetest version (tested on 0.4.3 up to 0.4.10).

First of all, you will need to install the luasocket library. For example, on Debian-based distributions:

sudo apt-get install lua-socket

Installing using Git

First, the repo for the mod, then update the submodules:

cd /path/to/minetest/mods
git clone https://github.com/kaeza/minetest-irc.git irc
cd irc
git submodule update --init

This will clone the LuaIRC library required for the mod.

That's it! It should be ready to go, at least for testing if it works.

Installing from zip archives

Download the main mod from here, and LuaIRC from here.

Unzip minetest-irc-master.zip into your mods/ directory, and rename the resulting directory to just irc.

Unzip LuaIRC-master.zip into the mods/irc/ directory, and rename the resulting directory to just irc (so that you have mods/irc/irc/).

That's it! It should be ready to go, at least for testing if it works.

Configuration

Configuration for this mod is specified via minetest.conf.

The following options need to be specified for the mod to run:

# IRC server to connect to
irc.server = your.server.name.com

# Channel to connect the bot to
irc.channel = #your-channel

# Nickname for the bot
irc.nick = YourBotName

Basic configuration

irc.server

This is the server the bot will connect to.

irc.port

This is the port on the server the bot will connect to. Default is 6667 (standard IRC port).

irc.channel

This is the channel the bot will join upon connection.

irc.nick

This specifies the nickname of the bot.

irc.username

This specifies the username of the bot.

irc.realname

This specifies the realname of the bot.

irc.NSPass

Specifies the password to use to identify to NickServ. Default is empty, which means the bot will not be identified.
How to set up an account may vary between IRC networks. Consult the documentation for your IRC network for more information.

Advanced configuration

Please refer to config.lua in the mod's repository for all the available configuration settings.

Usage

Once you set up the mod and start the game server, your bot will connect to the specified IRC server and join the channel (see Basic configuration above).

Any text you say in-game will be seen on the channel, and any text sent to the channel will be seen in-game.

Chat commands

The mod adds some chat commands that can be invoked in-game:

/irc_connect

Requires irc_admin privilege.
Connects again to the IRC server. Used after using /irc_disconnect.

/irc_disconnect

Requires irc_admin privilege.
Disconnects from the IRC server.

/irc_reconnect

Requires irc_admin privilege.
Reconnects again to the IRC server. This is effectively the same as using /irc_disconnect followed by using /irc_connect.

/irc_part

Parts (leaves) the channel. Your messages will not be visible in the channel, and channel messages will not be visible to you.

/irc_join

Joins the channel. Your messages will be visible in the channel, and channel messages will be visible to you. This is the default.

/irc_quote <line>

Requires irc_admin privilege.
Send a line to the IRC server directly. This can be used to send arbitrary commands to the IRC server.
Example: /irc_quote PRIVMSG #thechannel :Hello!

/irc_msg <nickname> <message>

Requires shout privilege.
Send a private message to an user on IRC.
Example: /irc_msg OtherUser Hello!

/irc_names

List the people currently in the IRC channel.

In addition, it overrides the /me command to send the action to IRC.

Bot commands

The mod adds some bot commands that can be invoked from IRC. The commands can be invoked in two ways:

  • Write the name of the bot, followed by either a comma (',') or a colon (':'), followed by a space, and then the command. Example: RandomBot: uptime
  • Send the command directly to the bot as a private message. Example: /msg RandomBot uptime

If you communicate with the bot via the channel, it responds in the channel. If you communicate via PM, it responds privately.

help <command>

Prints help about a bot command.
Example: help uptime

list

Lists the available bot commands.

uptime

Outputs the amount of time the server has been up.

players

Outputs the names of the players currently in game.

whereis <name>

Outputs the location of the player named name.
Example: whereis JohnDoe

Other mods can register their own bot commands (see Application Programming Interface below).

Application Programming Interface

There's an API for other mods to use. Please refer to API.md in the mod distribution. (Note: the MarkDown view is currently broken).

Add-ons

This is a list of add-on mods that explicitly support IRC mod API:

Known issues

GNU/Linux

Many distributions install luasocket in a place that Minetest's builtin Lua library doesn't look in. The IRC mod adds some extra search paths, but it can't support esoteric configurations. This issue is manifested by Minetest exiting with the error "Failed to load and run .../irc/init.lua", complaining it can't find socket or core.so.

To fix this, you have a few options:

  • Use LuaJIT, which isn't bundled with Minetest and is correctly configured by the distro.
  • Create a symlink at /usr/local/lib/lua/5.1/socket pointing to /usr/i686-linux-gnu/lib/lua/5.1/socket.
  • Open irc/init.lua (not irc/irc/init.lua!), and add this line at the start:
ie.package.cpath = "/usr/i686-linux-gnu/lib/lua/5.1/?.so;"..ie.package.cpath

Replace "i686-linux-gnu" with your architecture if different. For example, Debian 8 requires:

ie.package.cpath = "/usr/lib/x86_64-linux-gnu/lua/5.1/?.so;"..ie.package.cpath