mirror of
https://github.com/spacebarchat/server.git
synced 2024-11-10 20:52:42 +01:00
🐛 fix guild create icon
This commit is contained in:
parent
859fdd679b
commit
181afe7e09
@ -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,
|
||||
|
@ -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();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user