Skip to content

Commit

Permalink
fix: Update Webhook ChannelId from model change (#1791)
Browse files Browse the repository at this point in the history
  • Loading branch information
AntiTcb committed Mar 10, 2021
1 parent 51b7afe commit d2518db
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/Discord.Net.Rest/Entities/Webhooks/RestWebhook.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ public class RestWebhook : RestEntity<ulong>, IWebhook, IUpdateable
internal IGuild Guild { get; private set; }
internal ITextChannel Channel { get; private set; }

/// <inheritdoc />
public ulong ChannelId { get; }
/// <inheritdoc />
public string Token { get; }

/// <inheritdoc />
public ulong ChannelId { get; private set; }
/// <inheritdoc />
public string Name { get; private set; }
/// <inheritdoc />
Expand Down Expand Up @@ -56,6 +56,8 @@ internal static RestWebhook Create(BaseDiscordClient discord, ITextChannel chann

internal void Update(Model model)
{
if (ChannelId != model.ChannelId)
ChannelId = model.ChannelId;
if (model.Avatar.IsSpecified)
AvatarId = model.Avatar.Value;
if (model.Creator.IsSpecified)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Diagnostics;
using System.Threading.Tasks;
using Model = Discord.API.Webhook;
Expand All @@ -11,9 +11,9 @@ internal class RestInternalWebhook : IWebhook
private DiscordWebhookClient _client;

public ulong Id { get; }
public ulong ChannelId { get; }
public string Token { get; }

public ulong ChannelId { get; private set; }
public string Name { get; private set; }
public string AvatarId { get; private set; }
public ulong? GuildId { get; private set; }
Expand All @@ -36,6 +36,8 @@ internal static RestInternalWebhook Create(DiscordWebhookClient client, Model mo

internal void Update(Model model)
{
if (ChannelId != model.ChannelId)
ChannelId = model.ChannelId;
if (model.Avatar.IsSpecified)
AvatarId = model.Avatar.Value;
if (model.GuildId.IsSpecified)
Expand Down

0 comments on commit d2518db

Please sign in to comment.