From 6507466a318aa0ae14d29c8a535dd005af3fed66 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Tue, 18 Feb 2020 19:22:42 +0100 Subject: [PATCH] Update COMMANDS.md --- COMMANDS.md | 112 +++++++++++++++++++++++++------------------------- server.py | 8 ---- shortutils.py | 20 ++++----- 3 files changed, 64 insertions(+), 76 deletions(-) diff --git a/COMMANDS.md b/COMMANDS.md index 2c9b776..b221d22 100644 --- a/COMMANDS.md +++ b/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 ] $botname refers to the name of the IRC bot, e.g. MinetestBot - + - - - - - - + + + + + + - - - + + + - + - - - - - - - - - + + + + + + + + + - + - + - - - - + + + + - + - - - - - - - - - - - + + + + + + + + + + - + - - + + - - + - + - + - + - - - - - - - + + + + + + + - + - + - +
Command Description Usable by
Command Description Restrictions
admin.py
!join {channel} [channel-key] Join the specified channel Admins
!part {channel} Leave the specified channel Admins
!quit Disconnect from IRC Server Owner
$botname: quit Disconnect from IRC Server Owner
!msg {channel/user} {message} Send message to channel/user Admins
!me {channel/user} {message} Send action to channel/user Admins
!join <channel> [key] Join the specified channel Admin-only
!part <channel> Leave the specified channel Admin-only
!quit Disconnect from IRC server Owner-only
$botname: quit Disconnect from IRC server Owner-only
!msg <channel/user> <message>Send message to channel or user Admin-only
!me <channel/user> <message>Send action to channel or user Admin-only
antiabuse.py
!ignore {user} Add user to ignore list Admins
!unignore {user} Remove user from ignore list Admins
!listignore List all ignored users Admins
!ignore <user> Add user to ignore list Admin-only
!unignore <user> Remove user from ignore list Admin-only
!listignore List all ignored users Admin-only
calc.py
!c {expression} Calculate expression Anyone
!c <expression> Calculate expression
chop.py
!op [nick] ... Op nick Admins
!deop [nick] ... DeOp nick Admins
!voice [nick] ... Voice nick Admins
!devoice [nick] ... DeVoice nick Admins
!ban {nick/mask} [nick/mask] ... Ban nick/mask Admins
!unban {nick/mask} [nick/mask] ... UnBan nick/mask Admins
!mute {nick/mask} [nick/mask] ... Mute nick/mask Admins
!unmute {nick/mask} [nick/mask]... UnMute nick/mask Admins
!kick {nick} [message] Kick nick with message Admins
!op [nick] ... Op nick (or yourself) Admin-only
!deop [nick] ... Deop nick (or yourself) Admin-only
!voice [nick] ... Voice nick (or yourself) Admin-only
!devoice [nick] ... Devoice nick (or yourself) Admin-only
!ban <nick/mask> ... Ban nick or mask Admin-only
!unban <nick/mask> ... Unban nick or mask Admin-only
!mute <nick/mask> ... Mute nick or mask Admin-only
!unmute <nick/mask> ... Unmute nick or mask Admin-only
!kick <nick> [message] Kick nick with message Admin-only
ping.py
(hi|hello|hey) $botname Reply with (Hi|Hello|Hey)( |!) Anyone
(hi|hello|hey) $botname Reply with (Hi|Hello|Hey)( |!)
reload.py
$botname: reload {module} Reloads specified module Admins
$botname: reload <module>Reloads specified module Admin-only
rutils.py
!rev {string} Reverse String Anyone
!b64e {string} Base64-encode a string Anyone
!b64d {string} Base64-decode a string Anyone
!rand [min] {max} Says a random number between(incl.) min and max Anyone
!rev <string> Reverse String
!b64e <string> Base64-encode a string
!b64d <string> Base64-decode a string
!rand [min] <max> Get a random number inside [min, max]
seen.py
!seen {person} Reports when person was last seen Anyone
!seen <person> Reports when person was last seen
server.py
!server [query] [query] ... Search servers at servers.minetest.net Anyone
addr:{string} searches in Address
name:{string} searches in Server name
players:{modifier} uses Player count
- most finds servers with most players
- least finds servers with least players
- >{number} finds servers with players > x
- <{num} finds servers with players < x
- [=]{number} finds servers with x players
- !{number} finds servers with not x players
ping:{modifier} uses Player count
!server [query] ... Search servers from servers.minetest.net
addr:<string> searches in Address
name:<string> searches in Server name
players:<modifier> uses Player count
- most servers with most players
- least servers with least players
- >N servers with less than N players
- <N servers with more than N players
- [=]N servers with exactly N players
ping:<modifier> uses Ping
- same modifiers as players:
port:{modifier} uses Port
port:<modifier> uses Port
- same modifiers as players:
i:{number/'last'} return Server no. x
random pick random entry from results
i:N/last return server at index N
random pick random server (default)
serverup.py
!up {IP/hostname} [port] Check if server at IP/hostname is up Anyone
Supports multiple Ports e.g. 123-456,999
!up <IP/hostname> [port] Check if Minetest server is responding
title.py
!title [link] Query Page Title Anyone
!title [link] Get page title of given URL (or last seen)
wiki.py
!wik {term} Query wiki.minetest.com for term Anyone
!wik <term> Query wiki.minetest.net for term
devwiki.py
!dev {term} Query dev.minetest.net for term Anyone
!dev <term> Query dev.minetest.net for term
shortutils.py
!rtfm [nick] Give links to wiki and dev wiki Anyone
!questions [nick] Link to ESR's "How to ask smart questions" Anyone
!next Say: "Another satisfied customer. Next!" Anyone
!pil [nick] Link to Lua PIL Anyone
!git [nick] Link to Git manual Anyone
!api [nick] Link to API docs Anyone
!btc [currency] Get Bitcoin price for specified currency Anyone
!rtfm [nick] Give links to wiki and dev wiki
!questions [nick] Link to ESR's "How to ask smart questions"
!next Say: "Another satisfied customer. Next!"
!pil [nick] Link to Lua PIL and manual
!git [nick] Link to Git manual
!api [nick] Link to API docs
!btc [currency] Get Bitcoin price for specified currency
tell.py
!tell {nick} {message} Tell somebody a message Anyone
!tell <nick> <message> Tell somebody a message
modsearch.py
!mod {modname} Searches for a mod Anyone
!mod <modname> Searches for a mod
booksearch.py
!book {term} Searches for a chapter/page in the modding book Anyone
!book <term> Searches for a chapter/page in the modding book
diff --git a/server.py b/server.py index d03dd2c..ba3fdc7 100755 --- a/server.py +++ b/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:] diff --git a/shortutils.py b/shortutils.py index 9054390..fb2a7da 100755 --- a/shortutils.py +++ b/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