.remind #channel fixed

This commit is contained in:
Kwoth 2017-03-10 07:46:31 +01:00
parent 233beee36c
commit 5c300b2cf5

View File

@ -105,17 +105,18 @@ namespace NadekoBot.Modules.Utility
{ {
ulong target; ulong target;
target = meorhere == MeOrHere.Me ? Context.User.Id : Context.Channel.Id; target = meorhere == MeOrHere.Me ? Context.User.Id : Context.Channel.Id;
await Remind(target, meorhere == MeOrHere.Me, timeStr, message).ConfigureAwait(false); await RemindInternal(target, meorhere == MeOrHere.Me, timeStr, message).ConfigureAwait(false);
} }
[NadekoCommand, Usage, Description, Aliases] [NadekoCommand, Usage, Description, Aliases]
[RequireContext(ContextType.Guild)] [RequireContext(ContextType.Guild)]
[RequireUserPermission(GuildPermission.ManageMessages)] [RequireUserPermission(GuildPermission.ManageMessages)]
[Priority(0)] [Priority(0)]
public async Task Remind(ulong targetId, bool isPrivate, string timeStr, [Remainder] string message) public Task Remind(ITextChannel channel, string timeStr, [Remainder] string message) =>
{ RemindInternal(channel.Id, false, timeStr, message);
var channel = (ITextChannel)Context.Channel;
public async Task RemindInternal(ulong targetId, bool isPrivate, string timeStr, [Remainder] string message)
{
var m = _regex.Match(timeStr); var m = _regex.Match(timeStr);
if (m.Length == 0) if (m.Length == 0)
@ -145,7 +146,7 @@ namespace NadekoBot.Modules.Utility
(groupName == "hours" && value > 23) || (groupName == "hours" && value > 23) ||
(groupName == "minutes" && value > 59)) (groupName == "minutes" && value > 59))
{ {
await channel.SendErrorAsync($"Invalid {groupName} value.").ConfigureAwait(false); await Context.Channel.SendErrorAsync($"Invalid {groupName} value.").ConfigureAwait(false);
return; return;
} }
namesAndValues[groupName] = value; namesAndValues[groupName] = value;
@ -165,7 +166,7 @@ namespace NadekoBot.Modules.Utility
When = time, When = time,
Message = message, Message = message,
UserId = Context.User.Id, UserId = Context.User.Id,
ServerId = channel.Guild.Id ServerId = Context.Guild.Id
}; };
using (var uow = DbHandler.UnitOfWork()) using (var uow = DbHandler.UnitOfWork())
@ -176,7 +177,7 @@ namespace NadekoBot.Modules.Utility
try try
{ {
await channel.SendConfirmAsync( await Context.Channel.SendConfirmAsync(
"⏰ " + GetText("remind", "⏰ " + GetText("remind",
Format.Bold(!isPrivate ? $"<#{targetId}>" : Context.User.Username), Format.Bold(!isPrivate ? $"<#{targetId}>" : Context.User.Username),
Format.Bold(message.SanitizeMentions()), Format.Bold(message.SanitizeMentions()),