Spaces:
Runtime error
Runtime error
Update index.js
Browse files
index.js
CHANGED
|
@@ -804,9 +804,13 @@ client.on('messageCreate', async (message) => {
|
|
| 804 |
|
| 805 |
if (!timeInput) return message.reply("❌ Usage: `!scheduledfriendly [time] [voting|manager]`\nExample: `!scheduledfriendly 9 PM manager` or `!scheduledfriendly 9 PM / 2026/5/4 9 PM voting`")
|
| 806 |
|
| 807 |
-
// Parse date
|
| 808 |
-
|
| 809 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 810 |
let timestamp = Date.parse(dateStr);
|
| 811 |
|
| 812 |
if (isNaN(timestamp) || timestamp < Date.now() - 86400000) {
|
|
@@ -1844,9 +1848,13 @@ client.on('interactionCreate', async (interaction) => {
|
|
| 1844 |
const timeInput = interaction.options.getString('time');
|
| 1845 |
const type = interaction.options.getString('type') || 'voting';
|
| 1846 |
|
| 1847 |
-
// Parse date
|
| 1848 |
-
|
| 1849 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1850 |
let timestamp = Date.parse(dateStr);
|
| 1851 |
|
| 1852 |
// If it's just a time like "9 PM", it might fail or parse as 1970
|
|
|
|
| 804 |
|
| 805 |
if (!timeInput) return message.reply("❌ Usage: `!scheduledfriendly [time] [voting|manager]`\nExample: `!scheduledfriendly 9 PM manager` or `!scheduledfriendly 9 PM / 2026/5/4 9 PM voting`")
|
| 806 |
|
| 807 |
+
// Parse date - check for ' / ' separator first
|
| 808 |
+
let dateStr = timeInput;
|
| 809 |
+
if (timeInput.includes(' / ')) {
|
| 810 |
+
const parts = timeInput.split(' / ');
|
| 811 |
+
dateStr = parts[parts.length - 1].trim();
|
| 812 |
+
}
|
| 813 |
+
|
| 814 |
let timestamp = Date.parse(dateStr);
|
| 815 |
|
| 816 |
if (isNaN(timestamp) || timestamp < Date.now() - 86400000) {
|
|
|
|
| 1848 |
const timeInput = interaction.options.getString('time');
|
| 1849 |
const type = interaction.options.getString('type') || 'voting';
|
| 1850 |
|
| 1851 |
+
// Parse date - check for ' / ' separator first
|
| 1852 |
+
let dateStr = timeInput;
|
| 1853 |
+
if (timeInput.includes(' / ')) {
|
| 1854 |
+
const parts = timeInput.split(' / ');
|
| 1855 |
+
dateStr = parts[parts.length - 1].trim();
|
| 1856 |
+
}
|
| 1857 |
+
|
| 1858 |
let timestamp = Date.parse(dateStr);
|
| 1859 |
|
| 1860 |
// If it's just a time like "9 PM", it might fail or parse as 1970
|