public async Task HandleMessageDeletionByReaction(Cacheable <IUserMessage, ulong> message, ulong userWhoReacted) { // Find the message in the database var storedMessage = await _messageStorage.Get(message.Id); if (storedMessage == null) { return; // (if we can't, that's ok, no worries) } // Make sure it's the actual sender of that message deleting the message if (storedMessage.Message.Sender != userWhoReacted) { return; } try { // Then, fetch the Discord message and delete that // TODO: this could be faster if we didn't bother fetching it and just deleted it directly // somehow through REST? await(await message.GetOrDownloadAsync()).DeleteAsync(); } catch (NullReferenceException) { // Message was deleted before we got to it... cool, no problem, lmao } // Finally, delete it from our database. await _messageStorage.Delete(message.Id); }