Fixed .remind me
This commit is contained in:
parent
c1c8c1c856
commit
6437fb6f90
@ -64,7 +64,10 @@ namespace NadekoBot.Modules.Utility
|
||||
IMessageChannel ch;
|
||||
if (r.IsPrivate)
|
||||
{
|
||||
ch = await NadekoBot.Client.GetDMChannelAsync(r.ChannelId).ConfigureAwait(false);
|
||||
var user = NadekoBot.Client.GetGuild(r.ServerId).GetUser(r.ChannelId);
|
||||
if(user == null)
|
||||
return;
|
||||
ch = await user.CreateDMChannelAsync().ConfigureAwait(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -100,23 +103,16 @@ namespace NadekoBot.Modules.Utility
|
||||
[Priority(1)]
|
||||
public async Task Remind(MeOrHere meorhere, string timeStr, [Remainder] string message)
|
||||
{
|
||||
IMessageChannel target;
|
||||
if (meorhere == MeOrHere.Me)
|
||||
{
|
||||
target = await ((IGuildUser)Context.User).CreateDMChannelAsync().ConfigureAwait(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
target = Context.Channel;
|
||||
}
|
||||
await Remind(target, timeStr, message).ConfigureAwait(false);
|
||||
ulong target;
|
||||
target = meorhere == MeOrHere.Me ? Context.User.Id : Context.Channel.Id;
|
||||
await Remind(target, meorhere == MeOrHere.Me, timeStr, message).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
[NadekoCommand, Usage, Description, Aliases]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[RequireUserPermission(GuildPermission.ManageMessages)]
|
||||
[Priority(0)]
|
||||
public async Task Remind(IMessageChannel ch, string timeStr, [Remainder] string message)
|
||||
public async Task Remind(ulong targetId, bool isPrivate, string timeStr, [Remainder] string message)
|
||||
{
|
||||
var channel = (ITextChannel)Context.Channel;
|
||||
|
||||
@ -164,8 +160,8 @@ namespace NadekoBot.Modules.Utility
|
||||
|
||||
var rem = new Reminder
|
||||
{
|
||||
ChannelId = ch.Id,
|
||||
IsPrivate = ch is IDMChannel,
|
||||
ChannelId = targetId,
|
||||
IsPrivate = isPrivate,
|
||||
When = time,
|
||||
Message = message,
|
||||
UserId = Context.User.Id,
|
||||
@ -182,7 +178,7 @@ namespace NadekoBot.Modules.Utility
|
||||
{
|
||||
await channel.SendConfirmAsync(
|
||||
"⏰ " + GetText("remind",
|
||||
Format.Bold(ch is ITextChannel ? ((ITextChannel) ch).Name : Context.User.Username),
|
||||
Format.Bold(!isPrivate ? $"<#{targetId}>" : Context.User.Username),
|
||||
Format.Bold(message.SanitizeMentions()),
|
||||
Format.Bold(output),
|
||||
time, time)).ConfigureAwait(false);
|
||||
|
Loading…
Reference in New Issue
Block a user