-
-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
301 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* 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'; | ||
|
||
/// The message was originally sent to a channel chat. | ||
/// | ||
/// https://core.telegram.org/bots/api#messageoriginchannel | ||
@JsonSerializable(fieldRename: FieldRename.snake) | ||
class MessageOriginChannel implements MessageOrigin { | ||
@override | ||
MessageOriginType type; | ||
@override | ||
int date; | ||
Chat chat; | ||
int messageId; | ||
String? authorSignature; | ||
|
||
MessageOriginChannel({ | ||
required this.type, | ||
required this.date, | ||
required this.chat, | ||
required this.messageId, | ||
this.authorSignature, | ||
}); | ||
|
||
@override | ||
@JsonKey(includeFromJson: false, includeToJson: false) | ||
DateTime get date_ => | ||
TimeHelper.toDateTime(date); | ||
@override | ||
set date_(DateTime dateTime) => | ||
date = TimeHelper.toUnixTime(dateTime); | ||
|
||
factory MessageOriginChannel.fromJson(Map<String, dynamic> json) => | ||
_$MessageOriginChannelFromJson(json); | ||
@override | ||
Map<String, dynamic> toJson() => _$MessageOriginChannelToJson(this); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* 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'; | ||
|
||
/// The message was originally sent on behalf of a chat to a group chat. | ||
/// | ||
/// https://core.telegram.org/bots/api#messageoriginchat | ||
@JsonSerializable(fieldRename: FieldRename.snake) | ||
class MessageOriginChat implements MessageOrigin { | ||
@override | ||
MessageOriginType type; | ||
@override | ||
int date; | ||
Chat senderChat; | ||
String? authorSignature; | ||
|
||
MessageOriginChat({ | ||
required this.type, | ||
required this.date, | ||
required this.senderChat, | ||
this.authorSignature, | ||
}); | ||
|
||
@override | ||
@JsonKey(includeFromJson: false, includeToJson: false) | ||
DateTime get date_ => | ||
TimeHelper.toDateTime(date); | ||
@override | ||
set date_(DateTime dateTime) => | ||
date = TimeHelper.toUnixTime(dateTime); | ||
|
||
factory MessageOriginChat.fromJson(Map<String, dynamic> json) => | ||
_$MessageOriginChatFromJson(json); | ||
@override | ||
Map<String, dynamic> toJson() => _$MessageOriginChatToJson(this); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* 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'; | ||
|
||
/// The message was originally sent by an unknown user. | ||
/// | ||
/// https://core.telegram.org/bots/api#messageoriginhiddenuser | ||
@JsonSerializable(fieldRename: FieldRename.snake) | ||
class MessageOriginHiddenUser implements MessageOrigin { | ||
@override | ||
MessageOriginType type; | ||
@override | ||
int date; | ||
String senderUserName; | ||
|
||
MessageOriginHiddenUser({ | ||
required this.type, | ||
required this.date, | ||
required this.senderUserName, | ||
}); | ||
|
||
@override | ||
@JsonKey(includeFromJson: false, includeToJson: false) | ||
DateTime get date_ => | ||
TimeHelper.toDateTime(date); | ||
@override | ||
set date_(DateTime dateTime) => | ||
date = TimeHelper.toUnixTime(dateTime); | ||
|
||
factory MessageOriginHiddenUser.fromJson(Map<String, dynamic> json) => | ||
_$MessageOriginHiddenUserFromJson(json); | ||
@override | ||
Map<String, dynamic> toJson() => _$MessageOriginHiddenUserToJson(this); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* 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'; | ||
|
||
/// The message was originally sent by a known user. | ||
/// | ||
/// https://core.telegram.org/bots/api#messageoriginuser | ||
@JsonSerializable(fieldRename: FieldRename.snake) | ||
class MessageOriginUser implements MessageOrigin { | ||
@override | ||
MessageOriginType type; | ||
@override | ||
int date; | ||
User senderUser; | ||
|
||
MessageOriginUser({ | ||
required this.type, | ||
required this.date, | ||
required this.senderUser, | ||
}); | ||
|
||
@override | ||
@JsonKey(includeFromJson: false, includeToJson: false) | ||
DateTime get date_ => | ||
TimeHelper.toDateTime(date); | ||
@override | ||
set date_(DateTime dateTime) => | ||
date = TimeHelper.toUnixTime(dateTime); | ||
|
||
factory MessageOriginUser.fromJson(Map<String, dynamic> json) => | ||
_$MessageOriginUserFromJson(json); | ||
@override | ||
Map<String, dynamic> toJson() => _$MessageOriginUserToJson(this); | ||
} |