mirror of
https://iceshrimp.dev/crimekillz/trashposs
synced 2024-11-25 10:19:06 +01:00
[mastodon-client] fix posting polls
This commit is contained in:
parent
b4d52ee24c
commit
8d988e6456
2 changed files with 20 additions and 1 deletions
|
@ -67,6 +67,25 @@ export function apiStatusMastodon(router: Router): void {
|
|||
const { sensitive } = body;
|
||||
body.sensitive =
|
||||
typeof sensitive === "string" ? sensitive === "true" : sensitive;
|
||||
|
||||
if (body.poll) {
|
||||
if (
|
||||
body.poll.expires_in != null &&
|
||||
typeof body.poll.expires_in === "string"
|
||||
)
|
||||
body.poll.expires_in = parseInt(body.poll.expires_in);
|
||||
if (
|
||||
body.poll.multiple != null &&
|
||||
typeof body.poll.multiple === "string"
|
||||
)
|
||||
body.poll.multiple = body.poll.multiple == "true";
|
||||
if (
|
||||
body.poll.hide_totals != null &&
|
||||
typeof body.poll.hide_totals === "string"
|
||||
)
|
||||
body.poll.hide_totals = body.poll.hide_totals == "true";
|
||||
}
|
||||
|
||||
const data = await client.postStatus(text, body);
|
||||
ctx.body = convertStatus(data.data);
|
||||
} catch (e: any) {
|
||||
|
|
|
@ -1169,7 +1169,7 @@ export default class Misskey implements MegalodonInterface {
|
|||
let pollParam = {
|
||||
choices: options.poll.options,
|
||||
expiresAt: null,
|
||||
expiredAfter: options.poll.expires_in
|
||||
expiredAfter: options.poll.expires_in * 1000
|
||||
}
|
||||
if (options.poll.multiple !== undefined) {
|
||||
pollParam = Object.assign(pollParam, {
|
||||
|
|
Loading…
Reference in a new issue