<commit_before># Filename: channels.py
# Module:	channels
# Date:		03th July 2006
# Author:	<NAME>, prologic at shortcircuit dot net dot au

"""Channel Management

This plugin manages channels and what channels the bot
joins automatically.
"""

__ver__ = "0.0.1"
__author__ = "<NAME>, prologic at shortcircuit dot net dot au"

from pymills.event import listener

from kdb.plugin import BasePlugin, CommandHandler

class ChannelsCommands(CommandHandler):

	def cmdADD(self, source, channel):
		if channel not in self.parent.channels:
			self.parent.channels.append(channel)
			return "Okay, added %s to startup " \
					"join list" % channel
		else:
			return "%s is already in my startup " \
					"join list" % channel

	def cmdDEL(self, source, channel):
		if channel not in self.parent.channels:
			return "%s isn't in my startup join list" % channel
		else:
			self.parent.channels.remove(channel)
			return "Okay, removed %s from my " \
					"startup join list" % channel

	def cmdLIST(self, source):
		return "I'm configured to join %s " \
				"st startup" % ", ".join(self.parent.channels)

class Channels(BasePlugin):
	"Channel Management"

	def __init__(self, event, bot, env):
		BasePlugin.__init__(self, event, bot, env)

		if self.env.config.has_option("bot", "channels"):
			self.channels = [x.strip() for x in
					self.env.config.get(
						"bot", "channels").split(",")
					if not x.strip() == ""]
		else:
			self.channels = []

	def joinChannels(self):
		for channel in self.channels:
			self.bot.ircJOIN(channel)

	def cmdJOIN(self, source, channel):
		"""Join the specified channel
		
		Syntax: JOIN <channel>
		"""

		self.bot.ircJOIN(channel)

	def cmdPART(self, source, channel, message="Leaving"):
		"""Leave the specified channel
		
		Syntax: PART <channel> [<message>]
		"""

		self.bot.ircPART(channel, message)

	def cmdCHANNELS(self, source, command, *args, **kwargs):
		self.env.log.debug(source)
		self.env.log.debug(command)
		return ChannelsCommands(self)(command,
				source, *args, **kwargs)

	@listener("connected")
	def onCONNECTED(self, event):
		self.joinChannels()<commit_msg>Added return replies for commands<commit_after># Filename: channels.py
# Module:	channels
# Date:		03th July 2006
# Author:	<NAME>, prologic at shortcircuit dot net dot au

"""Channel Management

This plugin manages channels and what channels the bot
joins automatically.
"""

__ver__ = "0.0.2"
__author__ = "<NAME>, prologic at shortcircuit dot net dot au"

from pymills.event import listener

from kdb.plugin import BasePlugin, CommandHandler

class ChannelsCommands(CommandHandler):

	def cmdADD(self, source, channel):
		if channel not in self.parent.channels:
			self.parent.channels.append(channel)
			return "Okay, added %s to startup " \
					"join list" % channel
		else:
			return "%s is already in my startup " \
					"join list" % channel

	def cmdDEL(self, source, channel):
		if channel not in self.parent.channels:
			return "%s isn't in my startup join list" % channel
		else:
			self.parent.channels.remove(channel)
			return "Okay, removed %s from my " \
					"startup join list" % channel

	def cmdLIST(self, source):
		return "I'm configured to join %s " \
				"st startup" % ", ".join(self.parent.channels)

class Channels(BasePlugin):
	"Channel Management"

	def __init__(self, event, bot, env):
		BasePlugin.__init__(self, event, bot, env)

		if self.env.config.has_option("bot", "channels"):
			self.channels = [x.strip() for x in
					self.env.config.get(
						"bot", "channels").split(",")
					if not x.strip() == ""]
		else:
			self.channels = []

	def joinChannels(self):
		for channel in self.channels:
			self.bot.ircJOIN(channel)

	def cmdJOIN(self, source, channel):
		"""Join the specified channel
		
		Syntax: JOIN <channel>
		"""

		self.bot.ircJOIN(channel)

		return "Joined channel %s" % channel

	def cmdPART(self, source, channel, message="Leaving"):
		"""Leave the specified channel
		
		Syntax: PART <channel> [<message>]
		"""

		self.bot.ircPART(channel, message)

		return "Left channel %s" % channel

	def cmdCHANNELS(self, source, command, *args, **kwargs):
		self.env.log.debug(source)
		self.env.log.debug(command)
		return ChannelsCommands(self)(command,
				source, *args, **kwargs)

	@listener("connected")
	def onCONNECTED(self, event):
		self.joinChannels()
{'fraction_non_alphanumeric': 0.12846580406654343, 'fraction_numerical': 0.004158964879852125, 'mean_word_length': 3.9474285714285715, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2607427', 'n_tokens_mistral': 1581, 'n_tokens_neox': 1373, 'n_words': 425}