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