From 9b02e82614403d11b463217b2867b127ff3305f2 Mon Sep 17 00:00:00 2001
From: TomatoCake <60300461+DEVTomatoCake@users.noreply.github.com>
Date: Tue, 9 Jul 2024 14:55:01 +0200
Subject: [PATCH] Make poll a single object instead of an array
---
src/api/util/handlers/Message.ts | 8 ++++----
src/util/entities/Message.ts | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/api/util/handlers/Message.ts b/src/api/util/handlers/Message.ts
index 64bcdd56..325a7e1a 100644
--- a/src/api/util/handlers/Message.ts
+++ b/src/api/util/handlers/Message.ts
@@ -1,17 +1,17 @@
/*
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
Copyright (C) 2023 Spacebar and Spacebar Contributors
-
+
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
-
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
-
+
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see .
*/
@@ -66,7 +66,7 @@ export async function handleMessage(opts: MessageOptions): Promise {
: undefined;
const message = Message.create({
...opts,
- poll: opts.poll ? [opts.poll] : undefined,
+ poll: opts.poll,
sticker_items: stickers,
guild_id: channel.guild_id,
channel_id: opts.channel_id,
diff --git a/src/util/entities/Message.ts b/src/util/entities/Message.ts
index a76ebb1f..d28c8c29 100644
--- a/src/util/entities/Message.ts
+++ b/src/util/entities/Message.ts
@@ -219,7 +219,7 @@ export class Message extends BaseClass {
components?: MessageComponent[];
@Column({ type: "simple-json", nullable: true })
- poll?: Poll[];
+ poll?: Poll;
toJSON(): Message {
return {