Clarify datetime format in switch move error
This commit is contained in:
parent
942b620640
commit
1bd5e7e3ca
@ -4,24 +4,30 @@ using Discord.Commands;
|
|||||||
|
|
||||||
namespace PluralKit.Bot.Commands
|
namespace PluralKit.Bot.Commands
|
||||||
{
|
{
|
||||||
[Group("help")]
|
|
||||||
public class HelpCommands: ModuleBase<PKCommandContext>
|
public class HelpCommands: ModuleBase<PKCommandContext>
|
||||||
{
|
{
|
||||||
[Command]
|
[Command("help")]
|
||||||
public async Task HelpRoot([Remainder] string _ignored)
|
public async Task HelpRoot([Remainder] string _ignored)
|
||||||
{
|
{
|
||||||
await Context.Channel.SendMessageAsync(embed: new EmbedBuilder()
|
await Context.Channel.SendMessageAsync(embed: new EmbedBuilder()
|
||||||
.WithTitle("PluralKit")
|
.WithTitle("PluralKit")
|
||||||
.WithDescription("PluralKit is a bot designed for plural communities on Discord. It allows you to register systems, maintain system information, set up message proxying, log switches, and more.")
|
.WithDescription("PluralKit is a bot designed for plural communities on Discord. It allows you to register systems, maintain system information, set up message proxying, log switches, and more.")
|
||||||
.AddField("What is this for? What are systems?", "This bot detects messages with certain tags associated with a profile, then replaces that message under a \"pseudo-account\" of that profile using webhooks. This is useful for multiple people sharing one body (aka \"systems\"), people who wish to roleplay as different characters without having several accounts, or anyone else who may want to post messages as a different person from the same account.")
|
.AddField("What is this for? What are systems?", "This bot detects messages with certain tags associated with a profile, then replaces that message under a \"pseudo-account\" of that profile using webhooks. This is useful for multiple people sharing one body (aka \"systems\"), people who wish to roleplay as different characters without having several accounts, or anyone else who may want to post messages as a different person from the same account.")
|
||||||
.AddField("Why are people's names saying [BOT] next to them?", "These people are not actually bots, this is just a Discord limitation. Type `pk;help proxy` for an in-depth explanation.")
|
.AddField("Why are people's names saying [BOT] next to them?", "These people are not actually bots, this is just a Discord limitation. See [the documentation](https://pluralkit.me/guide#proxying) for an in-depth explanation.")
|
||||||
.AddField("How do I get started?", "To get started using PluralKit, try running the following commands (of course replacing the relevant names with your own):\n**1**. `pk;system new` - Create a system (if you haven't already)\n**2**. `pk;member add John` - Add a new member to your system\n**3**. `pk;member John proxy [text]` - Set up [square brackets] as proxy tags\n**4**. You're done! You can now type [a message in brackets] and it'll be proxied appropriately.\n**5**. Optionally, you may set an avatar from the URL of an image with `pk;member John avatar [link to image]`, or from a file by typing `pk;member John avatar` and sending the message with an attached image.\n\nType `pk;help member` for more information.")
|
.AddField("How do I get started?", "To get started using PluralKit, try running the following commands (of course replacing the relevant names with your own):\n**1**. `pk;system new` - Create a system (if you haven't already)\n**2**. `pk;member add John` - Add a new member to your system\n**3**. `pk;member John proxy [text]` - Set up [square brackets] as proxy tags\n**4**. You're done! You can now type [a message in brackets] and it'll be proxied appropriately.\n**5**. Optionally, you may set an avatar from the URL of an image with `pk;member John avatar [link to image]`, or from a file by typing `pk;member John avatar` and sending the message with an attached image.\n\nSee [the documentation](https://pluralkit.me/guide#member-management) for more information.")
|
||||||
.AddField("Useful tips", $"React with {Emojis.Error} on a proxied message to delete it (only if you sent it!)\nReact with {Emojis.RedQuestion} on a proxied message to look up information about it (like who sent it)\nType **`pk;invite`** to get a link to invite this bot to your own server!")
|
.AddField("Useful tips", $"React with {Emojis.Error} on a proxied message to delete it (only if you sent it!)\nReact with {Emojis.RedQuestion} on a proxied message to look up information about it (like who sent it)\nType **`pk;invite`** to get a link to invite this bot to your own server!")
|
||||||
.AddField("More information", "For a full list of commands, type `pk;commands`.\nFor a more in-depth explanation of message proxying, type `pk;help proxy`.\nIf you're an existing user of Tupperbox, type `pk;import` and attach a Tupperbox export file (from `tul!export`) to import your data from there.")
|
.AddField("More information", "For a full list of commands, see [the command list](https://pluralkit.me/commands).\nFor a more in-depth explanation of message proxying, see [the documentation](https://pluralkit.me/guide#proxying).\nIf you're an existing user of Tupperbox, type `pk;import` and attach a Tupperbox export file (from `tul!export`) to import your data from there.")
|
||||||
.AddField("Support server", "We also have a Discord server for support, discussion, suggestions, announcements, etc: https://discord.gg/PczBt78")
|
.AddField("Support server", "We also have a Discord server for support, discussion, suggestions, announcements, etc: https://discord.gg/PczBt78")
|
||||||
.WithFooter("By @Ske#6201 | GitHub: https://github.com/xSke/PluralKit/")
|
.WithFooter("By @Ske#6201 | GitHub: https://github.com/xSke/PluralKit/ | Website: https://pluralkit.me/")
|
||||||
.WithColor(Color.Blue)
|
.WithColor(Color.Blue)
|
||||||
.Build());
|
.Build());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Command("commands")]
|
||||||
|
public async Task CommandList()
|
||||||
|
{
|
||||||
|
await Context.Channel.SendMessageAsync(
|
||||||
|
"The command list has been moved! See the website: https://pluralkit.me/commands");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -51,7 +51,7 @@ namespace PluralKit.Bot {
|
|||||||
public static PKError DuplicateSwitchMembers => new PKError("Duplicate members in member list.");
|
public static PKError DuplicateSwitchMembers => new PKError("Duplicate members in member list.");
|
||||||
public static PKError SwitchMemberNotInSystem => new PKError("One or more switch members aren't in your own system.");
|
public static PKError SwitchMemberNotInSystem => new PKError("One or more switch members aren't in your own system.");
|
||||||
|
|
||||||
public static PKError InvalidDateTime(string str) => new PKError($"Could not parse '{str}' as a valid date/time.");
|
public static PKError InvalidDateTime(string str) => new PKError($"Could not parse '{str}' as a valid date/time. Try using a syntax such as \"May 21, 12:30 PM\" or \"3d12h\" (ie. 3 days, 12 hours ago).");
|
||||||
public static PKError SwitchTimeInFuture => new PKError("Can't move switch to a time in the future.");
|
public static PKError SwitchTimeInFuture => new PKError("Can't move switch to a time in the future.");
|
||||||
public static PKError NoRegisteredSwitches => new PKError("There are no registered switches for this system.");
|
public static PKError NoRegisteredSwitches => new PKError("There are no registered switches for this system.");
|
||||||
|
|
||||||
|
@ -180,19 +180,21 @@ namespace PluralKit
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Then we try specific date+time combinations, both date first and time first
|
// Then we try specific date+time combinations, both date first and time first, with and without commas
|
||||||
foreach (var timePattern in timePatterns)
|
foreach (var timePattern in timePatterns)
|
||||||
{
|
{
|
||||||
foreach (var datePattern in datePatterns)
|
foreach (var datePattern in datePatterns)
|
||||||
{
|
{
|
||||||
var p1 = LocalDateTimePattern.CreateWithInvariantCulture($"{timePattern} {datePattern}").WithTemplateValue(midnight);
|
foreach (var patternStr in new[]
|
||||||
var res1 = p1.Parse(str);
|
{
|
||||||
if (res1.Success) return res1.Value.InZoneLeniently(zone);
|
$"{timePattern}, {datePattern}", $"{datePattern}, {timePattern}",
|
||||||
|
$"{timePattern} {datePattern}", $"{datePattern} {timePattern}"
|
||||||
|
})
|
||||||
var p2 = LocalDateTimePattern.CreateWithInvariantCulture($"{datePattern} {timePattern}").WithTemplateValue(midnight);
|
{
|
||||||
var res2 = p2.Parse(str);
|
var pattern = LocalDateTimePattern.CreateWithInvariantCulture(patternStr).WithTemplateValue(midnight);
|
||||||
if (res2.Success) return res2.Value.InZoneLeniently(zone);
|
var res = pattern.Parse(str);
|
||||||
|
if (res.Success) return res.Value.InZoneLeniently(zone);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user