示例#1
0
文件: app.py 项目: RettPop/petrovich
def process(chat_id, message, date):
	chat = Chat(chat_id)

	if chat.is_exist() == False:
		chat.create()
		channels = config.get("channels");
		for channel in channels:
			chat.subscribe(channel["name"], Type.Auto)
		bot.broadcast_message(chat_id, str(config.get("hello_message")));
		return;
		
	try:
		command = bot.decode_command(message)
		args = message.split()
		args.pop(0)
		bot.execute(command, chat_id, args, date)
	except KeyError:
		print "Nothing to command"
	
	return chat
示例#2
0
def process(chat_id, message, date):
    chat = Chat(chat_id)

    if chat.is_exist() == False:
        chat.create()
        channels = config.get("channels")
        for channel in channels:
            chat.subscribe(channel["name"], Type.Auto)
        bot.broadcast_message(chat_id, str(config.get("hello_message")))
        return

    try:
        command = bot.decode_command(message)
        args = message.split()
        args.pop(0)
        bot.execute(command, chat_id, args, date)
    except KeyError:
        print "Nothing to command"

    return chat