mirror of
https://github.com/spacebarchat/server.git
synced 2024-11-25 11:43:07 +01:00
Consistent widget disabled error
This commit is contained in:
parent
f7f16db37e
commit
917f394cc5
@ -17,9 +17,15 @@
|
||||
*/
|
||||
|
||||
import { random, route } from "@spacebar/api";
|
||||
import { Channel, Guild, Invite, Member, Permissions } from "@spacebar/util";
|
||||
import {
|
||||
Channel,
|
||||
DiscordApiErrors,
|
||||
Guild,
|
||||
Invite,
|
||||
Member,
|
||||
Permissions,
|
||||
} from "@spacebar/util";
|
||||
import { Request, Response, Router } from "express";
|
||||
import { HTTPError } from "lambert-server";
|
||||
|
||||
const router: Router = Router();
|
||||
|
||||
@ -48,7 +54,7 @@ router.get(
|
||||
const { guild_id } = req.params;
|
||||
|
||||
const guild = await Guild.findOneOrFail({ where: { id: guild_id } });
|
||||
if (!guild.widget_enabled) throw new HTTPError("Widget Disabled", 404);
|
||||
if (!guild.widget_enabled) throw DiscordApiErrors.EMBED_DISABLED;
|
||||
|
||||
// Fetch existing widget invite for widget channel
|
||||
let invite = await Invite.findOne({
|
||||
|
@ -19,7 +19,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
|
||||
import { route } from "@spacebar/api";
|
||||
import { Guild } from "@spacebar/util";
|
||||
import { DiscordApiErrors, Guild } from "@spacebar/util";
|
||||
import { Request, Response, Router } from "express";
|
||||
import fs from "fs";
|
||||
import { HTTPError } from "lambert-server";
|
||||
@ -48,7 +48,7 @@ router.get(
|
||||
const { guild_id } = req.params;
|
||||
|
||||
const guild = await Guild.findOneOrFail({ where: { id: guild_id } });
|
||||
if (!guild.widget_enabled) throw new HTTPError("Unknown Guild", 404);
|
||||
if (!guild.widget_enabled) throw DiscordApiErrors.EMBED_DISABLED;
|
||||
|
||||
// Fetch guild information
|
||||
const icon = guild.icon;
|
||||
|
@ -812,7 +812,7 @@ export const DiscordApiErrors = {
|
||||
"Cannot execute action on a DM channel",
|
||||
50003,
|
||||
),
|
||||
EMBED_DISABLED: new ApiError("Guild widget disabled", 50004),
|
||||
EMBED_DISABLED: new ApiError("Widget Disabled", 50004),
|
||||
CANNOT_EDIT_MESSAGE_BY_OTHER: new ApiError(
|
||||
"Cannot edit a message authored by another user",
|
||||
50005,
|
||||
|
Loading…
Reference in New Issue
Block a user