Skip to content

Commit

Permalink
Only allow mentioned users to snooze.
Browse files Browse the repository at this point in the history
  • Loading branch information
Naamloos committed Mar 3, 2023
1 parent 5384721 commit 17b9b4e
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions ModCore/Components/ReminderComponents.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using ModCore.Extensions.Attributes;
using ModCore.Modals;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace ModCore.Components
Expand All @@ -14,10 +15,13 @@ public class ReminderComponents : BaseComponentModule
[Component("snooze", ComponentType.Button)]
public async Task SnoozeReminderAsync(ComponentInteractionCreateEventArgs e)
{
await Client.GetInteractionExtension().RespondWithModalAsync<SnoozeModal>(e.Interaction, "Snooze reminder", new Dictionary<string, string>()
if (e.Message.MentionedUsers.Any(x => x.Id == e.User.Id))
{
{ "msg", e.Message.Id.ToString() }
});
await Client.GetInteractionExtension().RespondWithModalAsync<SnoozeModal>(e.Interaction, "Snooze reminder", new Dictionary<string, string>()
{
{ "msg", e.Message.Id.ToString() }
});
}
}
}
}

0 comments on commit 17b9b4e

Please sign in to comment.