🎨 remove unused imports
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { Router, Response, Request } from "express";
|
||||
import { Attachment, Channel, ChannelType, Embed, getPermission, Message } from "@fosscord/util";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { instanceOf, Length, route } from "@fosscord/api";
|
||||
import { route } from "@fosscord/api";
|
||||
import multer from "multer";
|
||||
import { sendMessage } from "@fosscord/api";
|
||||
import { uploadFile } from "@fosscord/api";
|
||||
@@ -61,17 +61,12 @@ router.get("/", async (req: Request, res: Response) => {
|
||||
if (!channel) throw new HTTPError("Channel not found", 404);
|
||||
|
||||
isTextChannel(channel.type);
|
||||
const around = `${req.query.around}`;
|
||||
const before = `${req.query.before}`;
|
||||
const after = `${req.query.after}`;
|
||||
const limit = Number(req.query.limit) || 50;
|
||||
if (limit < 1 || limit > 100) throw new HTTPError("limit must be between 1 and 100");
|
||||
|
||||
try {
|
||||
instanceOf({ $around: String, $after: String, $before: String, $limit: new Length(Number, 1, 100) }, req.query, {
|
||||
path: "query",
|
||||
req
|
||||
});
|
||||
} catch (error) {
|
||||
return res.status(400).json({ code: 50035, message: "Invalid Query", success: false, errors: error });
|
||||
}
|
||||
var { around, after, before, limit }: { around?: string; after?: string; before?: string; limit?: number } = req.query;
|
||||
if (!limit) limit = 50;
|
||||
var halfLimit = Math.floor(limit / 2);
|
||||
|
||||
const permissions = await getPermission(req.user_id, channel.guild_id, channel_id);
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Channel, ChannelPermissionOverwrite, ChannelUpdateEvent, emitEvent, get
|
||||
import { Router, Response, Request } from "express";
|
||||
import { HTTPError } from "lambert-server";
|
||||
|
||||
import { check, route } from "@fosscord/api";
|
||||
import { route } from "@fosscord/api";
|
||||
const router: Router = Router();
|
||||
|
||||
// TODO: Only permissions your bot has in the guild or channel can be allowed/denied (unless your bot has a MANAGE_ROLES overwrite in the channel)
|
||||
|
||||
@@ -9,14 +9,14 @@ router.post("/", route({ permission: "SEND_MESSAGES" }), async (req: Request, re
|
||||
const user_id = req.user_id;
|
||||
const timestamp = Date.now();
|
||||
const channel = await Channel.findOneOrFail({ id: channel_id });
|
||||
const member = await Member.findOneOrFail({ id: user_id });
|
||||
const member = await Member.findOneOrFail({ where: { id: user_id }, relations: ["roles"] });
|
||||
|
||||
await emitEvent({
|
||||
event: "TYPING_START",
|
||||
channel_id: channel_id,
|
||||
data: {
|
||||
// this is the paylod
|
||||
member: { ...member, roles: member.roles.map((x) => x.id) },
|
||||
member: { ...member, roles: member.roles?.map((x) => x.id) },
|
||||
channel_id,
|
||||
timestamp,
|
||||
user_id,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Router, Response, Request } from "express";
|
||||
import { check, Length, route } from "@fosscord/api";
|
||||
import { route } from "@fosscord/api";
|
||||
import { Channel, Config, getPermission, trimSpecial, Webhook } from "@fosscord/util";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { isTextChannel } from "./messages/index";
|
||||
|
||||
Reference in New Issue
Block a user