Skip to content

Commit

Permalink
updated message class
Browse files Browse the repository at this point in the history
  • Loading branch information
DinoLeung committed Aug 26, 2023
1 parent 4829864 commit a23c193
Show file tree
Hide file tree
Showing 6 changed files with 110 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/src/teledart/model/message.dart
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ class TeleDartMessage extends Message {
pinnedMessage: message.pinnedMessage,
invoice: message.invoice,
successfulPayment: message.successfulPayment,
userShared: message.userShared,
chatShared: message.chatShared,
connectedWebsite: message.connectedWebsite,
writeAccessAllowed: message.writeAccessAllowed,
passportData: message.passportData,
Expand Down
2 changes: 2 additions & 0 deletions lib/src/telegram/model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ part 'models/chat_member_updated.dart';
part 'models/chat_member.dart';
part 'models/chat_permissions.dart';
part 'models/chat_photo.dart';
part 'models/chat_shared.dart';
part 'models/chat.dart';
part 'models/chosen_inline_result.dart';
part 'models/contact.dart';
Expand Down Expand Up @@ -152,6 +153,7 @@ part 'models/sticker.dart';
part 'models/successful_payment.dart';
part 'models/update.dart';
part 'models/user_profile_photos.dart';
part 'models/user_shared.dart';
part 'models/user.dart';
part 'models/venue.dart';
part 'models/video_note.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.

36 changes: 36 additions & 0 deletions lib/src/telegram/models/chat_shared.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* TeleDart - Telegram Bot API for Dart
* Copyright (C) 2023 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 chat whose identifier was
/// shared with the bot using a [KeyboardButtonRequestChat] button.
///
/// https://core.telegram.org/bots/api#chatshared
@JsonSerializable(fieldRename: FieldRename.snake)
class ChatShared {
int requestId;
int userId;
ChatShared({
required this.requestId,
required this.userId,
});
factory ChatShared.fromJson(Map<String, dynamic> json) =>
_$ChatSharedFromJson(json);
Map<String, dynamic> toJson() => _$ChatSharedToJson(this);
}
4 changes: 4 additions & 0 deletions lib/src/telegram/models/message.dart
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ class Message {
Message? pinnedMessage;
Invoice? invoice;
SuccessfulPayment? successfulPayment;
UserShared? userShared;
ChatShared? chatShared;
String? connectedWebsite;
WriteAccessAllowed? writeAccessAllowed;
PassportData? passportData;
Expand Down Expand Up @@ -147,6 +149,8 @@ class Message {
this.pinnedMessage,
this.invoice,
this.successfulPayment,
this.userShared,
this.chatShared,
this.connectedWebsite,
this.writeAccessAllowed,
this.passportData,
Expand Down
36 changes: 36 additions & 0 deletions lib/src/telegram/models/user_shared.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* TeleDart - Telegram Bot API for Dart
* Copyright (C) 2023 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 user whose identifier was
/// shared with the bot using a [KeyboardButtonRequestUser] button.
///
/// https://core.telegram.org/bots/api#usershared
@JsonSerializable(fieldRename: FieldRename.snake)
class UserShared {
int requestId;
int userId;
UserShared({
required this.requestId,
required this.userId,
});
factory UserShared.fromJson(Map<String, dynamic> json) =>
_$UserSharedFromJson(json);
Map<String, dynamic> toJson() => _$UserSharedToJson(this);
}

0 comments on commit a23c193

Please sign in to comment.