Skip to content

Commit

Permalink
implemented text quote
Browse files Browse the repository at this point in the history
  • Loading branch information
DinoLeung committed Apr 6, 2024
1 parent 0c6407a commit a5e5776
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/src/teledart/model/message.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class TeleDartMessage extends Message {
isAutomaticForward: message.isAutomaticForward,
replyToMessage: message.replyToMessage,
externalReply: message.externalReply,
quote: message.quote,
viaBot: message.viaBot,
editDate: message.editDate,
hasProtectedContent: message.hasProtectedContent,
Expand Down
1 change: 1 addition & 0 deletions lib/src/telegram/model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ part 'models/sticker.dart';
part 'models/story.dart';
part 'models/successful_payment.dart';
part 'models/switch_inline_query_chosen_chat.dart';
part 'models/text_quote.dart';
part 'models/update.dart';
part 'models/user_profile_photos.dart';
part 'models/user_shared.dart';
Expand Down
30 changes: 30 additions & 0 deletions lib/src/telegram/model.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions lib/src/telegram/models/message.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class Message {
bool? isAutomaticForward;
Message? replyToMessage;
ExternalReplyInfo? externalReply;
TextQuote? quote;
User? viaBot;
int? editDate;
bool? hasProtectedContent;
Expand Down Expand Up @@ -104,6 +105,7 @@ class Message {
this.isAutomaticForward,
this.replyToMessage,
this.externalReply,
this.quote,
this.viaBot,
this.editDate,
this.hasProtectedContent,
Expand Down
42 changes: 42 additions & 0 deletions lib/src/telegram/models/text_quote.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* TeleDart - Telegram Bot API for Dart
* Copyright (C) 2024 Dino PH Leung
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

part of '../model.dart';

/// This object contains information about the quoted part of a message
/// that is replied to by the given message.
///
/// https://core.telegram.org/bots/api#textquote
@JsonSerializable(fieldRename: FieldRename.snake)
class TextQuote {
String text;
List<MessageEntity>? entities;
int position;
bool? isManual;

TextQuote({
required this.text,
this.entities,
required this.position,
this.isManual,
});

factory TextQuote.fromJson(Map<String, dynamic> json) =>
_$TextQuoteFromJson(json);
Map<String, dynamic> toJson() => _$TextQuoteToJson(this);
}

0 comments on commit a5e5776

Please sign in to comment.