#ifndef EXECBOT_H
#define EXECBOT_H

#include "telegrambotbase.h"
#include <QProcess>


class ExecBot : public TelegramBotBase
{
	Q_OBJECT
public:
	explicit ExecBot(QObject *parent = 0);


public slots:

private:
	enum UserState {
		NotLogged,
		Password,
		Ready,
		CommandExec
	};
	struct UserCommand {
		uint user;
		QProcess * cmd;
	};

	virtual QString loginMessage(uint id);
	virtual QString help();
	virtual bool loginUser(uint id, const QString & msg);
	virtual void messageFromUser(uint id, const QString & msg);
	void runCMD(UserCommand uc);

	QMap<uint, UserState> sessions;
	QVector<ExecBot::UserCommand> run_commands;

private slots:
	void cmdRead();
	void cmdFinish(int code);
	void saveFile(TelegramBotAPI::File fl);

signals:

};

#endif // EXECBOT_H
