From bc78f70655c4d558125687e1e35932a65ce66d83 Mon Sep 17 00:00:00 2001 From: Master Kwoth Date: Wed, 17 May 2017 00:42:30 +0200 Subject: [PATCH] you can no longer remind channels you don't have access to --- src/NadekoBot/Modules/Utility/Commands/Remind.cs | 15 +++++++++++++-- src/NadekoBot/Resources/ResponseStrings.resx | 3 +++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/NadekoBot/Modules/Utility/Commands/Remind.cs b/src/NadekoBot/Modules/Utility/Commands/Remind.cs index 8da05b89..4ffd9469 100644 --- a/src/NadekoBot/Modules/Utility/Commands/Remind.cs +++ b/src/NadekoBot/Modules/Utility/Commands/Remind.cs @@ -123,8 +123,19 @@ namespace NadekoBot.Modules.Utility [RequireContext(ContextType.Guild)] [RequireUserPermission(GuildPermission.ManageMessages)] [Priority(0)] - public Task Remind(ITextChannel channel, string timeStr, [Remainder] string message) => - RemindInternal(channel.Id, false, timeStr, message); + public async Task Remind(ITextChannel channel, string timeStr, [Remainder] string message) + { + var perms = ((IGuildUser)Context.User).GetPermissions((ITextChannel)channel); + if (!perms.SendMessages || !perms.ReadMessages) + { + await ReplyErrorLocalized("cant_read_or_send").ConfigureAwait(false); + return; + } + else + { + var _ = RemindInternal(channel.Id, false, timeStr, message).ConfigureAwait(false); + } + } public async Task RemindInternal(ulong targetId, bool isPrivate, string timeStr, [Remainder] string message) { diff --git a/src/NadekoBot/Resources/ResponseStrings.resx b/src/NadekoBot/Resources/ResponseStrings.resx index 1fb27df8..ccb11a5e 100644 --- a/src/NadekoBot/Resources/ResponseStrings.resx +++ b/src/NadekoBot/Resources/ResponseStrings.resx @@ -2105,6 +2105,9 @@ Owner ID: {2} I will remind {0} to {1} in {2} `({3:d.M.yyyy.} at {4:HH:mm})` + + You can't read from or send messages to that channel. + Not a valid time format. Check the commandlist.