Remind fixed
This commit is contained in:
parent
273f5a29a2
commit
d34a429c1c
@ -93,28 +93,36 @@ namespace NadekoBot.Modules.Utility
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum MeOrHere
|
||||||
|
{
|
||||||
|
Me,Here
|
||||||
|
}
|
||||||
|
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
[RequireContext(ContextType.Guild)]
|
[RequireContext(ContextType.Guild)]
|
||||||
public async Task Remind(IUserMessage umsg, string meorchannel, string timeStr, [Remainder] string message)
|
[Priority(1)]
|
||||||
|
public async Task Remind(IUserMessage umsg, MeOrHere meorhere, string timeStr, [Remainder] string message)
|
||||||
{
|
{
|
||||||
var channel = (ITextChannel)umsg.Channel;
|
var channel = (ITextChannel)umsg.Channel;
|
||||||
|
|
||||||
var meorchStr = meorchannel.ToUpperInvariant();
|
IMessageChannel target;
|
||||||
IMessageChannel ch;
|
if (meorhere == MeOrHere.Me)
|
||||||
bool isPrivate = false;
|
|
||||||
if (meorchStr == "ME")
|
|
||||||
{
|
{
|
||||||
isPrivate = true;
|
target = await ((IGuildUser)umsg.Author).CreateDMChannelAsync().ConfigureAwait(false);
|
||||||
ch = await ((IGuildUser)umsg.Author).CreateDMChannelAsync().ConfigureAwait(false);
|
|
||||||
}
|
|
||||||
else if (meorchStr == "HERE")
|
|
||||||
{
|
|
||||||
ch = channel;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ch = channel.Guild.GetTextChannels().FirstOrDefault(c => c.Name.ToUpperInvariant() == meorchStr || c.Id.ToString() == meorchStr);
|
target = channel;
|
||||||
}
|
}
|
||||||
|
await Remind(umsg, target, timeStr, message).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
|
[RequireContext(ContextType.Guild)]
|
||||||
|
[Priority(0)]
|
||||||
|
public async Task Remind(IUserMessage umsg, IMessageChannel ch, string timeStr, [Remainder] string message)
|
||||||
|
{
|
||||||
|
var channel = (ITextChannel)umsg.Channel;
|
||||||
|
|
||||||
if (ch == null)
|
if (ch == null)
|
||||||
{
|
{
|
||||||
@ -168,7 +176,7 @@ namespace NadekoBot.Modules.Utility
|
|||||||
var rem = new Reminder
|
var rem = new Reminder
|
||||||
{
|
{
|
||||||
ChannelId = ch.Id,
|
ChannelId = ch.Id,
|
||||||
IsPrivate = isPrivate,
|
IsPrivate = ch is IDMChannel,
|
||||||
When = time,
|
When = time,
|
||||||
Message = message,
|
Message = message,
|
||||||
UserId = umsg.Author.Id,
|
UserId = umsg.Author.Id,
|
||||||
|
Loading…
Reference in New Issue
Block a user