you can no longer remind channels you don't have access to

This commit is contained in:
Master Kwoth 2017-05-17 00:42:30 +02:00
parent 080ad1fd9d
commit bc78f70655
2 changed files with 16 additions and 2 deletions

View File

@ -123,8 +123,19 @@ namespace NadekoBot.Modules.Utility
[RequireContext(ContextType.Guild)] [RequireContext(ContextType.Guild)]
[RequireUserPermission(GuildPermission.ManageMessages)] [RequireUserPermission(GuildPermission.ManageMessages)]
[Priority(0)] [Priority(0)]
public Task Remind(ITextChannel channel, string timeStr, [Remainder] string message) => public async Task Remind(ITextChannel channel, string timeStr, [Remainder] string message)
RemindInternal(channel.Id, false, timeStr, 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) public async Task RemindInternal(ulong targetId, bool isPrivate, string timeStr, [Remainder] string message)
{ {

View File

@ -2105,6 +2105,9 @@ Owner ID: {2}</value>
<data name="utility_remind" xml:space="preserve"> <data name="utility_remind" xml:space="preserve">
<value>I will remind {0} to {1} in {2} `({3:d.M.yyyy.} at {4:HH:mm})`</value> <value>I will remind {0} to {1} in {2} `({3:d.M.yyyy.} at {4:HH:mm})`</value>
</data> </data>
<data name="utility_cant_read_or_send" xml:space="preserve">
<value>You can't read from or send messages to that channel.</value>
</data>
<data name="utility_remind_invalid_format" xml:space="preserve"> <data name="utility_remind_invalid_format" xml:space="preserve">
<value>Not a valid time format. Check the commandlist.</value> <value>Not a valid time format. Check the commandlist.</value>
</data> </data>