setSplash method

Future<void> setSplash(
  1. String filename
)

Update the splash banner of this

This method requires the feature GuildFeature.banner of this

Example :

await guild.setSplash('assets/images/my_splash_banner.png');

Implementation

Future<void> setSplash (String filename) async {
  if (!features.contains(GuildFeature.banner)) {
    throw MissingFeatureException(cause: "The $name guild does not have the ${GuildFeature.inviteSplash} feature.");
  }

  String file = await Helper.getPicture(filename);

  Http http = ioc.singleton(Service.http);
  Response response = await http.patch(url: "/guilds/$id", payload: { 'splash': file });

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