File tree Expand file tree Collapse file tree 1 file changed +25
-4
lines changed Expand file tree Collapse file tree 1 file changed +25
-4
lines changed Original file line number Diff line number Diff line change 1
1
part of discord;
2
2
3
3
/// A game.
4
- class Game extends _BaseObj {
4
+ class Game {
5
5
/// The game name.
6
6
String name;
7
7
@@ -11,9 +11,22 @@ class Game extends _BaseObj {
11
11
/// The game URL, if provided.
12
12
String url;
13
13
14
- Game ._new (Client client, Map <String , dynamic > data) : super (client) {
15
- this .name = data['name' ];
16
- this .url = data['url' ];
14
+ /// Makes a new game object.
15
+ Game (this .name, {this .type: 0 , this .url});
16
+
17
+ Game ._new (Client client, Map <String , dynamic > data) {
18
+ try {
19
+ this .name = data['name' ].toString ();
20
+ } catch (err) {
21
+ this .name = null ;
22
+ }
23
+
24
+ try {
25
+ this .url = data['url' ].toString ();
26
+ } catch (err) {
27
+ this .url = null ;
28
+ }
29
+
17
30
if (data['type' ] is int ) {
18
31
this .type = data['type' ];
19
32
} else if (data['type' ] is String ) {
@@ -24,4 +37,12 @@ class Game extends _BaseObj {
24
37
}
25
38
}
26
39
}
40
+
41
+ Map <String , dynamic > _toMap () {
42
+ Map <String , dynamic > map = new Map <String , dynamic >();
43
+ map['name' ] = this .name;
44
+ map['type' ] = this .type;
45
+ map['url' ] = this .url;
46
+ return map;
47
+ }
27
48
}
You can’t perform that action at this time.
0 commit comments