Accept bot username in chatbot setup.

This commit is contained in:
John Preston 2024-10-17 12:03:01 +04:00
parent 7092fe2242
commit e6af33367e

View file

@ -226,6 +226,9 @@ Main::Session &PreviewController::session() const {
[[nodiscard]] QString ExtractUsername(QString text) {
text = text.trimmed();
if (text.startsWith(QChar('@'))) {
return text.mid(1);
}
static const auto expression = QRegularExpression(
"^(https://)?([a-zA-Z0-9\\.]+/)?([a-zA-Z0-9_\\.]+)");
const auto match = expression.match(text);