Commit 93b8c6e9 authored by Svetlana Tkachenko's avatar Svetlana Tkachenko
Browse files

Second comchar for info (issue #15) and Process question marks in the info...

Second comchar for info (issue #15) and Process question marks in the info plugin properly (issue #14); thanks, Nem0.
parent 2d9ccd62
......@@ -130,7 +130,7 @@ optional arguments:
#else continue out of try/except
self.set(currentNetwork, 'host', "What is the IRC network address (eg. irc.example.org)?")
self.set(currentNetwork, 'channels', "What channels to automatically join (FULL channel names, comma-separated, no spaces)?")
self.set(currentNetwork, 'channels', "What channels to automatically join (comma-separated, no spaces)?")
self.set(currentNetwork, 'nickname', "What nickname should I use?")
self.set(currentNetwork, 'ident', "What username (ident) should I use?")
self.set(currentNetwork, 'owner_nick', "What is YOUR nick (used to auth, you can set password later)?")
......@@ -141,6 +141,7 @@ optional arguments:
self.set(currentNetwork, 'use_ssl', 'Should I use ssl (yes/no)?', 'no')
self.set(currentNetwork, 'ipv6', 'Should I use IPv6 to connect (yes/no)?', 'no')
self.set(currentNetwork, "comchar", "What command char (other than my nick) should I respond to?", "-")
self.set(currentNetwork, "infochar", "What command char should I use for the info plugin?", "~") ###N# Asks for and writes the infochar to the main.cfg
list1 = os.listdir(self.homedir + "/plugins")
list2 = [item.replace(".py", "") for item in list1 if not '__' in item]
print("Available plugins are: " + " ".join(list2))
......@@ -176,3 +177,4 @@ if __name__ == "__main__":
print("Shutting down all connections...")
c.stop()
print("Quitting!")
......@@ -27,8 +27,11 @@ class Info(object):
"""Infobot. Use 'learn X as Y' and 'what is X'"""
def __init__(self, server):
self.require_auth = False
self.plugin_trigger = "~"
self.server = server
if 'infochar' in self.server.config: ##N# Sorry, this
self.plugin_trigger = self.server.config["infochar"] ##N# masterpiece is
else: ##N# for backward
self.plugin_trigger = "~" ##N# compatibility.
self.server.pluginManager.loadPlugin("Auth")
server.handle("message", self.handle_message)
self.commands = ["what", "who", "learn", "forget", "fulldb"]
......@@ -109,8 +112,8 @@ class Info(object):
self.server.doMessage(channel, "...what should I learn?")
return
for i in range(0, len(args)):
args[i] = self.badchars.sub("", args[i])
####for i in range(0, len(args)): ##N# Useless because it strips
#### args[i] = self.badchars.sub("", args[i]) #### the '?'' in the factoids.
tmp = " ".join(args)
ind = tmp.find(" as ")
......@@ -142,8 +145,8 @@ class Info(object):
self.server.doMessage(channel, "...what should I forget?")
return
for i in range(0, len(args)):
args[i] = self.badchars.sub("", args[i])
####for i in range(0, len(args)): ##N# If not commented out it's not
#### args[i] = self.badchars.sub("", args[i]) ##N# possible to delete factoids with '?'
key = " ".join(args).strip(" ")
if key in self.infodb:
......@@ -203,3 +206,5 @@ class Info(object):
elif cmd == "fulldb":
self.server.doMessage(channel, user + ": My database contains (separated by '|'): " + " | ".join(list(self.infodb.keys())))
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment