modifyGuild method
Future<Guild>
modifyGuild(
- String guildId, {
- String? name,
- String? region = '',
- int? verificationLevel = -1,
- int? defaultMessageNotifications = -1,
- int? explicitContentFilter = -1,
- String? afkChannelId = '',
- int? afkTimeout,
- String? icon = '',
- String? ownerId,
- String? splash = '',
- String? banner = '',
- String? systemChannelId = '',
- String? rulesChannelId = '',
- String? publicUpdatesChannelId = '',
- String? preferredLocale = '',
Implementation
Future<Guild> modifyGuild(
String guildId, {
String? name,
String? region = '',
// TODO https://discord.com/developers/docs/resources/guild#guild-object-verification-level
int? verificationLevel = -1,
// TODO https://discord.com/developers/docs/resources/guild#guild-object-default-message-notification-level
int? defaultMessageNotifications = -1,
// TODO https://discord.com/developers/docs/resources/guild#guild-object-explicit-content-filter-level
int? explicitContentFilter = -1,
String? afkChannelId = '',
int? afkTimeout,
String? icon = '',
String? ownerId,
String? splash = '',
String? banner = '',
String? systemChannelId = '',
String? rulesChannelId = '',
String? publicUpdatesChannelId = '',
String? preferredLocale = '',
}) {
var endpoint = '/guilds/$guildId';
return _http.request(
endpoint,
converter: Guild.fromJson,
method: 'patch',
body: {
...insertNotNull('name', name),
...insertNotDefault('region', region, ''),
...insertNotDefault('verification_level', verificationLevel, -1),
...insertNotDefault(
'default_message_notifications',
defaultMessageNotifications,
-1,
),
...insertNotDefault(
'explicit_content_filter',
explicitContentFilter,
-1,
),
...insertNotDefault('afk_channel_id', afkChannelId, ''),
...insertNotNull('afk_timeout', afkTimeout),
...insertNotDefault('icon', icon, ''),
...insertNotDefault('owner_id', ownerId, ''),
...insertNotDefault('splash', splash, ''),
...insertNotDefault('banner', banner, ''),
...insertNotDefault('system_channel_id', systemChannelId, ''),
...insertNotDefault('rules_channel_id', rulesChannelId, ''),
...insertNotDefault(
'public_updates_channel_id',
publicUpdatesChannelId,
'',
),
...insertNotDefault('preferred_locale', preferredLocale, ''),
},
);
}