[Mod] ChatCmdBuilder [0.1.1][chatcmdbuilder] - No regex!

User avatar
rubenwardy
Moderator
 
Posts: 5541
Joined: Tue Jun 12, 2012 18:11
Location: United Kingdom
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

[Mod] ChatCmdBuilder [0.1.1][chatcmdbuilder] - No regex!

by rubenwardy » Mon Jun 13, 2016 21:09

Easily create complex chat commands with no regex.

Thank you to Sobralia for the inspiration.

License: MIT
Github: https://github.com/rubenwardy/ChatCmdBuilder
Download: https://github.com/rubenwardy/ChatCmdBu ... master.zip

See README.md for more documentation.

Code: Select all
ChatCmdBuilder.new("admin", function(cmd)
   cmd:sub("kill :target", function(name, target)
      local player = minetest.get_player_by_name(target)
      if player then
         player:set_hp(0)
         return true, "Killed " .. target
      else
         return false, "Unable to find " .. target
      end
   end)

   cmd:sub("move :target to :pos:pos", function(name, target, pos)
      local player = minetest.get_player_by_name(target)
      if player then
         player:setpos(pos)
         return true, "Moved " .. target .. " to " .. minetest.pos_to_string(pos)
      else
         return false, "Unable to find " .. target
      end
   end)
end, {
   description = "Admin tools",
   privs = {
      kick = true,
      ban = true
   }
})


A player could then do /admin kill player1 to kill player1, or /admin move player1 to 0,0,0 to teleport a user.
Last edited by rubenwardy on Sun Jul 23, 2017 23:35, edited 3 times in total.
 

User avatar
ynong123
Member
 
Posts: 20
Joined: Fri Mar 11, 2016 13:24
Location: Malaysia
GitHub: ynong123
IRC: ynong123
In-game: ynong123

Re: [Mod] ChatCmdBuilder [0.1] - Complex cmds with no regex

by ynong123 » Sun Jul 17, 2016 00:32

Nice work! I like your mod. I think others will like it too.
Take a look of my mods:
Password Chest
Color Decoration Block
Trapplus

Forgive me for my bad English.
 

User avatar
SonosFuer
Member
 
Posts: 104
Joined: Sun Jul 09, 2017 00:32
GitHub: apachano
IRC: SonosFuer
In-game: SonosFuer

Re: [Mod] ChatCmdBuilder [0.1][chatcmdbuilder] - No regex!

by SonosFuer » Sun Jul 23, 2017 23:21

I think upgrading the chat command api in the engine to include this by default would be cool.
Working on a content database for minetest mods, servers, and etc Check it out and give me feedback at https://forum.minetest.net/viewtopic.php?f=14&t=18137
 

User avatar
rubenwardy
Moderator
 
Posts: 5541
Joined: Tue Jun 12, 2012 18:11
Location: United Kingdom
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

Re: [Mod] ChatCmdBuilder [0.1.1][chatcmdbuilder] - No regex!

by rubenwardy » Sun Jul 23, 2017 23:39

Would be cool! Needs more stability and auto generation of documentation first.

also:

0.1.1 released!



Match command until EOS (fixes /foo bar matching when /foo bar baz is provided)
Fix bug in pattern matching
Fix invalid ChatCmdBuilder call, fix invalid mod name
Add metadata, change license
Make ChatCmdBuilder global
Only run func if func is defined
Allow calling sub after originally creating chatcmd
 


Return to Mod Releases



Who is online

Users browsing this forum: No registered users and 4 guests