Start to add in some networking stuff
This commit is contained in:
parent
b820274f95
commit
15d80c1ab3
5 changed files with 93 additions and 7 deletions
|
@ -4,7 +4,7 @@ import 'package:libac_dart/discord/structures/user.dart';
|
|||
import 'package:libac_dart/structs/Snowflake.dart';
|
||||
import 'package:libac_dart/utils/DictTools.dart';
|
||||
|
||||
class ApplicationPacket {
|
||||
class Application {
|
||||
bool botPublic;
|
||||
bool botRequiresCodeGrant;
|
||||
String? coverImage;
|
||||
|
@ -19,7 +19,7 @@ class ApplicationPacket {
|
|||
String? slug;
|
||||
String summary;
|
||||
|
||||
ApplicationPacket(
|
||||
Application(
|
||||
{required this.botPublic,
|
||||
required this.botRequiresCodeGrant,
|
||||
this.coverImage,
|
||||
|
@ -65,11 +65,11 @@ class ApplicationPacket {
|
|||
return json.encode(toJson());
|
||||
}
|
||||
|
||||
factory ApplicationPacket.fromJson(String js) {
|
||||
return ApplicationPacket.decode(json.decode(js));
|
||||
factory Application.fromJson(String js) {
|
||||
return Application.decode(json.decode(js));
|
||||
}
|
||||
|
||||
factory ApplicationPacket.decode(Map<String, dynamic> js) {
|
||||
factory Application.decode(Map<String, dynamic> js) {
|
||||
Map<String, ApplicationIntegrationType>? itc = null;
|
||||
if (js.containsKey("integration_types_config")) {
|
||||
itc = {};
|
||||
|
@ -80,7 +80,7 @@ class ApplicationPacket {
|
|||
}
|
||||
}
|
||||
|
||||
return ApplicationPacket(
|
||||
return Application(
|
||||
botPublic: js['bot_public'] as bool,
|
||||
botRequiresCodeGrant: js['bot_require_code_grant'] as bool,
|
||||
coverImage: setor(js, 'cover_image', null),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue