Example #1
0
	def spawn(self, channel="#anime", name=None, bot_type="worker"):
		if name == None:
			name = parser.parse("$C$v$Anything").to_string().replace(" ", "-")
		if len(name) > 16: name = name[:16]
		dmsg( "Spawning %s into %s" % (name, channel) )
		if bot_type == "worker":
			bot = WorkerClass(self.server, self.port, channel, name)
		else:
			bot = None
		self.threads += [ bot ]
		self.family += 1
		self.threads[-1].parent = self
		self.threads[-1].storage = self.storage
		self.threads[-1].start()
Example #2
0
	def command(self, sender, channel, order, suffix):
		if len(order) <= 2: return
		if sender in self.ignore: return
		print dmsg("%s, %s" % (order, suffix), self.name)
		commander = get_nick(sender)

		p = command_parser(order, commander)

		print p.get()
		allow = self.allow(p.get(), commander)
		if   allow ==  0: self.send("Nope"); return
		elif allow == -1: self.send("%s: Unrecognized command" % commander); return

		if  p.accept("say", 1):
			self.send(parser.parse(p.get_rest()).to_string())
		elif p.accept("remind", 1):
			username = p.get()
			p.accept("", 1)
			p.accept("about", 1)
			p.accept("to", 1)
			text = p.get_rest()
			if username not in self.remind: self.remind[username] = []
			self.remind[username] += [ (commander, text) ]
			self.send("Ok, will remind %s: '%s'" % (username, text))
		elif p.accept("ignore", 1):
			#ignore = "ignore", username, { delimiter , username }
			users = []
			users += [p.get()]
			p.accept("", 1)
			while p.accept("and", 1):
				users += [p.get()]
				p.accept("", 1)
			if len(users) <= 0: return
			userlist_readable = users[0]
			del users[0]
			for user in users:
				userlist_readable += ", %s" % user
			for user in users:
				if user not in self.ignore: self.ignore += [user]
			self.send("Understood, will now ignore %s" % userlist_readable)
		elif p.accept("follow", 1):
			#follow = "follow", username, { delimiter , username }
			users = [ p.get() ]
			while p.accept("and", 1):
				users += [p.get()]
				p.accept("", 1)
			if len(users) <= 0: return
			userlist_readable = users[0]
			del users[0]
			for user in users:
				if user not in self.follow: self.follow += [user]
			for user in users:
				userlist_readable += ", %s" % user
			self.send("Understood, will now follow %s" % userlist_readable)
		elif p.accept("leave", 1):
			self.leave(channel)
		elif p.accept("spawn", 1):
			if p.accept(""):
				self.parent.spawn(channel, p.get())
			else:
				self.parent.spawn(channel)
		elif p.accept("silence", 1):
			if   p.accept("no"):
				self.silence = 0
			elif p.accept("yes"):
				self.silence = 1
			else:
				self.silence = 1
		elif p.accept("log", 1):
			self.send("Unimplemented")
Example #3
0
def sentence():
	return parser.parse(random.choice(s)).to_string()
Example #4
0
def text(string):
	print string, string.__class__
	return parser.parse(string).to_string()
Example #5
0
s+=["$trollword $trollword $trollword $trollword $trollword"]
s+=["I $relation people with $color skin!"]
s+=["$random_number_of_dots$sentence_end"]
s+=["You $modalverb $action_daily $food!"]
s+=["$time_of_day is the time of $monster\s!"]
s+=["The $adj_good $name was $action_kill\ed by a $adj_evil $monster"]
s+=["A $person ordered everybody to train $martial_art"]
s+=["$digit_n0$digit$digit tons of $material_solid were used to build a $adj_size $fortification!"]
s+=["It has been proved that $anything+$anything=$anything"]
s+=["By utilizing $adj_arcane techniques you can combine $anything with $anything to create the $adj_power $cutlery!"]
s+=["Have faith in $god and you will be $salvation!"]
s+=["Thou shalt witness my $superpower and tremble in fear, $adj_evil $demon"]
s+=["In the name of $element_magic, $outfit $creature shall $action_evil you and deliver $adj_death death you deserve!"]
s+=["$monster $relative\s will $action $person_who as they did in $year with $anything"]
s+=["spam time! $anything $anything $anything $anything"]
s+=["You need to ask $name the $humanoid for help if you want to take down $name, $adj_evil $monster"]
s+=["There are $w_old tales that mention a $weapon that can $sentence_powerful"]

def sentence():
	return parser.parse(random.choice(s)).to_string()

def text(string):
	print string, string.__class__
	return parser.parse(string).to_string()

if __name__=="__main__":
	for i in s:
		r= parser.parse(i).to_string()
		print r
		if "$" in r: raw_input()
	print "!!! Be wary that it is highly likely not all problems will be spotted with this simple test"