コード例 #1
0
ファイル: kick.py プロジェクト: Corgano/pyrefly
def process(sender, type, args, client):
	comSend = sender.getResource()
	room = sender.getStripped()
	if xmppUtils.isModerator(room, comSend):
		if len(args) > 0:
			senderNick = sender.getResource()
			xmppUtils.setRole(room, args, 'none', '...cause the kickin\' boot has granted its powers to %s' %(comSend))
コード例 #2
0
ファイル: swearHandler.py プロジェクト: Corgano/pyrefly
def messageHandler(client, msg):
	room = msg.getFrom().getStripped()
	comSend = msg.getFrom().getResource()

	if config.get("nick") == comSend: return 0

	for word in badwords:
		try:
			if word.lower() in msg.getBody().lower():
				if random.randint(1,2) == 1: # The higher the second number is, the less chance of getting kicked but greater chance fo getting devoiced
					xmppUtils.sendMessage(room,'/me slaps ' + comSend + ' around a while, then hastily shows them the door.','groupchat')
					xmppUtils.setRole(room, comSend, 'none', 'Watch your language!')
					return 1

				else:
					xmppUtils.sendMessage(room,'/me rips out ' + comSend + "'s voice and beats him with it",'groupchat')
					xmppUtils.setRole(room, comSend, 'visitor')
					return 1
		except AttributeError:
			return 0

	for word in advwords:
		try:
			if word.lower() in msg.getBody().lower():
				xmppUtils.sendMessage(room, advwords[word],'groupchat')

		except AttributeError:
			return 0
コード例 #3
0
ファイル: devoice.py プロジェクト: Corgano/pyrefly
def process(sender, type, args, client):
	room = sender.getStripped()
	comSend = sender.getResource()
	if xmppUtils.isModerator(room, comSend):
		if len(args) > 0:
			senderNick = sender.getResource()
			xmppUtils.setRole(room, args, 'visitor', 'Requested by ' + senderNick)
	elif not xmppUtils.isAdmin(room, comSend):
		xmppUtils.sendMessage(room, 'Unauthorized.', type='groupchat')
コード例 #4
0
ファイル: scold.py プロジェクト: Corgano/pyrefly
def process(sender, type, args, client):
	comSend = sender.getResource()
	room = sender.getStripped()
	if xmppUtils.isAdmin(room, comSend):
		if len(args) >0:
			naughty = '/me slaps ' + args + ' around for five seconds. NAUGHTY.'
			nice = '/me bows and returns to his alcove.'
			xmppUtils.setRole(room, args, 'visitor')
			xmppUtils.sendMessage(room, naughty , type='groupchat')
			time.sleep(5) # This is ASKING for issues.
			xmppUtils.setRole(room, args, 'participant')
			xmppUtils.sendMessage(room, nice, type='groupchat')
	elif not xmppUtils.isAdmin(room, comSend):
		xmppUtils.sendMessage(room, 'Unauthorized.', type='groupchat')
コード例 #5
0
ファイル: say.py プロジェクト: Corgano/pyrefly
def process(sender, type, args, client):
	room = sender.getStripped()
	comSend = sender.getResource()
	room = sender.getStripped()
	if len(args) == 0:
		xmppUtils.sendMessage(room, helpText, type='groupchat')

	elif "!say !say !say" in args:
		xmppUtils.setRole(room, comSend, 'visitor', 'Recursion is not your friend!')
		xmppUtils.sendMessage(room, "Hush, you!", type='groupchat')
	elif "!say !say" in args:
		slap.process(sender, type, comSend, client)
	elif "!say" in args:
		xmppUtils.sendMessage(room, "nou.", type='groupchat')

	else :
		xmppUtils.sendMessage(room, args, type='groupchat')
コード例 #6
0
ファイル: modvoice.py プロジェクト: Corgano/pyrefly
def process(sender, type, args, client):
	args = args.split(' ', 2)
	action = args[0]
	if action == 'off':
		if len(args) > 1:
			room = sender.getStripped()
			senderNick = sender.getResource()
			xmppUtils.setRole(room, args[1], 'participant', 'Requested by ' + senderNick)
			xmppUtils.setRole(room, args[1], 'visitor')
		
	elif action == 'on':
		if len(args) > 1:
			room = sender.getStripped()
			xmppUtils.setRole(room, args[1], 'participant')
			xmppUtils.setRole(room, args[1], 'moderator')
