diff --git a/lib/src/classes/guild/guild.dart b/lib/src/classes/guild/guild.dart index 168e84b..a367098 100644 --- a/lib/src/classes/guild/guild.dart +++ b/lib/src/classes/guild/guild.dart @@ -39,8 +39,21 @@ class Guild { String? systemChannelId; // x | x | int? systemChannelFlags; // x | x | String? rulesChannelId; // x | x | - - String? description; + int? maxPresences; // x | x | + int? maxMembers; // x | x | + String? vanityUrlCode; // x | x | + String? description; // x | x | + String? banner; // x | x | + int? premiumTier; // x | x | + int? premiumSubscriptionCount; // x | x | + String? preferredLocale; // x | x | + String? publicUpdatesChannelId; // x | x | + int? maxVideoChannelUsers; // x | x | + int? maxStageVideoChannelUsers; // | x | x + int? approximateMemberCount; // | x | x + int? approximatePresenceCount; // | x | x + bool? premiumProgressBarEnabled;// x | x | + String? safetyAlertsChannelId; // x | x | String? joinedAt; // x | | bool? large; // x | | int? memberCount; // x | | @@ -101,8 +114,26 @@ class Guild { systemChannelId = data["system_channel_id"]; systemChannelFlags = data["system_channel_flags"]; rulesChannelId = data["rules_channel_id"]; + maxPresences = data["max_presences"]; + maxMembers = data["max_members"]; + vanityUrlCode = data["vanity_url_code"]; description = data["description"]; + banner = data["banner"]; + premiumTier = data["premium_tier"]; + premiumSubscriptionCount = data["premium_subscription_count"]; + preferredLocale = data["preferred_locale"]; + publicUpdatesChannelId = data["public_updates_channel_id"]; + maxVideoChannelUsers = data["max_video_channel_users"]; + maxStageVideoChannelUsers = data["max_stage_video_channel_users"]; + premiumProgressBarEnabled = data["premium_progress_bar_enabled"]; + safetyAlertsChannelId = data["safety_alerts_channel_id"]; + if (data["approximate_member_count"] != null) { + approximateMemberCount = data["approximate_member_count"]; + } + if (data["approximate_presence_count"] != null) { + approximatePresenceCount = data["approximate_presence_count"]; + } // GuildCreate only if (data["joined_at"] != null) { joinedAt = data["joined_at"]; diff --git a/lib/src/classes/guild/guild_manager.dart b/lib/src/classes/guild/guild_manager.dart index 08f7695..27a14b8 100644 --- a/lib/src/classes/guild/guild_manager.dart +++ b/lib/src/classes/guild/guild_manager.dart @@ -13,7 +13,7 @@ class GuildManager { } Future fetch(String id) async { - var res = await _sender.fetchGuild(id); + var res = await _sender.fetchGuild(id, withCounts: true); final guild = Guild(_sender, res); Guild oldGuild = cache.get(guild.id); oldGuild.members?.cache.values().forEach((member) { diff --git a/lib/src/main.dart b/lib/src/main.dart index c83d70b..fd347d6 100644 --- a/lib/src/main.dart +++ b/lib/src/main.dart @@ -85,7 +85,7 @@ class Client extends EventEmitter { } Sender sender = Sender(token); - var i = await sender.getServers(); + var i = await sender.fetchGuilds(withCounts: true); List gg = []; diff --git a/lib/src/requests.dart b/lib/src/requests.dart index a6356a0..7d0c8af 100644 --- a/lib/src/requests.dart +++ b/lib/src/requests.dart @@ -45,8 +45,8 @@ class Sender { }; } - Future getServers() async { - final url = Uri.parse("$apiURL/users/@me/guilds"); + Future fetchGuilds({ bool withCounts = false }) async { + final url = Uri.parse("$apiURL/users/@me/guilds?with_counts=$withCounts"); dynamic res = await http.get(url, headers: headers); res = json.decode(res.body); return res; @@ -59,8 +59,8 @@ class Sender { return res; } - Future fetchGuild(String id) async { - dynamic res = await http.get(Uri.parse("$apiURL/guilds/$id"), headers: headers); + Future fetchGuild(String id, { bool withCounts = false }) async { + dynamic res = await http.get(Uri.parse("$apiURL/guilds/$id?with_counts=$withCounts"), headers: headers); if (res.statusCode != 200) { throw Exception("Error ${res.statusCode} receiving the guild"); }