Пример #1
0
def quit(param):
	''' Shuts down the bot. Only possible if you are the owner of the bot! '''
	if OWNER == get_username(registry.cmdinterpreter.current_sender):
		send_message(registry.cmdinterpreter.current_channel, 'Goodbye :)')
		sys.exit()
	else:
		return u'You are not allowed to shut me down D:<'
Пример #2
0
	def log_message(self, user, message, channel):
		print(LOG_MESSAGE_FORMAT % {
			'channel':  channel,
			'time':     self.get_current_time(),
			'username': get_username(user),
			'message':  message
		})
Пример #3
0
def leave_action(param):
	''' Removes you or the person in the parameter  from the list of users who participate in an action set by #thatsup. '''
	c = db.cursor()
	c.execute('SELECT id, active FROM whatsup WHERE channel = ? ORDER BY id DESC LIMIT 0,1', (registry.cmdinterpreter.current_channel,))
	result = c.fetchone()
	if result != None and result[1] != 0:
		if param == '':
			param = get_username(registry.cmdinterpreter.current_sender)
		db.execute('DELETE FROM whatsup_users WHERE whatsup_id = ? AND username = ?', (result[0], param))
	return get_whatsup('')
Пример #4
0
def join_action(param):
	''' Adds you or the person in the parameter to the current activity that is going on (see #whatsup). '''
	c = db.cursor()
	c.execute('SELECT id, active FROM whatsup WHERE channel = ? ORDER BY id DESC LIMIT 0,1', (registry.cmdinterpreter.current_channel,))
	result = c.fetchone()
	if result != None and result[1] != 0:
		if param == '':
			param = get_username(registry.cmdinterpreter.current_sender)
		c.execute('SELECT whatsup_id FROM whatsup_users WHERE whatsup_id = ? AND username = ?', (result[0], param))
		if c.fetchone() == None:
			db.execute('INSERT INTO whatsup_users VALUES (?, ?)', (result[0], param))
			return get_whatsup('')
		else:
			return u'%s is already in the list!' % param