setDiscoverySplash method

Future<void> setDiscoverySplash(
  1. String filename
)

Update the discovery splash banner of this

This method requires the feature GuildFeature.banner of this

Example :

await guild.setDiscoverySplash('assets/images/my_splash_discovery_banner.png');

Implementation

Future<void> setDiscoverySplash (String filename) async {
  if (!features.contains(GuildFeature.banner)) {
    throw MissingFeatureException('The $name guild does not have the ${GuildFeature.discoverable} feature.');
  }

  String file = await Helper.getPicture(filename);

  Response response = await ioc.use<HttpService>().patch(url: "/guilds/$id", payload: { 'discovery_splash': file });

  if (response.statusCode == 200) {
    _discoverySplash = ImageFormater(file, '');
  }
}