Merge branch 'master' of ayu.incorporeal.org:dr.botzo
This commit is contained in:
commit
b5be0501de
@ -11,9 +11,12 @@ dbhost = localhost
|
|||||||
dbuser = dr_botzo
|
dbuser = dr_botzo
|
||||||
dbpass = password
|
dbpass = password
|
||||||
dbname = dr_botzo
|
dbname = dr_botzo
|
||||||
|
ssl = no
|
||||||
|
ipv6 = yes
|
||||||
|
|
||||||
[IrcAdmin]
|
[IrcAdmin]
|
||||||
autojoin = #bss
|
autojoin = #bss
|
||||||
|
sleep = 30
|
||||||
automsg = nickserv identify foo
|
automsg = nickserv identify foo
|
||||||
|
|
||||||
[Karma]
|
[Karma]
|
||||||
|
23
dr.botzo.py
23
dr.botzo.py
@ -85,12 +85,33 @@ except NoOptionError as e:
|
|||||||
sys.exit("Aborted due to error with necessary configuration: "
|
sys.exit("Aborted due to error with necessary configuration: "
|
||||||
"{0:s}".format(str(e)))
|
"{0:s}".format(str(e)))
|
||||||
|
|
||||||
|
# get some optional parameters
|
||||||
|
use_ssl = False
|
||||||
|
try:
|
||||||
|
use_ssl = config.getboolean('dr.botzo', 'ssl')
|
||||||
|
except NoOptionError:
|
||||||
|
pass
|
||||||
|
if use_ssl:
|
||||||
|
log.info("SSL support enabled")
|
||||||
|
else:
|
||||||
|
log.debug("SSL not requested")
|
||||||
|
|
||||||
|
use_ipv6 = False
|
||||||
|
try:
|
||||||
|
use_ipv6 = config.getboolean('dr.botzo', 'ipv6')
|
||||||
|
except NoOptionError:
|
||||||
|
pass
|
||||||
|
if use_ipv6:
|
||||||
|
log.info("IPv6 support enabled")
|
||||||
|
else:
|
||||||
|
log.debug("IPv6 not requested")
|
||||||
|
|
||||||
# start up the IRC bot
|
# start up the IRC bot
|
||||||
|
|
||||||
# create IRC and server objects and connect
|
# create IRC and server objects and connect
|
||||||
irc = DrBotIRC.DrBotIRC(config)
|
irc = DrBotIRC.DrBotIRC(config)
|
||||||
server = irc.server().connect(botserver, botport, botnick, botpass,
|
server = irc.server().connect(botserver, botport, botnick, botpass,
|
||||||
botuser, botircname)
|
botuser, botircname, ssl=use_ssl, ipv6=use_ipv6)
|
||||||
|
|
||||||
# load features
|
# load features
|
||||||
try:
|
try:
|
||||||
|
@ -85,7 +85,7 @@ class Dispatch(Module):
|
|||||||
key, dest = self._get_key_and_destination(key)
|
key, dest = self._get_key_and_destination(key)
|
||||||
|
|
||||||
if key is not None and dest is not None:
|
if key is not None and dest is not None:
|
||||||
msg = "[{0:s}] {1:s}".format(key, message)
|
msg = "[{0:s}] {1:s}".format(key, message.encode('utf-8', 'ignore'))
|
||||||
self.new_sendmsg(dest, msg)
|
self.new_sendmsg(dest, msg)
|
||||||
|
|
||||||
return dest, msg
|
return dest, msg
|
||||||
|
@ -17,6 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
from ConfigParser import NoOptionError
|
from ConfigParser import NoOptionError
|
||||||
|
import time
|
||||||
|
|
||||||
from extlib import irclib
|
from extlib import irclib
|
||||||
|
|
||||||
@ -56,6 +57,12 @@ class IrcAdmin(Module):
|
|||||||
' '.join(command.split(' ')[1:]))
|
' '.join(command.split(' ')[1:]))
|
||||||
except NoOptionError: pass
|
except NoOptionError: pass
|
||||||
|
|
||||||
|
# sleep for a bit before autojoining, if told to
|
||||||
|
try:
|
||||||
|
sleep = self.config.getint(self.__class__.__name__, 'sleep')
|
||||||
|
time.sleep(sleep)
|
||||||
|
except NoOptionError: pass
|
||||||
|
|
||||||
# join the specified channels
|
# join the specified channels
|
||||||
try:
|
try:
|
||||||
autojoins = self.config.get(self.__class__.__name__, 'autojoin').split(',')
|
autojoins = self.config.get(self.__class__.__name__, 'autojoin').split(',')
|
||||||
|
Loading…
Reference in New Issue
Block a user