mirror of
https://github.com/spacebarchat/server.git
synced 2026-10-22 17:32:30 +00:00
Qodana: fix async warnings
This commit is contained in:
1 parent
589dd7dea7
commit
b5e63c06b6
26 files changed
+41
-42
No files matched your search
+1
-1
@@ -200,7 +200,7 @@ export class SpacebarServer extends Server {
|
||||
|
||||
this.app.use(ErrorHandler);
|
||||
|
||||
ConnectionLoader.loadConnections();
|
||||
await ConnectionLoader.loadConnections();
|
||||
|
||||
if (logRequests) console.log(red(`Warning: Request logging is enabled! This will spam your console!\nTo disable this, unset the 'LOG_REQUESTS' environment variable!`));
|
||||
|
||||
|
||||
@@ -122,7 +122,7 @@ router.patch(
|
||||
|
||||
app.bot.assign(body);
|
||||
|
||||
app.bot.save();
|
||||
await app.bot.save();
|
||||
|
||||
await app.save();
|
||||
res.json(app).status(200);
|
||||
|
||||
@@ -113,7 +113,7 @@ router.patch(
|
||||
} as MessageUpdateEvent),
|
||||
]);
|
||||
|
||||
postHandleMessage(new_message);
|
||||
postHandleMessage(new_message).catch((e) => console.error("[Message] post-message handler failed", e));
|
||||
|
||||
// TODO: a DTO?
|
||||
return res.json({
|
||||
@@ -295,7 +295,7 @@ router.delete(
|
||||
});
|
||||
if (channel.type === ChannelType.GUILD_PUBLIC_THREAD) {
|
||||
if (channel.message_count !== undefined) channel.message_count--;
|
||||
channel.save(); //Save async, it's fine
|
||||
await channel.save();
|
||||
}
|
||||
const message = await Message.findOneOrFail({
|
||||
where: { id: message_id },
|
||||
|
||||
@@ -89,7 +89,7 @@ router.post(
|
||||
},
|
||||
author_id: user.id,
|
||||
});
|
||||
sendMessage({
|
||||
await sendMessage({
|
||||
channel_id: channel.id,
|
||||
type: MessageType.THREAD_CREATED,
|
||||
content: thread.name,
|
||||
|
||||
@@ -126,7 +126,7 @@ router.post(
|
||||
}),
|
||||
]);
|
||||
if (body.type !== ChannelType.GUILD_PRIVATE_THREAD && !channel.isForum())
|
||||
sendMessage({
|
||||
await sendMessage({
|
||||
channel_id: channel.id,
|
||||
type: MessageType.THREAD_CREATED,
|
||||
content: thread.name,
|
||||
|
||||
@@ -43,7 +43,7 @@ router.get("/", route({}), async (req: Request, res: Response) => {
|
||||
});
|
||||
|
||||
res.json({
|
||||
url: await connection.getAuthorizationUrl(req.user_id),
|
||||
url: connection.getAuthorizationUrl(req.user_id),
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ router.post("/", route({ requestBody: "ConnectionCallbackSchema" }), async (req:
|
||||
|
||||
// whether we should emit a connections update event, only used when a connection doesnt already exist
|
||||
if (connectedAccnt)
|
||||
emitEvent({
|
||||
await emitEvent({
|
||||
event: "USER_CONNECTIONS_UPDATE",
|
||||
data: { ...connectedAccnt, token_data: undefined },
|
||||
user_id: userId,
|
||||
|
||||
@@ -68,7 +68,7 @@ router.get(
|
||||
}
|
||||
if (channel_id) {
|
||||
const ids = new Set(channel_id instanceof Array ? channel_id : [channel_id]);
|
||||
Promise.all(
|
||||
await Promise.all(
|
||||
[...ids].map(async (id) => {
|
||||
const permissions = await getPermission(req.user_id, req.params.guild_id as string, id);
|
||||
permissions.hasThrow("VIEW_CHANNEL");
|
||||
|
||||
@@ -83,27 +83,27 @@ router.get(
|
||||
switch (style) {
|
||||
case "shield":
|
||||
ctx.textAlign = "center";
|
||||
await drawText(ctx, 73, 13, "#FFFFFF", "thin 10px Verdana", presence);
|
||||
drawText(ctx, 73, 13, "#FFFFFF", "thin 10px Verdana", presence);
|
||||
break;
|
||||
case "banner1":
|
||||
if (icon) await drawIcon(ctx, 20, 27, 50, icon);
|
||||
await drawText(ctx, 83, 51, "#FFFFFF", "12px Verdana", name, 22);
|
||||
await drawText(ctx, 83, 66, "#C9D2F0FF", "thin 11px Verdana", presence);
|
||||
drawText(ctx, 83, 51, "#FFFFFF", "12px Verdana", name, 22);
|
||||
drawText(ctx, 83, 66, "#C9D2F0FF", "thin 11px Verdana", presence);
|
||||
break;
|
||||
case "banner2":
|
||||
if (icon) await drawIcon(ctx, 13, 19, 36, icon);
|
||||
await drawText(ctx, 62, 34, "#FFFFFF", "12px Verdana", name, 15);
|
||||
await drawText(ctx, 62, 49, "#C9D2F0FF", "thin 11px Verdana", presence);
|
||||
drawText(ctx, 62, 34, "#FFFFFF", "12px Verdana", name, 15);
|
||||
drawText(ctx, 62, 49, "#C9D2F0FF", "thin 11px Verdana", presence);
|
||||
break;
|
||||
case "banner3":
|
||||
if (icon) await drawIcon(ctx, 20, 20, 50, icon);
|
||||
await drawText(ctx, 83, 44, "#FFFFFF", "12px Verdana", name, 27);
|
||||
await drawText(ctx, 83, 58, "#C9D2F0FF", "thin 11px Verdana", presence);
|
||||
drawText(ctx, 83, 44, "#FFFFFF", "12px Verdana", name, 27);
|
||||
drawText(ctx, 83, 58, "#C9D2F0FF", "thin 11px Verdana", presence);
|
||||
break;
|
||||
case "banner4":
|
||||
if (icon) await drawIcon(ctx, 21, 136, 50, icon);
|
||||
await drawText(ctx, 84, 156, "#FFFFFF", "13px Verdana", name, 27);
|
||||
await drawText(ctx, 84, 171, "#C9D2F0FF", "thin 12px Verdana", presence);
|
||||
drawText(ctx, 84, 156, "#FFFFFF", "13px Verdana", name, 27);
|
||||
drawText(ctx, 84, 171, "#C9D2F0FF", "thin 12px Verdana", presence);
|
||||
break;
|
||||
default:
|
||||
throw new HTTPError("Value must be one of ('shield', 'banner1', 'banner2', 'banner3', 'banner4').", 400);
|
||||
|
||||
@@ -77,7 +77,7 @@ router.post("/", route({}), async (req: Request, res: Response) => {
|
||||
|
||||
clearTimeout(interaction.timeout);
|
||||
|
||||
emitEvent({
|
||||
await emitEvent({
|
||||
event: "INTERACTION_SUCCESS",
|
||||
user_id: interaction?.userId,
|
||||
data: {
|
||||
|
||||
@@ -32,7 +32,7 @@ router.post("/", route({}), async (req: Request, res: Response) => {
|
||||
const interactionId = Snowflake.generate();
|
||||
const interactionToken = randomBytes(24).toString("base64url");
|
||||
|
||||
emitEvent({
|
||||
await emitEvent({
|
||||
event: "INTERACTION_CREATE",
|
||||
user_id: req.user_id,
|
||||
data: {
|
||||
@@ -94,7 +94,7 @@ router.post("/", route({}), async (req: Request, res: Response) => {
|
||||
interactionData.message = await Message.findOneOrFail({ where: { id: body.message_id, flags: undefined }, relations: { author: true } });
|
||||
}
|
||||
|
||||
emitEvent({
|
||||
await emitEvent({
|
||||
event: "INTERACTION_CREATE",
|
||||
user_id: body.application_id,
|
||||
data: interactionData,
|
||||
|
||||
@@ -59,8 +59,9 @@ router.patch(
|
||||
const body = req.body as UserGuildSettingsSchema;
|
||||
|
||||
if (body.channel_overrides) {
|
||||
// TODO: rewrite to a single query?
|
||||
for (const channel in body.channel_overrides) {
|
||||
Channel.findOneOrFail({ where: { id: channel } });
|
||||
await Channel.findOneOrFail({ where: { id: channel } });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -79,9 +79,9 @@ router.put(
|
||||
},
|
||||
})
|
||||
) {
|
||||
Note.update({ owner: { id: owner.id }, target: { id: target.id } }, { owner, target, content: note });
|
||||
await Note.update({ owner: { id: owner.id }, target: { id: target.id } }, { owner, target, content: note });
|
||||
} else {
|
||||
Note.insert({
|
||||
await Note.insert({
|
||||
id: Snowflake.generate(),
|
||||
owner,
|
||||
target,
|
||||
|
||||
@@ -115,7 +115,7 @@ export async function handleMessage(opts: MessageOptions): Promise<Message> {
|
||||
}
|
||||
if (!ephermal) {
|
||||
channel.last_message_id = message.id;
|
||||
channel.save();
|
||||
await channel.save();
|
||||
}
|
||||
|
||||
if (cloudAttachments && cloudAttachments.length > 0) {
|
||||
|
||||
Reference in new issue
Block a user