Browse Source

Update COMMANDS.md

master
sfan5 2 years ago
parent
commit
6507466a31
  1. 112
      COMMANDS.md
  2. 8
      server.py
  3. 20
      shortutils.py

112
COMMANDS.md

@ -1,83 +1,81 @@
Commands
========
Required arguments are enclosed in { and }, optional arguments are enclosed in [ and ]
Required arguments are enclosed in < and >, optional arguments are enclosed in [ and ]
<i>$botname</i> refers to the name of the IRC bot, e.g. MinetestBot
<table>
<tr> <th>Command</th> <th>Description</th> <th>Usable by</th> </tr>
<tr> <th>Command</th> <th>Description</th> <th>Restrictions</th> </tr>
<tr> <td><b>admin.py</b></td> <td></td> <td></td> </tr>
<tr> <td>!join {channel} [channel-key]</td> <td>Join the specified channel</td> <td><i>Admins</i></td> </tr>
<tr> <td>!part {channel}</td> <td>Leave the specified channel</td> <td><i>Admins</i></td> </tr>
<tr> <td>!quit</td> <td>Disconnect from IRC Server</td> <td><b>Owner</b></td> </tr>
<tr> <td><i>$botname</i>: quit</td> <td>Disconnect from IRC Server</td> <td><b>Owner</b></td> </tr>
<tr> <td>!msg {channel/user} {message}</td> <td>Send message to channel/user</td> <td><i>Admins</i></td> </tr>
<tr> <td>!me {channel/user} {message}</td> <td>Send action to channel/user</td> <td><i>Admins</i></td> </tr>
<tr> <td>!join &lt;channel&gt; [key]</td> <td>Join the specified channel</td> <td>Admin-only</td> </tr>
<tr> <td>!part &lt;channel&gt;</td> <td>Leave the specified channel</td> <td>Admin-only</td> </tr>
<tr> <td>!quit</td> <td>Disconnect from IRC server</td> <td>Owner-only</td> </tr>
<tr> <td><i>$botname</i>: quit</td> <td>Disconnect from IRC server</td> <td>Owner-only</td> </tr>
<tr> <td>!msg &lt;channel/user&gt; &lt;message&gt;</td><td>Send message to channel or user</td> <td>Admin-only</td> </tr>
<tr> <td>!me &lt;channel/user&gt; &lt;message&gt;</td><td>Send action to channel or user</td> <td>Admin-only</td> </tr>
<tr> <td><b>antiabuse.py</b></td> <td></td> <td></td> </tr>
<tr> <td>!ignore {user}</td> <td>Add user to ignore list</td> <td><i>Admins</i></td> </tr>
<tr> <td>!unignore {user}</td> <td>Remove user from ignore list</td> <td><i>Admins</i></td> </tr>
<tr> <td>!listignore</td> <td>List all ignored users</td> <td><i>Admins</i></td> </tr>
<tr> <td>!ignore &lt;user&gt;</td> <td>Add user to ignore list</td> <td>Admin-only</td> </tr>
<tr> <td>!unignore &lt;user&gt;</td> <td>Remove user from ignore list</td> <td>Admin-only</td> </tr>
<tr> <td>!listignore</td> <td>List all ignored users</td> <td>Admin-only</td> </tr>
<tr> <td><b>calc.py</b></td> <td></td> <td></td> </tr>
<tr> <td>!c {expression}</td> <td>Calculate expression</td> <td>Anyone</td> </tr>
<tr> <td>!c &lt;expression&gt;</td> <td>Calculate expression</td> <td></td> </tr>
<tr> <td><b>chop.py</b></td> <td></td> <td></td> </tr>
<tr> <td>!op [nick] ...</td> <td>Op nick</td> <td><i>Admins</i></td> </tr>
<tr> <td>!deop [nick] ...</td> <td>DeOp nick</td> <td><i>Admins</i></td> </tr>
<tr> <td>!voice [nick] ...</td> <td>Voice nick</td> <td><i>Admins</i></td> </tr>
<tr> <td>!devoice [nick] ...</td> <td>DeVoice nick</td> <td><i>Admins</i></td> </tr>
<tr> <td>!ban {nick/mask} [nick/mask] ...</td> <td>Ban nick/mask</td> <td><i>Admins</i></td> </tr>
<tr> <td>!unban {nick/mask} [nick/mask] ...</td> <td>UnBan nick/mask</td> <td><i>Admins</i></td> </tr>
<tr> <td>!mute {nick/mask} [nick/mask] ...</td> <td>Mute nick/mask</td> <td><i>Admins</i></td> </tr>
<tr> <td>!unmute {nick/mask} [nick/mask]...</td> <td>UnMute nick/mask</td> <td><i>Admins</i></td> </tr>
<tr> <td>!kick {nick} [message]</td> <td>Kick nick with message</td> <td><i>Admins</i></td> </tr>
<tr> <td>!op [nick] ...</td> <td>Op nick (or yourself)</td> <td>Admin-only</td> </tr>
<tr> <td>!deop [nick] ...</td> <td>Deop nick (or yourself)</td> <td>Admin-only</td> </tr>
<tr> <td>!voice [nick] ...</td> <td>Voice nick (or yourself)</td> <td>Admin-only</td> </tr>
<tr> <td>!devoice [nick] ...</td> <td>Devoice nick (or yourself)</td> <td>Admin-only</td> </tr>
<tr> <td>!ban &lt;nick/mask&gt; ...</td> <td>Ban nick or mask</td> <td>Admin-only</td> </tr>
<tr> <td>!unban &lt;nick/mask&gt; ...</td> <td>Unban nick or mask</td> <td>Admin-only</td> </tr>
<tr> <td>!mute &lt;nick/mask&gt; ...</td> <td>Mute nick or mask</td> <td>Admin-only</td> </tr>
<tr> <td>!unmute &lt;nick/mask&gt; ...</td> <td>Unmute nick or mask</td> <td>Admin-only</td> </tr>
<tr> <td>!kick &lt;nick&gt; [message]</td> <td>Kick nick with message</td> <td>Admin-only</td> </tr>
<tr> <td><b>ping.py</b></td> <td></td> <td></td> </tr>
<tr> <td>(hi|hello|hey) <i>$botname</i></td> <td>Reply with (Hi|Hello|Hey)( |!)</td> <td>Anyone</td> </tr>
<tr> <td>(hi|hello|hey) <i>$botname</i></td> <td>Reply with (Hi|Hello|Hey)( |!)</td> <td></td> </tr>
<tr> <td><b>reload.py</b></td> <td></td> <td></td> </tr>
<tr> <td><i>$botname</i>: reload {module}</td> <td>Reloads specified module</td> <td><i>Admins</i></td> </tr>
<tr> <td><i>$botname</i>: reload &lt;module&gt;</td><td>Reloads specified module</td> <td>Admin-only</td> </tr>
<tr> <td><b>rutils.py</b></td> <td></td> <td></td> </tr>
<tr> <td>!rev {string}</td> <td>Reverse String</td> <td>Anyone</td> </tr>
<tr> <td>!b64e {string}</td> <td>Base64-encode a string</td> <td>Anyone</td> </tr>
<tr> <td>!b64d {string}</td> <td>Base64-decode a string</td> <td>Anyone</td> </tr>
<tr> <td>!rand [min] {max}</td> <td>Says a random number between(incl.) min and max</td> <td>Anyone</td> </tr>
<tr> <td>!rev &lt;string&gt;</td> <td>Reverse String</td> <td></td> </tr>
<tr> <td>!b64e &lt;string&gt;</td> <td>Base64-encode a string</td> <td></td> </tr>
<tr> <td>!b64d &lt;string&gt;</td> <td>Base64-decode a string</td> <td></td> </tr>
<tr> <td>!rand [min] &lt;max&gt;</td> <td>Get a random number inside [min, max]</td> <td></td> </tr>
<tr> <td><b>seen.py</b></td> <td></td> <td></td> </tr>
<tr> <td>!seen {person}</td> <td>Reports when person was last seen</td> <td>Anyone</td> </tr>
<tr> <td>!seen &lt;person&gt;</td> <td>Reports when person was last seen</td> <td></td> </tr>
<tr> <td><b>server.py</b></td> <td></td> <td></td> </tr>
<tr> <td>!server [query] [query] ...</td> <td>Search servers at servers.minetest.net</td> <td>Anyone</td> </tr>
<tr> <td></td> <td>addr:{string} searches in Address</td> <td></td> </tr>
<tr> <td></td> <td>name:{string} searches in Server name</td> <td></td> </tr>
<tr> <td></td> <td>players:{modifier} uses Player count</td> <td></td> </tr>
<tr> <td></td> <td>- most finds servers with most players</td> <td></td> </tr>
<tr> <td></td> <td>- least finds servers with least players</td> <td></td> </tr>
<tr> <td></td> <td>- >{number} finds servers with players > x</td> <td></td> </tr>
<tr> <td></td> <td>- &lt;{num} finds servers with players &lt; x</td> <td></td> </tr>
<tr> <td></td> <td>- [=]{number} finds servers with x players</td> <td></td> </tr>
<tr> <td></td> <td>- !{number} finds servers with not x players</td> <td></td> </tr>
<tr> <td></td> <td>ping:{modifier} uses Player count</td> <td></td> </tr>
<tr> <td>!server [query] ...</td> <td>Search servers from servers.minetest.net</td> <td></td> </tr>
<tr> <td></td> <td><code>addr:&lt;string&gt;</code> searches in Address</td><td></td> </tr>
<tr> <td></td> <td><code>name:&lt;string&gt;</code> searches in Server name</td><td></td> </tr>
<tr> <td></td> <td><code>players:&lt;modifier&gt;</code> uses Player count</td><td></td> </tr>
<tr> <td></td> <td>- most servers with most players</td> <td></td> </tr>
<tr> <td></td> <td>- least servers with least players</td> <td></td> </tr>
<tr> <td></td> <td>- &gt;N servers with less than N players</td> <td></td> </tr>
<tr> <td></td> <td>- &lt;N servers with more than N players</td> <td></td> </tr>
<tr> <td></td> <td>- [=]N servers with exactly N players</td> <td></td> </tr>
<tr> <td></td> <td><code>ping:&lt;modifier&gt;</code> uses Ping</td> <td></td> </tr>
<tr> <td></td> <td>- same modifiers as players:</td> <td></td> </tr>
<tr> <td></td> <td>port:{modifier} uses Port</td> <td></td> </tr>
<tr> <td></td> <td><code>port:&lt;modifier&gt;</code> uses Port</td> <td></td> </tr>
<tr> <td></td> <td>- same modifiers as players:</td> <td></td> </tr>
<tr> <td></td> <td>i:{number/'last'} return Server no. x</td> <td></td> </tr>
<tr> <td></td> <td>random pick random entry from results</td> <td></td> </tr>
<tr> <td></td> <td><code>i:N/last</code> return server at index N</td> <td></td> </tr>
<tr> <td></td> <td><code>random</code> pick random server (default)</td><td></td> </tr>
<tr> <td><b>serverup.py</b></td> <td></td> <td></td> </tr>
<tr> <td>!up {IP/hostname} [port]</td> <td>Check if server at IP/hostname is up</td> <td>Anyone</td> </tr>
<tr> <td></td> <td>Supports multiple Ports e.g. 123-456,999</td> <td></td> </tr>
<tr> <td>!up &lt;IP/hostname&gt; [port]</td> <td>Check if Minetest server is responding</td> <td></td> </tr>
<tr> <td><b>title.py</b></td> <td></td> <td></td> </tr>
<tr> <td>!title [link]</td> <td>Query Page Title</td> <td>Anyone</td> </tr>
<tr> <td>!title [link]</td> <td>Get page title of given URL (or last seen)</td> <td></td> </tr>
<tr> <td><b>wiki.py</b></td> <td></td> <td></td> </tr>
<tr> <td>!wik {term}</td> <td>Query wiki.minetest.com for term</td> <td>Anyone</td> </tr>
<tr> <td>!wik &lt;term&gt;</td> <td>Query wiki.minetest.net for term</td> <td></td> </tr>
<tr> <td><b>devwiki.py</b></td> <td></td> <td></td> </tr>
<tr> <td>!dev {term}</td> <td>Query dev.minetest.net for term</td> <td>Anyone</td> </tr>
<tr> <td>!dev &lt;term&gt;</td> <td>Query dev.minetest.net for term</td> <td></td> </tr>
<tr> <td><b>shortutils.py</b></td> <td></td> <td></td> </tr>
<tr> <td>!rtfm [nick]</td> <td>Give links to wiki and dev wiki</td> <td>Anyone</td> </tr>
<tr> <td>!questions [nick]</td> <td>Link to ESR's "How to ask smart questions"</td> <td>Anyone</td> </tr>
<tr> <td>!next</td> <td>Say: "Another satisfied customer. Next!"</td> <td>Anyone</td> </tr>
<tr> <td>!pil [nick]</td> <td>Link to Lua PIL</td> <td>Anyone</td> </tr>
<tr> <td>!git [nick]</td> <td>Link to Git manual</td> <td>Anyone</td> </tr>
<tr> <td>!api [nick]</td> <td>Link to API docs</td> <td>Anyone</td> </tr>
<tr> <td>!btc [currency]</td> <td>Get Bitcoin price for specified currency</td> <td>Anyone</td> </tr>
<tr> <td>!rtfm [nick]</td> <td>Give links to wiki and dev wiki</td> <td></td> </tr>
<tr> <td>!questions [nick]</td> <td>Link to ESR's "How to ask smart questions"</td> <td></td> </tr>
<tr> <td>!next</td> <td>Say: "Another satisfied customer. Next!"</td> <td></td> </tr>
<tr> <td>!pil [nick]</td> <td>Link to Lua PIL and manual</td> <td></td> </tr>
<tr> <td>!git [nick]</td> <td>Link to Git manual</td> <td></td> </tr>
<tr> <td>!api [nick]</td> <td>Link to API docs</td> <td></td> </tr>
<tr> <td>!btc [currency]</td> <td>Get Bitcoin price for specified currency</td> <td></td> </tr>
<tr> <td><b>tell.py</b></td> <td></td> <td></td> </tr>
<tr> <td>!tell {nick} {message}</td> <td>Tell somebody a message</td> <td>Anyone</td> </tr>
<tr> <td>!tell &lt;nick&gt; &lt;message&gt;</td> <td>Tell somebody a message</td> <td></td> </tr>
<tr> <td><b>modsearch.py</b></td> <td></td> <td></td> </tr>
<tr> <td>!mod {modname}</td> <td>Searches for a mod</td> <td>Anyone</td> </tr>
<tr> <td>!mod &lt;modname&gt;</td> <td>Searches for a mod</td> <td></td> </tr>
<tr> <td><b>booksearch.py</b></td> <td></td> <td></td> </tr>
<tr> <td>!book {term}</td> <td>Searches for a chapter/page in the modding book</td> <td>Anyone</td> </tr>
<tr> <td>!book &lt;term&gt;</td> <td>Searches for a chapter/page in the modding book</td> <td></td> </tr>
</table>

