summary refs log tree commit diff
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2026-07-20 12:20:53 +0200
committerRory& <root@rory.gay>2026-07-20 12:20:53 +0200
commit9b4d42f73fff14fe57b6a2e13cbe49d65a4afd52 (patch)
tree3cbca54e35c78b2e6b4a66b215b8f45bed43098c
parentKlipy fix (diff)
downloadserver-ts-9b4d42f73fff14fe57b6a2e13cbe49d65a4afd52.tar.xz
Fix bot token reset
-rw-r--r--src/api/routes/applications/#application_id/bot/index.ts3
-rw-r--r--src/api/util/utility/polls.ts3
2 files changed, 4 insertions, 2 deletions
diff --git a/src/api/routes/applications/#application_id/bot/index.ts b/src/api/routes/applications/#application_id/bot/index.ts

index f494c2e3..27b6b9c1 100644 --- a/src/api/routes/applications/#application_id/bot/index.ts +++ b/src/api/routes/applications/#application_id/bot/index.ts
@@ -67,8 +67,9 @@ router.post( }, }), async (req: Request, res: Response) => { + const app = await Application.findOneOrFail({ where: { id: req.params.application_id as string } }); const bot = await User.findOneOrFail({ where: { id: req.params.application_id as string } }); - const owner = req.user; + const owner = await User.findOneOrFail({ where: { id: app.owner_id }, select: { id: true, totp_secret: true } }); if (owner.id != req.user_id) throw DiscordApiErrors.ACTION_NOT_AUTHORIZED_ON_APPLICATION; diff --git a/src/api/util/utility/polls.ts b/src/api/util/utility/polls.ts
index 48c94121..bea5cd50 100644 --- a/src/api/util/utility/polls.ts +++ b/src/api/util/utility/polls.ts
@@ -22,7 +22,8 @@ import { MessageOptions, sendMessage } from "../handlers/Message"; import { Message } from "@spacebar/database"; export async function generatePollResultsMessage(options: MessageOptions): Promise<MessageOptions> { - const message = await Message.create({ + // TODO: shouldnt this get saved? + const message = Message.create({ ...options, message_reference: options.message_reference ?? undefined, poll: options.poll,