コード例 #1
0
        private Task RunAsync(MessageDeletePayload payload, CoreMessage?message)
        {
            Client.Logger.Information(
                "Received Deleted Message [{Id}] with content '{Content}'.", payload.Id,
                message?.Content ?? "Unknown.");

            return(Task.CompletedTask);
        }
コード例 #2
0
        private async Task RunAsync(MessageDeletePayload messageDeletePayload)
        {
            var message = await Client.Cache.Messages.GetAsync(messageDeletePayload.Id, messageDeletePayload.ChannelId);

            if (message == null)
            {
                await Client.Cache.EditableMessages.DeleteAsync(messageDeletePayload.Id,
                                                                messageDeletePayload.ChannelId);
            }
            else
            {
                await Task.WhenAll(
                    Client.Cache.Messages.DeleteAsync(messageDeletePayload.Id, messageDeletePayload.ChannelId),
                    Client.Cache.EditableMessages.DeleteAsync(messageDeletePayload.Id, messageDeletePayload.ChannelId));
            }

            await Client.EventHandler.OnMessageDeleteAsync(messageDeletePayload, message);
        }
コード例 #3
0
 private async Task RunAsync(MessageDeletePayload messageDeletePayload)
 {
     await Task.WhenAll(
         Client.Cache.Messages.DeleteAsync(messageDeletePayload.Id, messageDeletePayload.ChannelId),
         Client.Cache.EditableMessages.DeleteAsync(messageDeletePayload.Id, messageDeletePayload.ChannelId));
 }
コード例 #4
0
 private void Run(MessageDeletePayload messageDeletePayload)
 {
     Task.Run(() => RunAsync(messageDeletePayload));
 }