コード例 #7
0
ファイル: shoot.py プロジェクト: Corgano/pyrefly
def process(sender, type, args, client):
	comSend = sender.getResource()
	room = sender.getStripped()
	if len(args) == 0:
		xmppUtils.sendMessage(room, helpText, type='groupchat')
	elif len(args) >= 1 and args == ('himself', 'herself'):
	#~	xmppUtils.sendMessage(room, '/me shoots ' + comSend + ' in the back of the head.'
		xmppUtils.setRole(room, comSend, 'none', random.choice(['Ouch.', 'Suicide...', 'Wait, why?', 'Nice Kurt Cobain imitation.']))
	elif len(args) > 0:
		fire = '/me shoots at %s with %s' % (args, random.choice(weapons))
		randaim = random.randint(1,100)
		if (randaim >= 80):
			xmppUtils.sendMessage(room, fire, type='groupchat')
			xmppUtils.setRole(room, args, 'none', random.choice(['BOOM. Headshot.', 'Ouch, that\'s gotta hurt.', 'He wont be in Rush Hour Three...', '...that\'s gonna leave a bruise in the mornin\'.']))

		elif (randaim >= 30):
			xmppUtils.sendMessage(room, fire, type='groupchat')
			xmppUtils.setRole(room, args, 'visitor')
			xmppUtils.sendMessage(room, random.choice(['Ouch, that\'s gotta hurt.', '...that\'s gonna leave a bruise in the mornin\'.', '\'Tis but a flesh wound!']), type='groupchat')

		elif (randaim <= 15):
			xmppUtils.sendMessage(room, fire, type='groupchat')
			xmppUtils.sendMessage(room, 'My apologies, it appears I missed horridly. Try again later.', type='groupchat')
コード例 #8
0
ファイル: voice.py プロジェクト: Corgano/pyrefly
def process(sender, type, args, client):
	if len(args) > 0:
		room = sender.getStripped()
		senderNick = sender.getResource()
		xmppUtils.setRole(room, args, 'participant', 'Requested by ' + senderNick)
コード例 #9
0
ファイル: mode.py プロジェクト: Corgano/pyrefly
def process(sender, type, args, client):
	room = sender.getStripped()
	args = args.split(' ', 2)
	if len(args) < 2:
		if len(args) == 1:
			return checkmode(args[0],room)
		else:
			return 0
	action = args[0]
	who = args[1]
	if action == 'check': checkmode(who,room)
	memGrant = '%s: Membership granted!' %(args[1])
	memRevoke = '%s: Membership revoked!' %(args[1])
	modGrant = '%s: Moderator permissions granted!' %(args[1])
	modRevoke = '%s: Moderator permissions revoked!' %(args[1])
	comSend = sender.getResource()

	if action == '+m':
		#works
		if xmppUtils.isAdmin(room, comSend):
			if len(args) > 1:
				xmppUtils.setAffiliation(room, who, 'member')
				xmppUtils.sendMessage(room, memGrant, type='groupchat')
		elif not xmppUtils.isAdmin(room, comSend):
			xmppUtils.sendMessage(room, 'Unauthorized.', type='groupchat')

	elif action == '+M':
		#works
		if xmppUtils.isAdmin(room, comSend):
			xmppUtils.setRole(room, who, 'moderator')
			xmppUtils.sendMessage(room, modGrant, type='groupchat')
		elif not xmppUtils.isAdmin(room, comSend):
			xmppUtils.sendMessage(room, 'Unauthorized.', type='groupchat')

	elif action == '+A':
		#TODO# Make work
		if xmppUtils.isOwner(room, comSend):
			xmppUtils.setAffiliation(room, who, 'administrator')

	elif action == '-m':
		#works
		if xmppUtils.isMod(room, comSend):
			if len(args) > 1:
				xmppUtils.setAffiliation(room, who, 'none')
				xmppUtils.sendMessage(room, memRevoke, type='groupchat')
		elif not xmppUtils.isAdmin(room, comSend):
			xmppUtils.sendMessage(room, 'Unauthorized.', type='groupchat')

	elif action == '-M':
		#works
		if xmppUtils.isAdmin(room, comSend):
			if len(args) > 1:
				xmppUtils.setRole(room, who, 'participant')
				xmppUtils.sendMessage(room, modRevoke, type='groupchat')
		elif not xmppUtils.isAdmin(room, comSend):
			xmppUtils.sendMessage(room, 'Unauthorized.', type='groupchat')

	elif action == '-A':
		#TODO# Make work
		if xmppUtils.isAdmin(room, comSend):
			xmppUtils.setAffiliation(room, who, 'member')

	elif action == 'help':
		if '+m' in args:
			xmppUtils.sendMessage(room, 'Admin: grants membership.', type='groupchat')
		elif '-m' in args:
			xmppUtils.sendMessage(room, 'Admin: revokes membership.', type='groupchat')
		elif '+M' in args:
			xmppUtils.sendMessage(room, 'Admin: grants moderator access.', type='groupchat')
		elif '-M' in args:
			xmppUtils.sendMessage(room, 'Admin: revokes moderator access.', type='groupchat')
		elif '+A' in args:
			xmppUtils.sendMessage(room, 'To be implemented: sets administrator privileges.', type='groupchat')
		elif '-A' in args:
			xmppUtils.sendMessage(room, 'To be implemented: revokes administrator privileges.', type='groupchat')