diff options
Diffstat (limited to 'src/server.ts')
| -rw-r--r-- | src/server.ts | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/server.ts b/src/server.ts index 3f54f63..bb0c458 100644 --- a/src/server.ts +++ b/src/server.ts @@ -9,15 +9,15 @@ import { ROLEPLAY_COMMAND, NSFW_COMMAND, TOP_COMMAND, -} from './commands.js'; +} from './commands.ts'; import { getCutePost, getRoleplayPost, getNSFWPost, getTopPost, type RedditPost, -} from './reddit.js'; -import type { TimePeriod } from './commands.js'; +} from './reddit.ts'; +import type { TimePeriod } from './commands.ts'; interface Environment { DISCORD_APPLICATION_ID: string; @@ -167,7 +167,9 @@ router.post('/', async (request: Request, environment: Environment) => { embeds: [embed], }, }); - } catch { + } catch (error) { + console.error('Error in hot command:', error); + return new JSONResponse({ type: InteractionResponseType.CHANNEL_MESSAGE_WITH_SOURCE, data: { @@ -189,7 +191,9 @@ router.post('/', async (request: Request, environment: Environment) => { embeds: [embed], }, }); - } catch { + } catch (error) { + console.error('Error in roleplay command:', error); + return new JSONResponse({ type: InteractionResponseType.CHANNEL_MESSAGE_WITH_SOURCE, data: { @@ -221,7 +225,9 @@ router.post('/', async (request: Request, environment: Environment) => { embeds: [embed], }, }); - } catch { + } catch (error) { + console.error('Error in NSFW command:', error); + return new JSONResponse({ type: InteractionResponseType.CHANNEL_MESSAGE_WITH_SOURCE, data: { @@ -245,7 +251,9 @@ router.post('/', async (request: Request, environment: Environment) => { embeds: [embed], }, }); - } catch { + } catch (error) { + console.error('Error in top command:', error); + return new JSONResponse({ type: InteractionResponseType.CHANNEL_MESSAGE_WITH_SOURCE, data: { |