File tree Expand file tree Collapse file tree 5 files changed +19
-5
lines changed Expand file tree Collapse file tree 5 files changed +19
-5
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ class DiscordActivity {
16
16
/// [activity type] (https://discord.com/developers/docs/topics/gateway#activity-object-activity-types)
17
17
final int type;
18
18
19
- late final DiscordActivityType _typeAsEnum;
19
+ late final DiscordActivityType ? _typeAsEnum;
20
20
21
21
/// stream url, is validated when type is 1 (Streaming)
22
22
///
@@ -123,7 +123,8 @@ class DiscordActivity {
123
123
DateTime ? get createdAtAsDateTime =>
124
124
_createdAtAsDateTime ?? = DateTime .fromMillisecondsSinceEpoch (createdAt);
125
125
126
- DiscordActivityType get typeAsEnum => DiscordActivityType .values[type];
126
+ DiscordActivityType get typeAsEnum =>
127
+ _typeAsEnum ?? = DiscordActivityType .values[type];
127
128
128
129
// TODO: RECOVER FLAGS FROM BITSET IN DISCORD ACTIVITY
129
130
Original file line number Diff line number Diff line change 1
- import 'package:discord_api/src/models/discord_optional_audit_entry_info.dart' ;
2
1
import 'package:discord_api/src/models/discord_snowflake.dart' ;
3
2
4
3
import 'discord_overwrite.dart' ;
Original file line number Diff line number Diff line change @@ -92,6 +92,9 @@ class DiscordChannel {
92
92
this .permissions,
93
93
});
94
94
95
+ DiscordChannelType get typeAsEnum =>
96
+ _typeAsEnum ?? = DiscordChannelType .values[type];
97
+
95
98
DateTime ? get lastPinTimestampAsDateTime {
96
99
if (lastPinTimestamp == null ) return null ;
97
100
_lastPinTimestampAsDateTime ?? = DateTime .parse (lastPinTimestamp! );
@@ -100,7 +103,7 @@ class DiscordChannel {
100
103
101
104
DiscordVideoQualityMode ? get videoQualityModeAsEnum {
102
105
if (videoQualityMode == null ) return null ;
103
- _videoQualityModeAsEnum ?? =
106
+ return _videoQualityModeAsEnum ?? =
104
107
DiscordVideoQualityMode .values[videoQualityMode! ];
105
108
}
106
109
Original file line number Diff line number Diff line change @@ -134,6 +134,17 @@ class DiscordIntegration {
134
134
this .application,
135
135
});
136
136
137
+ DiscordIntegrationExpirationBehavior ? get expireBehaviorAsEnum {
138
+ if (expireBehavior == null ) return null ;
139
+ return _expireBehaviorAsEnum ?? =
140
+ DiscordIntegrationExpirationBehavior .values[expireBehavior! ];
141
+ }
142
+
143
+ DateTime ? get syncedAtAsDateTime {
144
+ _syncedAtAsDateTime ?? = syncedAt != null ? DateTime .parse (syncedAt! ) : null ;
145
+ return _syncedAtAsDateTime;
146
+ }
147
+
137
148
factory DiscordIntegration .fromJson (Map <String , dynamic > json) =>
138
149
DiscordIntegration (
139
150
id: DiscordSnowflake (json[idEntry] as String ),
Original file line number Diff line number Diff line change @@ -309,7 +309,7 @@ class DiscordMessage {
309
309
? List <DiscordReaction >.from (
310
310
(json[reactionsEntry]).map (DiscordReaction .fromJson))
311
311
: null ,
312
- nonce: json[nonceEntry] != null ? json[nonceEntry]. toString () : null ,
312
+ nonce: json[nonceEntry] as String ? ,
313
313
pinned: json[pinnedEntry] as bool ,
314
314
webhookId: json[webhookIdEntry] != null
315
315
? DiscordSnowflake (json[webhookIdEntry] as String )
You can’t perform that action at this time.
0 commit comments