summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rwxr-xr-xplugins/chatbot.py24
-rwxr-xr-xplugins/manaboy.py316
-rw-r--r--plugins/xcom.py323
3 files changed, 402 insertions, 261 deletions
diff --git a/plugins/chatbot.py b/plugins/chatbot.py
index e26928d..e52bb0f 100755
--- a/plugins/chatbot.py
+++ b/plugins/chatbot.py
@@ -30,18 +30,16 @@ def answer_random(nick, message, is_whisper, answers):
mapserv.cmsg_chat_message(resp)
def answer(nick, message, is_whisper):
- try:
- for regex, action in commands.iteritems():
- match = regex.match(message)
- if match:
- if isinstance(action, types.ListType):
- answer_random(nick, message, is_whisper, action)
- elif isinstance(action, types.FunctionType):
- action(nick, message, is_whisper, match)
- else:
- raise ValueError("must be either list or function")
- except:
- answer_random(nick, message, is_whisper, action)
+
+ for regex, action in commands.iteritems():
+ match = regex.match(message)
+ if match:
+ if isinstance(action, types.ListType):
+ answer_random(nick, message, is_whisper, action)
+ elif isinstance(action, types.FunctionType):
+ action(nick, message, is_whisper, match)
+ else:
+ answer_random(nick, message, is_whisper, action)
@extends('smsg_being_chat')
def being_chat(data):
@@ -68,4 +66,4 @@ def remove_command(cmd):
def init(config):
add_command('!info', answer_info)
- add_command('!random', ['asd', 'Ciao!'])
+ # ~ add_command('!random', ['asd', 'Ciao!'])
diff --git a/plugins/manaboy.py b/plugins/manaboy.py
index f9dea3f..76f81d3 100755
--- a/plugins/manaboy.py
+++ b/plugins/manaboy.py
@@ -16,8 +16,6 @@ from utils import extends
from actor import find_nearest_being
from chat import send_whisper as whisper
-from net.onlineusers import OnlineUsers
-
__all__ = [ 'PLUGIN', 'init' ]
def preloadArray(nfile):
@@ -92,234 +90,6 @@ def XUfortune(nick, message, is_whisper, match): XECUTE(nick, is_whisper, "fo
def XUdate(nick, message, is_whisper, match): XECUTE(nick, is_whisper, "/bin/date")
def XUpom(nick, message, is_whisper, match): XECUTE(nick, is_whisper, "/usr/games/pom")
-# ====================== XCOM =============
-XCOMList = preloadArray("config/XCOM.txt")
-XCOMServerStatInterested = [] #List of nicks interested in server status change
-XCOMBroadcastPrefix = "##B##G "
-
-
-def online_list_update(curr,prev):
- for x in curr:
- found = False
- for y in prev:
- if x==y: found = True
- if found == False: #detected change
- for nicks in XCOMList: #For every XCOM user...
- if nicks in online_users.online_users: #That's online...
- if nicks in XCOMServerStatInterested: #If XCOM player is interested
- if x in XCOMList: #An XCOM user connected?
- XCOMDelay() #Share its status
- whisper(nicks, "##W" + x + " is now online [XCOM]")
- else: #Is a regular server player
- if x not in XCOMList:
- XCOMDelay() #Share its status
- whisper(nicks, "##W" + x + " is now online")
-
- for x in prev:
- found = False
- for y in curr:
- if x==y: found = True
- if found == False:
- for nicks in XCOMList: #For every XCOM user...
- if nicks in online_users.online_users: #That's online...
- if nicks in XCOMServerStatInterested: #If XCOM player is interested
- if x in XCOMList: #An XCOM user connected?
- XCOMDelay() #Share its status
- whisper(nicks, "##L" + x + " is now offline [XCOM]")
- else: #Is a regular server player
- if x not in XCOMList:
- XCOMDelay() #Share its status
- whisper(nicks, "##L" + x + " is now offline")
-
-online_users = OnlineUsers(online_url=' https://server.themanaworld.org/online-old.txt', update_interval=20, refresh_hook=online_list_update)
-
-def XCOMOnlineList(nick, message, is_whisper, match):
- XCOMDelay()
- msg=""
- for nicks in XCOMList:
- if nicks in online_users.online_users:
- msg = msg + nicks + " | "
- XCOMDelay()
- whisper(nick, msg)
-
-def XCOMPrintStat():
- pOnline=0
- xOnline=0
- for p in online_users.online_users:
- pOnline=pOnline+1
- if p in XCOMList:
- xOnline=xOnline+1
- return "%(xOnline)d/%(pOnline)d"%{"pOnline": pOnline, "xOnline": xOnline,}
-
-def XCOMDelay():
- time.sleep(0.1)
-
-def XCOMBroadcast(message):
- for nicks in XCOMList:
- if nicks in online_users.online_users:
- if nicks not in ignored_players:
- XCOMDelay()
- whisper(nicks, message)
-
-def XCOMCommunicate(nick, message, is_whisper, match):
- if not is_whisper:
- return
- if nick in ignored_players:
- return #or say something
- if message[0]=="!":
- return
- if message.startswith("*AFK*:"): # AFK bug workaround
- return
- if nick in XCOMList:
- for nicks in XCOMList:
- if nicks in online_users.online_users:
- if nick==nicks:
- pass
- else:
- XCOMDelay()
- whisper(nicks, "##B##LXCOM[" + XCOMPrintStat() + "]##l " + nick + ": ##b" + message)
- else:
- whisper(nick, XCOMBroadcastPrefix + "XCOM is not enabled (Use !xcon)")
-
-def XCOMSilentInvite(nick, message, is_whisper, match):
- XCOMDelay()
- if not is_whisper:
- return
- if nick in ignored_players:
- return #or say something
- if nick in admins:
- XCOMList.append(match.group(1))
- if match.group(1) not in ignored_players:
- whisper(nick, "##W--- " + nick + " silently invited " + match.group(1) + " on XCOM ---")
- else:
- whisper(nick, "##W" + match.group(1) + " has been ignored by bot and cannot be added to XCOM.")
-
-def XCOMInvite(nick, message, is_whisper, match):
- XCOMDelay()
- if not is_whisper:
- return
- if nick in ignored_players:
- return #or say something
- if nick in admins: # FIXME Do not add if already there!!!
- XCOMList.append(match.group(1))
- XCOMBroadcast("##W--- " + nick + " (Admin) invited " + match.group(1) + " on XCOM ---" + XCOMBroadcastPrefix + match.group(1) + " XCOM enabled! Use !xcoff to disable, use !xclist to see XCOM online list")
- else:
- if nick in ignored_players:
- whisper(nick, "You cannot invite banned players.")
- else:
- whisper(match.group(1), "##W--- " + nick + " invited you to chat on XCOM --- Answer !xcon to join.")
- XCOMDelay()
- whisper(nick, "Invited " + match.group(1) + " to join XCOM. Waiting for his/her reply...")
-
-XCOMServerInvited = []
-def XCOMInviteAll(nick, message, is_whisper, match):
- XCOMDelay()
- if not is_whisper:
- return
- if nick in ignored_players:
- return #or say something
- if nick in admins: # FIXME Do not add if already there!!!
- for invn in online_users.online_users:
- if invn in XCOMList:
- pass
- elif invn in ignored_players:
- pass
- elif invn in XCOMServerInvited:
- pass
- else:
- XCOMServerInvited.append(invn)
- whisper(invn, "##W--- " + nick + " invited you to chat on XCOM --- Answer !xcon to join.")
- XCOMDelay()
-
-
-def XCOMEnable(nick, message, is_whisper, match):
- XCOMDelay()
- #accept only whispers
- if not is_whisper:
- return
- if nick in ignored_players:
- return #or say something
- #search array
- if nick in XCOMList:
- whisper(nick, XCOMBroadcastPrefix + nick + " XCOM already enabled")
- else:
- XCOMList.append(nick)
- XCOMBroadcast("##W--- " + nick + " is online on XCOM ---" + XCOMBroadcastPrefix + nick + " XCOM enabled! Use !xcoff or !xcom off to disable, use !xclist to see XCOM online list")
-
-def XCOMDisable(nick, message, is_whisper, match):
- XCOMDelay()
- #accept only whispers
- if not is_whisper:
- return
- if nick in ignored_players:
- return #or say something
- #search array
- if nick in XCOMList:
- XCOMBroadcast("##L--- " + nick + " disabled XCOM ---")
- XCOMList.remove(nick)
- else:
- whisper(nick, XCOMBroadcastPrefix + nick + " XCOM already disabled")
-
-def XCOMServerInterestEnable(nick, message, is_whisper, match):
- XCOMDelay()
- #accept only whispers
- if not is_whisper:
- return
- if nick in ignored_players:
- return #or say something
- #search array
- if nick in XCOMList:
- whisper(nick, XCOMBroadcastPrefix + "Server online status notifications enabled!")
- XCOMServerStatInterested.append(nick)
-
-def XCOMServerInterestDisable(nick, message, is_whisper, match):
- XCOMDelay()
- #accept only whispers
- if not is_whisper:
- return
- if nick in ignored_players:
- return #or say something
- #search array
- if nick in XCOMList:
- whisper(nick, XCOMBroadcastPrefix + "Server online status notifications disabled!")
- XCOMServerStatInterested.remove(nick)
-
-def XCOMBan(nick, message, is_whisper, match):
- XCOMDelay()
- #accept only whispers
- if not is_whisper:
- return
- if nick in admins:
- #search array
- if match.group(1) in ignored_players:
- whisper(nick, "Already banned.")
- else:
- ignored_players.append(match.group(1))
- XCOMList.remove(match.group(1))
- #FIXME array need to be saved!!!
- XCOMBroadcast(XCOMBroadcastPrefix + match.group(1) + " is now banned from XCOM")
- else:
- whisper(nick, "Admins only.")
-
-def XCOMUnBan(nick, message, is_whisper, match):
- XCOMDelay()
- #accept only whispers
- if not is_whisper:
- return
- if nick in admins:
- #search array
- if match.group(1) in ignored_players:
- XCOMList.append(match.group(1))
- ignored_players.remove(match.group(1))
- #FIXME array need to be saved!!!
- XCOMBroadcast(XCOMBroadcastPrefix + match.group(1) + " is now unbanned from XCOM")
- whisper(match.group(1), "You are now unbanned from XCOM. Don't make it happen again.")
- else:
- whisper(nick, "Already banned.")
- else:
- whisper(nick, "Admins only.")
-
-# =============================================
greetings = [
"Hi {0}!",
@@ -640,6 +410,7 @@ PLUGIN = {
'blocks': (),
}
+
npcdialog = {
'start_time': -1,
'program': [],
@@ -670,9 +441,21 @@ def set_npc_owner(nick):
npc_owner = nick
+death_words = [
+ "Dammit!!! Why me???",
+ "Nirvana wait for me!",
+ "Well, at least I will have no more taxes to pay.",
+ "I need another drink...",
+ "I don't want to see!",
+ "See you on the other side!",
+ "Don't worry: I've pressed the up button first.",
+]
+
@extends('smsg_being_remove')
def bot_dies(data):
if data.id == charserv.server.account:
+ mapserv.cmsg_chat_message(random.choice(death_words))
+ time.sleep(5)
mapserv.cmsg_player_respawn()
@@ -1039,8 +822,7 @@ def cmd_say(nick, message, is_whisper, match):
if nick not in admins:
return
# ~ set_npc_owner(nick)
- msg = message.group(1)
- mapserv.cmsg_chat_message(msg)
+ mapserv.cmsg_chat_message(match.group(1))
def cmd_sit(nick, message, is_whisper, match):
@@ -1371,9 +1153,61 @@ def manaboy_logic(ts):
if not storage_is_open and ts > npcdialog['start_time'] + 30.0:
reset()
+
+
# =========================================================================
+
+def emoteX(nick, message, is_whisper, match):
+ if not is_whisper:
+ return
+ if nick in ignored_players:
+ return
+
+ if nick not in admins:
+ return
+ emote=1
+ while(emote < 40):
+ mapserv.cmsg_player_emote(emote)
+ emote=emote+1
+ commands.set_direction('', 'up')
+ time.sleep(0.25)
+ commands.set_direction('', 'right')
+ time.sleep(0.25)
+ commands.set_direction('', 'down')
+ time.sleep(0.25)
+ commands.set_direction('', 'left')
+ time.sleep(0.25)
+
+def spinner(nick, message, is_whisper, match):
+ if nick in ignored_players:
+ return
+
+ players = []
+ for being in mapserv.beings_cache.itervalues():
+ if ((being.type == 'player') and len(being.name) > 1):
+ players.append(being.name)
+
+ mapserv.cmsg_chat_message('*hugs Soul Menhir*')
+
+ emote=1
+ while(emote < 20):
+ emote=emote+1
+ commands.set_direction('', 'up')
+ time.sleep(0.1)
+ commands.set_direction('', 'right')
+ time.sleep(0.1)
+ commands.set_direction('', 'down')
+ time.sleep(0.1)
+ commands.set_direction('', 'left')
+ time.sleep(0.1)
+
+ mapserv.cmsg_chat_message('*hugs Soul Menhir*')
+
+
manaboy_commands = {
+ '!emotex' : emoteX,
+ '!spinner' : spinner,
'!where' : cmd_where,
'!goto (\d+) (\d+)' : cmd_goto,
'!(left|right|up|down)' : cmd_goclose,
@@ -1384,7 +1218,8 @@ manaboy_commands = {
'!use (\d+)' : cmd_item_action,
'!emote (\d+)' : cmd_emote,
'!attack (.+)' : cmd_attack,
- '!say ((@|#).+)' : cmd_say,
+ # ~ '!say ((@|#).+)' : cmd_say,
+ '!say (.*)' : cmd_say,
'!sit' : cmd_sit,
'!turn' : cmd_turn,
'!follow' : cmd_follow,
@@ -1410,19 +1245,6 @@ manaboy_commands = {
'!xuf': XUfortune,
'!xudate': XUdate,
'!xupom': XUpom,
- '!xcon' : XCOMEnable,
- '!xcom' : XCOMEnable,
- '!xcoff' : XCOMDisable,
- '!xcom off' : XCOMDisable,
- '!xclist' : XCOMOnlineList,
- '!xci (.*)' : XCOMInvite,
- '!xcia' : XCOMInviteAll,
- '!xcsi (.*)' : XCOMSilentInvite,
- '!xcb (.*)' : XCOMBan,
- '!xcu (.*)' : XCOMUnBan,
- '!xcsion' : XCOMServerInterestEnable,
- '!xcsioff' : XCOMServerInterestDisable,
- r'(.*)' : XCOMCommunicate,
r'^(?i)explain (.*)': say_explain,
r'^(?i)(hello|hi|hey|heya|hiya|yo) (?i)(livio|liviobot)' : say_greeting,
@@ -1455,8 +1277,6 @@ def chatbot_answer_mod(func):
return mb_answer
def init(config):
-
- online_users.start()
for cmd, action in manaboy_commands.items():
plugins.chatbot.add_command(cmd, action)
diff --git a/plugins/xcom.py b/plugins/xcom.py
new file mode 100644
index 0000000..2f8a679
--- /dev/null
+++ b/plugins/xcom.py
@@ -0,0 +1,323 @@
+import time
+import net.mapserv as mapserv
+import net.charserv as charserv
+import net.stats as stats
+import commands
+import walkto
+import logicmanager
+import status
+import plugins
+import itemdb
+# ~ import random
+from collections import deque
+from net.inventory import get_item_index, get_storage_index
+from utils import extends
+from actor import find_nearest_being
+from chat import send_whisper as whisper
+
+from net.onlineusers import OnlineUsers
+
+__all__ = [ 'PLUGIN', 'init' ]
+
+PLUGIN = {
+ 'name': 'manaboy',
+ 'requires': ['chatbot'],
+ 'blocks': (),
+}
+
+def preloadArray(nfile):
+ try:
+ file = open(nfile, "r")
+ array=[]
+ for x in file.readlines():
+ x = x.replace("\n", "")
+ x = x.replace("\r", "")
+ array.append(x)
+ file.close()
+ return array
+ except:
+ print "preloadArray: File " + nfile + " not found!"
+
+ignored_players = preloadArray("bot/ignored.txt")
+disliked_players = preloadArray("bot/disliked.txt")
+admins = preloadArray("bot/admins.txt")
+friends = preloadArray("bot/friends.txt")
+
+
+XCOMList = preloadArray("bot/XCOM.txt")
+XCOMServerStatInterested = [] #List of nicks interested in server status change
+XCOMBroadcastPrefix = "##B##G "
+
+
+def online_list_update(curr,prev):
+ for x in curr:
+ found = False
+ for y in prev:
+ if x==y: found = True
+ if found == False: #detected change
+ for nicks in XCOMList: #For every XCOM user...
+ if nicks in online_users.online_users: #That's online...
+ if nicks in XCOMServerStatInterested: #If XCOM player is interested
+ if x in XCOMList: #An XCOM user connected?
+ XCOMDelay() #Share its status
+ whisper(nicks, "##W" + x + " is now online [XCOM]")
+ else: #Is a regular server player
+ if x not in XCOMList:
+ XCOMDelay() #Share its status
+ whisper(nicks, "##W" + x + " is now online")
+
+ for x in prev:
+ found = False
+ for y in curr:
+ if x==y: found = True
+ if found == False:
+ for nicks in XCOMList: #For every XCOM user...
+ if nicks in online_users.online_users: #That's online...
+ if nicks in XCOMServerStatInterested: #If XCOM player is interested
+ if x in XCOMList: #An XCOM user connected?
+ XCOMDelay() #Share its status
+ whisper(nicks, "##L" + x + " is now offline [XCOM]")
+ else: #Is a regular server player
+ if x not in XCOMList:
+ XCOMDelay() #Share its status
+ whisper(nicks, "##L" + x + " is now offline")
+
+online_users = OnlineUsers(online_url=' https://server.themanaworld.org/online-old.txt', update_interval=20, refresh_hook=online_list_update)
+
+def XCOMOnlineList(nick, message, is_whisper, match):
+ XCOMDelay()
+ msg=""
+ for nicks in XCOMList:
+ if nicks in online_users.online_users:
+ msg = msg + nicks + " | "
+ XCOMDelay()
+ whisper(nick, msg)
+
+def XCOMPrintStat():
+ pOnline=0
+ xOnline=0
+ for p in online_users.online_users:
+ pOnline=pOnline+1
+ if p in XCOMList:
+ xOnline=xOnline+1
+ return "%(xOnline)d/%(pOnline)d"%{"pOnline": pOnline, "xOnline": xOnline,}
+
+def XCOMDelay():
+ time.sleep(0.1)
+
+def XCOMBroadcast(message):
+ for nicks in XCOMList:
+ if nicks in online_users.online_users:
+ if nicks not in ignored_players:
+ XCOMDelay()
+ whisper(nicks, message)
+
+def XCOMCommunicate(nick, message, is_whisper, match):
+ if not is_whisper:
+ return
+ if nick in ignored_players:
+ return #or say something
+ if message[0]=="!":
+ return
+ if message.startswith("*AFK*:"): # AFK bug workaround
+ return
+ if nick in XCOMList:
+ for nicks in XCOMList:
+ if nicks in online_users.online_users:
+ if nick==nicks:
+ pass
+ else:
+ XCOMDelay()
+ whisper(nicks, "##B##LXCOM[" + XCOMPrintStat() + "]##l " + nick + ": ##b" + message)
+ else:
+ whisper(nick, XCOMBroadcastPrefix + "XCOM is not enabled (Use !xcon)")
+
+def XCOMSilentInvite(nick, message, is_whisper, match):
+ XCOMDelay()
+ if not is_whisper:
+ return
+ if nick in ignored_players:
+ return #or say something
+ if nick in admins:
+ XCOMList.append(match.group(1))
+ if match.group(1) not in ignored_players:
+ whisper(nick, "##W--- " + nick + " silently invited " + match.group(1) + " on XCOM ---")
+ else:
+ whisper(nick, "##W" + match.group(1) + " has been ignored by bot and cannot be added to XCOM.")
+
+def XCOMInvite(nick, message, is_whisper, match):
+ XCOMDelay()
+ if not is_whisper:
+ return
+ if nick in ignored_players:
+ return #or say something
+ if nick in admins: # FIXME Do not add if already there!!!
+ XCOMList.append(match.group(1))
+ XCOMBroadcast("##W--- " + nick + " (Admin) invited " + match.group(1) + " on XCOM ---" + XCOMBroadcastPrefix + match.group(1) + " XCOM enabled! Use !xcoff to disable, use !xclist to see XCOM online list")
+ else:
+ if nick in ignored_players:
+ whisper(nick, "You cannot invite banned players.")
+ else:
+ whisper(match.group(1), "##W--- " + nick + " invited you to chat on XCOM --- Answer !xcon to join.")
+ XCOMDelay()
+ whisper(nick, "Invited " + match.group(1) + " to join XCOM. Waiting for his/her reply...")
+
+XCOMServerInvited = []
+def XCOMInviteAll(nick, message, is_whisper, match):
+ XCOMDelay()
+ if not is_whisper:
+ return
+ if nick in ignored_players:
+ return #or say something
+ if nick in admins: # FIXME Do not add if already there!!!
+ for invn in online_users.online_users:
+ if invn in XCOMList:
+ pass
+ elif invn in ignored_players:
+ pass
+ elif invn in XCOMServerInvited:
+ pass
+ else:
+ XCOMServerInvited.append(invn)
+ whisper(invn, "##W--- " + nick + " invited you to chat on XCOM --- Answer !xcon to join.")
+ XCOMDelay()
+
+
+def XCOMEnable(nick, message, is_whisper, match):
+ XCOMDelay()
+ #accept only whispers
+ if not is_whisper:
+ return
+ if nick in ignored_players:
+ return #or say something
+ #search array
+ if nick in XCOMList:
+ whisper(nick, XCOMBroadcastPrefix + nick + " XCOM already enabled")
+ else:
+ XCOMList.append(nick)
+ XCOMBroadcast("##W--- " + nick + " is online on XCOM ---" + XCOMBroadcastPrefix + nick + " XCOM enabled! Use !xcoff or !xcom off to disable, use !xclist to see XCOM online list")
+
+def XCOMDisable(nick, message, is_whisper, match):
+ XCOMDelay()
+ #accept only whispers
+ if not is_whisper:
+ return
+ if nick in ignored_players:
+ return #or say something
+ #search array
+ if nick in XCOMList:
+ XCOMBroadcast("##L--- " + nick + " disabled XCOM ---")
+ XCOMList.remove(nick)
+ else:
+ whisper(nick, XCOMBroadcastPrefix + nick + " XCOM already disabled")
+
+def XCOMServerInterestEnable(nick, message, is_whisper, match):
+ XCOMDelay()
+ #accept only whispers
+ if not is_whisper:
+ return
+ if nick in ignored_players:
+ return #or say something
+ #search array
+ if nick in XCOMList:
+ whisper(nick, XCOMBroadcastPrefix + "Server online status notifications enabled!")
+ XCOMServerStatInterested.append(nick)
+
+def XCOMServerInterestDisable(nick, message, is_whisper, match):
+ XCOMDelay()
+ #accept only whispers
+ if not is_whisper:
+ return
+ if nick in ignored_players:
+ return #or say something
+ #search array
+ if nick in XCOMList:
+ whisper(nick, XCOMBroadcastPrefix + "Server online status notifications disabled!")
+ XCOMServerStatInterested.remove(nick)
+
+def XCOMBan(nick, message, is_whisper, match):
+ XCOMDelay()
+ #accept only whispers
+ if not is_whisper:
+ return
+ if nick in admins:
+ #search array
+ if match.group(1) in ignored_players:
+ whisper(nick, "Already banned.")
+ else:
+ ignored_players.append(match.group(1))
+ XCOMList.remove(match.group(1))
+ #FIXME array need to be saved!!!
+ XCOMBroadcast(XCOMBroadcastPrefix + match.group(1) + " is now banned from XCOM")
+ else:
+ whisper(nick, "Admins only.")
+
+def XCOMUnBan(nick, message, is_whisper, match):
+ XCOMDelay()
+ #accept only whispers
+ if not is_whisper:
+ return
+ if nick in admins:
+ #search array
+ if match.group(1) in ignored_players:
+ XCOMList.append(match.group(1))
+ ignored_players.remove(match.group(1))
+ #FIXME array need to be saved!!!
+ XCOMBroadcast(XCOMBroadcastPrefix + match.group(1) + " is now unbanned from XCOM")
+ whisper(match.group(1), "You are now unbanned from XCOM. Don't make it happen again.")
+ else:
+ whisper(nick, "Already banned.")
+ else:
+ whisper(nick, "Admins only.")
+
+# =============================================
+
+def cmd_commands(nick, message, is_whisper, match):
+ if not is_whisper:
+ return
+ if nick in ignored_players:
+ return
+
+ c = []
+ for cmd in xcom_commands:
+ if cmd.startswith('!('):
+ br = cmd.index(')')
+ c.extend(cmd[2:br].split('|'))
+ elif cmd.startswith('!'):
+ c.append(cmd[1:].split()[0])
+
+ c.sort()
+ whisper(nick, ', '.join(c))
+
+xcom_commands = {
+ '!xcomhelp' : cmd_commands,
+ '!xcon' : XCOMEnable,
+ '!xcom' : XCOMEnable,
+ '!xcoff' : XCOMDisable,
+ '!xcom off' : XCOMDisable,
+ '!xclist' : XCOMOnlineList,
+ '!xci (.*)' : XCOMInvite,
+ '!xcia' : XCOMInviteAll,
+ '!xcsi (.*)' : XCOMSilentInvite,
+ '!xcb (.*)' : XCOMBan,
+ '!xcu (.*)' : XCOMUnBan,
+ '!xcsion' : XCOMServerInterestEnable,
+ '!xcsioff' : XCOMServerInterestDisable,
+ r'(.*)' : XCOMCommunicate,
+}
+
+# ~ def chatbot_answer_mod(func):
+ # ~ '''modifies chatbot.answer to remember last 10 commands'''
+
+ # ~ def mb_answer(nick, message, is_whisper):
+ # ~ return func(nick, message, is_whisper)
+
+ # ~ return mb_answer
+
+def init(config):
+
+ for cmd, action in xcom_commands.items():
+ plugins.chatbot.add_command(cmd, action)
+ online_users.start()
+ # ~ plugins.chatbot.answer = chatbot_answer_mod(plugins.chatbot.answer)
+