Skip to content

Commit

Permalink
hotfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
KyouinDev committed Apr 13, 2024
1 parent fb16fad commit afe5991
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 25 deletions.
17 changes: 16 additions & 1 deletion lib/src/entities/telegram/enums.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ class _Enum<T> {
String toJson() => '$this';
}

//TODO: Update enum
/// UpdateType for GetUpdates
class UpdateType extends _Enum<String> {
/// Message
Expand All @@ -26,6 +25,12 @@ class UpdateType extends _Enum<String> {
/// EditedChannelPost
static const editedChannelPost = UpdateType._('edited_channel_post');

/// MessageReaction
static const messageReaction = UpdateType._('message_reaction');

/// MessageReactionCount
static const messageReactionCount = UpdateType._('message_reaction_count');

/// InlineQuery
static const inlineQuery = UpdateType._('inline_query');

Expand Down Expand Up @@ -56,12 +61,20 @@ class UpdateType extends _Enum<String> {
/// ChatJoinRequest
static const chatJoinRequest = UpdateType._('chat_join_request');

/// ChatBoost
static const chatBoost = UpdateType._('chat_boost');

/// RemovedChatBoost
static const removedChatBoost = UpdateType._('removed_chat_boost');

/// Values
static const values = {
'message': message,
'edited_message': editedMessage,
'channel_post': channelPost,
'edited_channel_post': editedChannelPost,
'message_reaction': messageReaction,
'message_reaction_count': messageReactionCount,
'inline_query': inlineQuery,
'chosen_inline_result': chosenInlineResult,
'callback_query': callbackQuery,
Expand All @@ -72,6 +85,8 @@ class UpdateType extends _Enum<String> {
'my_chat_member': myChatMember,
'chat_member': chatMember,
'chat_join_request': chatJoinRequest,
'chat_boost': chatBoost,
'removed_chat_boost': removedChatBoost,
};

/// Get a list with all UpdateType
Expand Down
2 changes: 1 addition & 1 deletion lib/src/entities/telegram/giveaway_created.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class GiveawayCreated {
GiveawayCreated();

/// Creates a object from json
factory GiveawayCreated.fromJson(Map<String, dynamic> json) {
factory GiveawayCreated.fromJson(Map<String, dynamic> _) {
return GiveawayCreated();
}

Expand Down
2 changes: 1 addition & 1 deletion lib/src/entities/telegram/message_origin_channel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import '../../../telegram_entities.dart';
class MessageOriginChannel extends MessageOrigin {
/// Type of the message origin, always “channel”
@override
String type = 'user';
String type = 'channel';

/// Date the message was sent originally in Unix time
int date;
Expand Down
2 changes: 1 addition & 1 deletion lib/src/entities/telegram/message_origin_chat.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import '../../../telegram_entities.dart';
class MessageOriginChat extends MessageOrigin {
/// Type of the message origin, always “chat”
@override
String type = 'user';
String type = 'chat';

/// Date the message was sent originally in Unix time
int date;
Expand Down
2 changes: 1 addition & 1 deletion lib/src/entities/telegram/message_origin_hidden_user.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import '../../../telegram_entities.dart';
class MessageOriginHiddenUser extends MessageOrigin {
/// Type of the message origin, always “hidden_user”
@override
String type = 'user';
String type = 'hidden_user';

/// Date the message was sent originally in Unix time
int date;
Expand Down
19 changes: 1 addition & 18 deletions lib/src/entities/telegram/reply_parameters.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import 'dart:convert';

import '../../../telegram_entities.dart';
import '../internal/helpers/util.dart';

/// Describes reply parameters for the message that is being sent.
class ReplyParameters {
Expand Down Expand Up @@ -36,7 +35,7 @@ class ReplyParameters {
/// Optional.
/// Mode for parsing entities in the quote.
/// See formatting options for more details.
String? quoteParseMode;
ParseMode? quoteParseMode;

/// Optional.
/// A JSON-serialized list of special entities that appear in the quote.
Expand All @@ -58,22 +57,6 @@ class ReplyParameters {
this.quotePosition,
});

/// Creates a object from a json
factory ReplyParameters.fromJson(Map<String, dynamic> json) {
return ReplyParameters(
json['message_id'],
chatId: callIfNotNull(ChatID.fromJson, json['chat_id']),
allowSendingWithoutReply: json['allow_sending_without_reply'],
quote: json['quote'],
quoteParseMode: json['quote_parse_mode'],
quoteEntities: callIfNotNull(
MessageEntity.listFromJsonArray,
json['quote_entities'],
),
quotePosition: json['quote_position'],
);
}

/// Creates a json from the object
Map toJson() {
return {
Expand Down
4 changes: 2 additions & 2 deletions lib/src/entities/telegram/update.dart
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class Update {
/// Optional.
/// A chat boost was added or changed.
/// The bot must be an administrator in the chat to receive these updates.
ChatBoost? chatBoost;
ChatBoostUpdated? chatBoost;

/// Optional.
/// A boost was removed from a chat.
Expand Down Expand Up @@ -203,7 +203,7 @@ class Update {
json['chat_join_request'],
),
chatBoost: callIfNotNull(
ChatBoost.fromJson,
ChatBoostUpdated.fromJson,
json['chat_boost'],
),
removedChatBoost: callIfNotNull(
Expand Down

0 comments on commit afe5991

Please sign in to comment.