mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Accept bot username in chatbot setup.
This commit is contained in:
parent
7092fe2242
commit
e6af33367e
1 changed files with 3 additions and 0 deletions
|
@ -226,6 +226,9 @@ Main::Session &PreviewController::session() const {
|
||||||
|
|
||||||
[[nodiscard]] QString ExtractUsername(QString text) {
|
[[nodiscard]] QString ExtractUsername(QString text) {
|
||||||
text = text.trimmed();
|
text = text.trimmed();
|
||||||
|
if (text.startsWith(QChar('@'))) {
|
||||||
|
return text.mid(1);
|
||||||
|
}
|
||||||
static const auto expression = QRegularExpression(
|
static const auto expression = QRegularExpression(
|
||||||
"^(https://)?([a-zA-Z0-9\\.]+/)?([a-zA-Z0-9_\\.]+)");
|
"^(https://)?([a-zA-Z0-9\\.]+/)?([a-zA-Z0-9_\\.]+)");
|
||||||
const auto match = expression.match(text);
|
const auto match = expression.match(text);
|
||||||
|
|
Loading…
Add table
Reference in a new issue