/// <inheritdoc /> public async Task <Result> RespondAsync(IMessageUpdate gatewayEvent, CancellationToken ct = default) { if (!gatewayEvent.Author.HasValue) { return(Result.FromSuccess()); } if (gatewayEvent.Author.Value.IsBot.Value || gatewayEvent.Author.Value.IsSystem.Value) { return(Result.FromSuccess()); } if (!gatewayEvent.GuildID.IsDefined(out var guildID)) { return(Result.FromSuccess()); } // Ignore all changes except text changes var isTextUpdate = gatewayEvent.EditedTimestamp.HasValue && gatewayEvent.EditedTimestamp.Value > DateTimeOffset.UtcNow - 1.Minutes(); if (!isTextUpdate) { return(Result.FromSuccess()); } return(await _roleplays.ConsumeMessageAsync(gatewayEvent, guildID)); }
public async Task <Result> RespondAsync(IMessageUpdate gatewayEvent, CancellationToken ct = default) { var key = KeyHelpers.CreateMessageCacheKey(gatewayEvent.ChannelID.Value, gatewayEvent.ID.Value); _cache.TryGetValue <IMessage>(key, out var previousMessage); await HandleNotificationAsync(gatewayEvent, previousMessage, ct); return(Result.FromSuccess()); }
public async Task <Result> RespondAsync(IMessageUpdate message, CancellationToken ct = default) { await TryCheckMessageAsync(message, ct); return(Result.FromSuccess()); }