Sending text messages works... :D
This commit is contained in:
parent
c472e70775
commit
cc266aa58b
3 changed files with 20 additions and 1 deletions
|
@ -355,7 +355,9 @@ Page {
|
|||
icon.source: "image://theme/icon-m-chat"
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
onClicked: {
|
||||
// Send message
|
||||
tdLibWrapper.sendTextMessage(chatInformation.id, newMessageTextField.text);
|
||||
newMessageTextField.text = "";
|
||||
newMessageTextField.focus = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -180,6 +180,22 @@ void TDLibWrapper::viewMessage(const QString &chatId, const QString &messageId)
|
|||
this->sendRequest(requestObject);
|
||||
}
|
||||
|
||||
void TDLibWrapper::sendTextMessage(const QString &chatId, const QString &message)
|
||||
{
|
||||
qDebug() << "[TDLibWrapper] Sending text message " << chatId << message;
|
||||
QVariantMap requestObject;
|
||||
requestObject.insert("@type", "sendMessage");
|
||||
requestObject.insert("chat_id", chatId);
|
||||
QVariantMap inputMessageContent;
|
||||
inputMessageContent.insert("@type", "inputMessageText");
|
||||
QVariantMap formattedText;
|
||||
formattedText.insert("text", message);
|
||||
formattedText.insert("@type", "formattedText");
|
||||
inputMessageContent.insert("text", formattedText);
|
||||
requestObject.insert("input_message_content", inputMessageContent);
|
||||
this->sendRequest(requestObject);
|
||||
}
|
||||
|
||||
QVariantMap TDLibWrapper::getUserInformation()
|
||||
{
|
||||
return this->userInformation;
|
||||
|
|
|
@ -78,6 +78,7 @@ public:
|
|||
Q_INVOKABLE void closeChat(const QString &chatId);
|
||||
Q_INVOKABLE void getChatHistory(const QString &chatId, const qlonglong &fromMessageId = 0, const int &offset = 0, const int &limit = 50, const bool &onlyLocal = false);
|
||||
Q_INVOKABLE void viewMessage(const QString &chatId, const QString &messageId);
|
||||
Q_INVOKABLE void sendTextMessage(const QString &chatId, const QString &message);
|
||||
|
||||
signals:
|
||||
void versionDetected(const QString &version);
|
||||
|
|
Loading…
Reference in a new issue