Codex commited on
Commit ·
c6ec9b9
1
Parent(s): e6a841a
Show scanner command errors to admins
Browse files- src/index.js +36 -18
src/index.js
CHANGED
|
@@ -857,16 +857,22 @@ async function handleScanRun(interaction, config) {
|
|
| 857 |
}
|
| 858 |
|
| 859 |
await interaction.deferReply({ flags: MessageFlags.Ephemeral });
|
| 860 |
-
|
| 861 |
-
|
| 862 |
-
|
| 863 |
-
|
| 864 |
-
|
| 865 |
-
|
| 866 |
-
|
| 867 |
-
|
| 868 |
-
|
| 869 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 870 |
}
|
| 871 |
|
| 872 |
async function handleScanReport(interaction, config) {
|
|
@@ -886,10 +892,16 @@ async function handleScanReport(interaction, config) {
|
|
| 886 |
}
|
| 887 |
|
| 888 |
await interaction.deferReply({ flags: MessageFlags.Ephemeral });
|
| 889 |
-
|
| 890 |
-
|
| 891 |
-
|
| 892 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 893 |
}
|
| 894 |
|
| 895 |
async function handleCircaTest(interaction, config) {
|
|
@@ -909,10 +921,16 @@ async function handleCircaTest(interaction, config) {
|
|
| 909 |
}
|
| 910 |
|
| 911 |
await interaction.deferReply({ flags: MessageFlags.Ephemeral });
|
| 912 |
-
|
| 913 |
-
|
| 914 |
-
|
| 915 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 916 |
}
|
| 917 |
|
| 918 |
async function handleButton(interaction, store) {
|
|
|
|
| 857 |
}
|
| 858 |
|
| 859 |
await interaction.deferReply({ flags: MessageFlags.Ephemeral });
|
| 860 |
+
try {
|
| 861 |
+
const analysis = await scanner.runDisagreementScan();
|
| 862 |
+
await interaction.editReply({
|
| 863 |
+
embeds: [
|
| 864 |
+
buildMarketTopEmbed('Manual Scan Complete', analysis.circaAlerts.slice(0, 10), {
|
| 865 |
+
metricLabel: 'Circa Deviation',
|
| 866 |
+
metricFormatter: (row) => `${(row.maxDeviation * 100).toFixed(2)}%`,
|
| 867 |
+
secondaryValue: (row) => `${row.furthestBookName} @ ${row.furthestBookOddsInput}`,
|
| 868 |
+
}),
|
| 869 |
+
],
|
| 870 |
+
});
|
| 871 |
+
} catch (error) {
|
| 872 |
+
await interaction.editReply({
|
| 873 |
+
embeds: [buildErrorEmbed('Manual scan failed', error.message || 'The scanner hit an unexpected error.')],
|
| 874 |
+
});
|
| 875 |
+
}
|
| 876 |
}
|
| 877 |
|
| 878 |
async function handleScanReport(interaction, config) {
|
|
|
|
| 892 |
}
|
| 893 |
|
| 894 |
await interaction.deferReply({ flags: MessageFlags.Ephemeral });
|
| 895 |
+
try {
|
| 896 |
+
await scanner.runMorningReport();
|
| 897 |
+
await interaction.editReply({
|
| 898 |
+
embeds: [buildErrorEmbed('Morning report posted', `Sent the discrepancy and width reports to <#${config.scanner.scanReportChannelId}>.`).setColor(0x2563eb)],
|
| 899 |
+
});
|
| 900 |
+
} catch (error) {
|
| 901 |
+
await interaction.editReply({
|
| 902 |
+
embeds: [buildErrorEmbed('Morning report failed', error.message || 'The scanner hit an unexpected error.')],
|
| 903 |
+
});
|
| 904 |
+
}
|
| 905 |
}
|
| 906 |
|
| 907 |
async function handleCircaTest(interaction, config) {
|
|
|
|
| 921 |
}
|
| 922 |
|
| 923 |
await interaction.deferReply({ flags: MessageFlags.Ephemeral });
|
| 924 |
+
try {
|
| 925 |
+
const diagnostic = await scanner.runCircaDiagnostic();
|
| 926 |
+
await interaction.editReply({
|
| 927 |
+
embeds: [buildCircaDiagnosticEmbed(diagnostic)],
|
| 928 |
+
});
|
| 929 |
+
} catch (error) {
|
| 930 |
+
await interaction.editReply({
|
| 931 |
+
embeds: [buildErrorEmbed('Circa test failed', error.message || 'The Circa diagnostic hit an unexpected error.')],
|
| 932 |
+
});
|
| 933 |
+
}
|
| 934 |
}
|
| 935 |
|
| 936 |
async function handleButton(interaction, store) {
|