1
0
mirror of https://github.com/spacebarchat/server.git synced 2024-09-21 10:11:34 +02:00

🐛 fix guild create icon

This commit is contained in:
Flam3rboy 2021-09-18 00:19:53 +02:00
parent 859fdd679b
commit 181afe7e09
2 changed files with 4 additions and 3 deletions

View File

@ -1,6 +1,6 @@
import { Router, Request, Response } from "express";
import { Role, Guild, Snowflake, Config, User, Member, Channel } from "@fosscord/util";
import { route } from "@fosscord/api";
import { handleFile, route } from "@fosscord/api";
import { DiscordApiErrors } from "@fosscord/util";
import { ChannelModifySchema } from "../channels/#channel_id";
@ -34,6 +34,7 @@ router.post("/", route({ body: "GuildCreateSchema" }), async (req: Request, res:
await Guild.insert({
name: body.name,
icon: await handleFile(`/icons/${guild_id}`, body.icon as string),
region: Config.get().regions.default,
owner_id: req.user_id,
afk_timeout: 300,

View File

@ -42,9 +42,9 @@ export async function handleFile(path: string, body?: string): Promise<string |
export async function deleteFile(path: string) {
const response = await fetch(`${Config.get().cdn.endpoint || "http://localhost:3003"}${path}`, {
headers: {
signature: Config.get().security.requestSignature,
signature: Config.get().security.requestSignature
},
method: "DELETE",
method: "DELETE"
});
const result = await response.json();