8
server.py

@ -53,14 +53,6 @@ def create_intcompare(name, most_least=True):
if tbl[i][name] < ranking[0]:
ranking = (tbl[i][name], i)
results.append(ranking[1])
elif arg.startswith("!"): # not comparing
try:
nu = float(arg[1:])
except:
return []
for i in range(0, len(tbl)):
if int(tbl[i][name]) != nu:
results.append(i)
else:
if arg.startswith("="): # support "3" and "=3"
arg = arg[1:]

20
shortutils.py

@ -25,10 +25,10 @@ def make_cmd(cmd, txt):
m.commands = [cmd]
return m
rtfm = make_cmd("rtfm", "someone thinks you should read the manual. The development wiki is at http://dev.minetest.net, the regular wiki is at http://wiki.minetest.net.")
rtfm = make_cmd("rtfm", "someone thinks you should read the manual. The development wiki is at http://dev.minetest.net, the regular wiki is at http://wiki.minetest.net")
questions = make_cmd("questions", "someone thinks that your question is inaccurate or doesn't follow the guidelines. Read the guidelines here: http://catb.org/~esr/faqs/smart-questions.html")
pil = make_cmd("pil", "someone thinks you need to brush up on or learn Lua, please go to: http://lua.org/pil/")
git = make_cmd("git", "someone thinks you need to brush up on or learn Git, please go to: http://git-scm.com/book/")
pil = make_cmd("pil", "someone thinks you need to brush up on or learn Lua, please read https://www.lua.org/pil/contents.html or https://www.lua.org/manual/5.1/")
git = make_cmd("git", "someone thinks you need to brush up on or learn Git, please go to: https://git-scm.com/book/")
stfu = make_cmd("stfu", "someone thinks you need to shut the fuck up before you get muted.")
api = make_cmd("api", "someone thinks you should read the API docs, please go to: https://github.com/minetest/minetest/blob/master/doc/lua_api.txt")
@ -152,31 +152,29 @@ def btc(phenny, input):
currency = 'USD'
if not currency in data.keys():
return phenny.reply('Unknown currency. Supported currencies: ' + ', '.join(data.keys()))
phenny.say('1 BTC = %.4f %s' % (data[currency]['15m'], data[currency]['symbol']))
phenny.say('1 BTC = %.2f %s' % (data[currency]['15m'], data[currency]['symbol']))
btc.commands = ['btc']
def resolve_generators(arr):
out = []
generator = type(_ for _ in [])
for e in arr:
if type(e) == generator:
if type(e) == str:
out.append(e)
else:
for ee in e:
out.append(ee)
else:
out.append(e)
return out
def combine(phenny, input):
if not input.group(2): return
combiners = [
combiners = resolve_generators([
(chr(n) for n in range(0x0300, 0x034e + 1)),
(chr(n) for n in range(0x0350, 0x0362 + 1)),
(chr(n) for n in range(0x1dc0, 0x1dca + 1)),
"\u1dfe", "\u1dff",
(chr(n) for n in range(0xfe20, 0xfe23 + 1)),
]
combiners = resolve_generators(combiners)
])
o = input.group(2)[0]
for char in input.group(2)[1:]:
o += random.choice(combiners) + char

Loading…
Cancel
Save