Commits

Jason R. Coombs  committed fc04b22

Added SilentCommandBot (invoked with silent:True in config) that doesn't output anything.

  • Participants
  • Parent commits 19d5ea6
  • Tags 1100.8

Comments (0)

Files changed (2)

File pmxbot/botbase.py

 		self._handle_output(channel, res)
 
 
+class SilentCommandBot(LoggingCommandBot):
+	"""
+	A version of the bot that doesn't say anything (just logs and
+	processes commands).
+	"""
+	def out(self, *args, **kwargs):
+		"Do nothing"
+
+
 _handler_registry = []
 _delay_registry = []
 _at_registry = []

File pmxbot/pmxbot.py

 import popquotes.pmxbot as pq
 
 from .botbase import (command, contains, execdelay, execat,
-	_handler_registry, NoLog, LoggingCommandBot)
+	_handler_registry, NoLog)
 from . import botbase
 from .util import *
 from . import util
 	use_ssl = getattr(config, 'use_ssl', False)
 	password = getattr(config, 'password', None)
 
-	bot = LoggingCommandBot(config.database, config.server_host, config.server_port,
+	silent_bot = getattr(config, 'silent', False)
+
+	class_ = botbase.LoggingCommandBot if not silent_bot else botbase.SilentCommandBot
+
+	bot = class_(config.database, config.server_host, config.server_port,
 		config.bot_nickname, config.log_channels, config.other_channels,
 		config.feed_interval*60, config.feeds, use_ssl=use_ssl,
 		password=password)