139 lines
4.0 KiB
Plaintext
139 lines
4.0 KiB
Plaintext
API for smart_chat
|
|
|
|
The smart_chat is mod, which works with modules. So you only have to take the module cmd_pattern,
|
|
fill it with your code and add a dofile(path .. "/cmd_your_cool_command.lua") in the init.lua.
|
|
|
|
When you fill out the part for the help-system in the pattern, it integrates automatically in the helpsystem of smart_chat.
|
|
|
|
Methods:
|
|
|
|
|
|
void smart_chat.channel_report(string channel, string message)
|
|
Send's the message to all player in channel as report. For example, the player leaves the channel.
|
|
|
|
|
|
boolean smart_chat.check_channel(string, player, string channel)
|
|
Checks, if the player is in the channel.
|
|
True, the player is in channel, false, the player is in another channel.
|
|
|
|
|
|
boolean smart_chat.check_global(string player)
|
|
Checks, if the player is in a channel or in the public chat.
|
|
True, the player is in public chat, false, the player is in a channel.
|
|
|
|
|
|
integer smart_chat.is_channeladmin(string playername)
|
|
Checks the status of playername, if the player is a admin, the you get 20 as power back.
|
|
Else you get 0 as power back.
|
|
|
|
|
|
integer smart_chat.is_channelmod(string playername)
|
|
Checks the status of playername, if the player is a moderator, then you get 10 as power back.
|
|
Else you get 0 as power back.
|
|
|
|
|
|
void smart_chat.print(string player, string message)
|
|
Prints a message to the player. You can use the colorcodes too.
|
|
|
|
|
|
void smart_chat.register_help(table entry)
|
|
Adds the entry to the integrated Helpsystem.
|
|
|
|
|
|
void smart_chat.report(string playername, string message)
|
|
You send a report to the channel, where you are. For example: playername invites player in the channel.
|
|
|
|
|
|
table smart_chat.split(string parameter)
|
|
Splits your string into individual words. A space works as separator.
|
|
The function give you a table with the words back.
|
|
|
|
void receive_from_irc()
|
|
Receives a Line from the IRC and prints it, if it was from an user on the irc, on the chat in Minetest.
|
|
|
|
void send_2_irc(string playername, string text)
|
|
Sends text to the IRC.
|
|
|
|
void connect()
|
|
Connects to the IRC.
|
|
|
|
Tables:
|
|
|
|
Help-Entry:
|
|
|
|
Name = Name of the command.
|
|
Usage = Short description, how to use the command.
|
|
Description = Fully Description of the command.
|
|
Parameter = "" if there are no parameter, else short description for the typ of parameter.
|
|
Shortcut = name of a shortcut of the command, like "/c a" for "/c all"
|
|
|
|
|
|
Variables:
|
|
|
|
|
|
string smart_chat.modname
|
|
Name of the mod.
|
|
|
|
|
|
string smart_chat.modpath
|
|
Path of the mod.
|
|
|
|
|
|
integer smart_chat.version
|
|
Version of smart_chat.
|
|
|
|
|
|
string smart_chat.last_command
|
|
Last command of chat.
|
|
|
|
|
|
function smart_chat.S
|
|
Boilerplate for translation.
|
|
|
|
|
|
table smart_chat.player[string Name] = string channelname
|
|
This array of playernames stores for each player the Channelname. Nil when the player is in the public chat.
|
|
|
|
|
|
table smart_chat.permchannel[string channelname]
|
|
This array holds the permanent channels.
|
|
|
|
|
|
table smart_chat.helpsystem[Help-Entry]
|
|
Stores the entries for the helpsystem of smart_chat.
|
|
|
|
|
|
table smart_chat.registered_commands[function]
|
|
Stores the command, which you can use about /c ..
|
|
|
|
|
|
Colors of smart_chat:
|
|
|
|
The smart_chat provides some colors for your messages and use it for reports or error-messages.
|
|
The colors are escape-sequences of minetest.
|
|
|
|
|
|
smart_chat.black
|
|
smart_chat.blue
|
|
smart_chat.green
|
|
smart_chat.grey
|
|
smart_chat.light_blue
|
|
smart_chat.light_green
|
|
smart_chat.light_red
|
|
smart_chat.orange
|
|
smart_chat.pink
|
|
smart_chat.purple
|
|
smart_chat.red
|
|
smart_chat.white
|
|
smart_chat.yellow
|
|
|
|
Network of Smart_chat:
|
|
Smart_chat has now the ability to connect to an IRC-Server, log in with an given name and join to an given channel.
|
|
At a Ping from the IRC, Smart_chat anwers automatically with a Pong. You can see then the members of the IRC in
|
|
your Minetest that they write: Name@IRC. On the other side, a player of your world will answer with: Name@Worldname.
|
|
And you can switch on or off your Network, if you dont need this kind of network.
|
|
The settings, you can find it at Settingtypes.txt.
|
|
|
|
Important for Admins:
|
|
You have to install the LUA-Socket in your System, for running the irc on your server.
|