Fixed .remind me
This commit is contained in:
parent
c1c8c1c856
commit
6437fb6f90
@ -64,7 +64,10 @@ namespace NadekoBot.Modules.Utility
|
|||||||
IMessageChannel ch;
|
IMessageChannel ch;
|
||||||
if (r.IsPrivate)
|
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
|
else
|
||||||
{
|
{
|
||||||
@ -100,23 +103,16 @@ namespace NadekoBot.Modules.Utility
|
|||||||
[Priority(1)]
|
[Priority(1)]
|
||||||
public async Task Remind(MeOrHere meorhere, string timeStr, [Remainder] string message)
|
public async Task Remind(MeOrHere meorhere, string timeStr, [Remainder] string message)
|
||||||
{
|
{
|
||||||
IMessageChannel target;
|
ulong target;
|
||||||
if (meorhere == MeOrHere.Me)
|
target = meorhere == MeOrHere.Me ? Context.User.Id : Context.Channel.Id;
|
||||||
{
|
await Remind(target, meorhere == MeOrHere.Me, timeStr, message).ConfigureAwait(false);
|
||||||
target = await ((IGuildUser)Context.User).CreateDMChannelAsync().ConfigureAwait(false);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
target = Context.Channel;
|
|
||||||
}
|
|
||||||
await Remind(target, 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(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;
|
var channel = (ITextChannel)Context.Channel;
|
||||||
|
|
||||||
@ -164,8 +160,8 @@ namespace NadekoBot.Modules.Utility
|
|||||||
|
|
||||||
var rem = new Reminder
|
var rem = new Reminder
|
||||||
{
|
{
|
||||||
ChannelId = ch.Id,
|
ChannelId = targetId,
|
||||||
IsPrivate = ch is IDMChannel,
|
IsPrivate = isPrivate,
|
||||||
When = time,
|
When = time,
|
||||||
Message = message,
|
Message = message,
|
||||||
UserId = Context.User.Id,
|
UserId = Context.User.Id,
|
||||||
@ -182,7 +178,7 @@ namespace NadekoBot.Modules.Utility
|
|||||||
{
|
{
|
||||||
await channel.SendConfirmAsync(
|
await channel.SendConfirmAsync(
|
||||||
"⏰ " + GetText("remind",
|
"⏰ " + 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(message.SanitizeMentions()),
|
||||||
Format.Bold(output),
|
Format.Bold(output),
|
||||||
time, time)).ConfigureAwait(false);
|
time, time)).ConfigureAwait(false);
|
||||||
|
Loading…
Reference in New Issue
Block a user