Browse Source

Modify the cache with EditServer's response

tags/docs-0.9
RogueException 9 years ago
parent
commit
8ae78f1989
1 changed files with 5 additions and 2 deletions
  1. +5
    -2
      src/Discord.Net/DiscordClient.API.cs

+ 5
- 2
src/Discord.Net/DiscordClient.API.cs View File

@@ -769,12 +769,15 @@ namespace Discord
public Task EditServer(Server server) public Task EditServer(Server server)
=> EditServer(server?.Id); => EditServer(server?.Id);
/// <summary> Edits the provided server, changing only non-null attributes. </summary> /// <summary> Edits the provided server, changing only non-null attributes. </summary>
public Task EditServer(string serverId, string name = null, string region = null)
public async Task EditServer(string serverId, string name = null, string region = null)
{ {
CheckReady(); CheckReady();
if (serverId == null) throw new ArgumentNullException(nameof(serverId)); if (serverId == null) throw new ArgumentNullException(nameof(serverId));


return _api.EditServer(serverId, name: name, region: region);
var response = await _api.EditServer(serverId, name: name, region: region);
var server = _servers[response.Id];
if (server != null)
server.Update(response);
} }


/// <summary> Leaves the provided server, destroying it if you are the owner. </summary> /// <summary> Leaves the provided server, destroying it if you are the owner. </summary>


Loading…
Cancel
Save