Skip to content

Commit fa119a8

Browse files
committed
Fix FIRE-DHK
1 parent 8d67cdf commit fa119a8

3 files changed

Lines changed: 15 additions & 12 deletions

File tree

src/commands/Premium/redirect-create.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ export default class RedirectCreate extends Command {
9292
? "REDIRECT_CREATE_SUCCESS_WITH_LOCATION"
9393
: "REDIRECT_CREATE_SUCCESS",
9494
{
95-
redirect: `${this.module.redirectDomain}/${created.get("code")}`,
96-
url: created.get("redirect"),
95+
redirect: `${this.module.redirectDomain}/${created.code}`,
96+
url: created.redirect,
9797
location: location?.toString(),
9898
}
9999
);

src/modules/redirects.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { Message } from "@fire/lib/ws/Message";
77
import { EventType } from "@fire/lib/ws/util/constants";
88
import { MessageUtil } from "@fire/lib/ws/util/MessageUtil";
99
import * as centra from "centra";
10+
import { Snowflake } from "discord-api-types/globals";
1011
import { MessageEmbed } from "discord.js";
1112

1213
export default class Redirects extends Module {
@@ -69,7 +70,7 @@ export default class Redirects extends Module {
6970
return "EXISTS";
7071
if (!exists) {
7172
const created = await this.client.db
72-
.query(
73+
.query<{ uid: Snowflake; code: string; redirect: string }>(
7374
"INSERT INTO vanity (uid, code, redirect) VALUES ($1, $2, $3) RETURNING *;",
7475
[user.id, code, url]
7576
)
@@ -79,7 +80,7 @@ export default class Redirects extends Module {
7980
return created;
8081
} else {
8182
const updated = await this.client.db
82-
.query(
83+
.query<{ uid: Snowflake; code: string; redirect: string }>(
8384
"UPDATE vanity SET (code, redirect) = ($1, $2) WHERE code=$1 AND uid=$3 RETURNING *;",
8485
[code, url, user.id]
8586
)

src/modules/vanityurls.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -167,14 +167,16 @@ export default class VanityURLs extends Module {
167167

168168
// and now we actually delete the guild's vanities
169169
const deleted = await this.client.db
170-
.query("DELETE FROM vanity WHERE gid=$1 RETURNING *;", [source.id])
170+
.query<{
171+
invite: string;
172+
}>("DELETE FROM vanity WHERE gid=$1 RETURNING *;", [source.id])
171173
.catch(() => {});
172174
if (deleted && deleted.status.startsWith("DELETE ")) {
173175
this.requestFetch(source.id);
174176
if (alsoDeleteInvite)
175177
for await (const vanity of deleted)
176178
await this.client
177-
.fetchInvite(vanity.get("invite") as string)
179+
.fetchInvite(vanity.invite)
178180
// we only want to delete invites *we* created
179181
.then(
180182
(i) =>
@@ -190,14 +192,14 @@ export default class VanityURLs extends Module {
190192
} else {
191193
// If we have a code, we delete first and ask questions later
192194
const deleted = await this.client.db
193-
.query(
195+
.query<{ gid: Snowflake; invite: string }>(
194196
"DELETE FROM vanity WHERE (code ILIKE $1 OR invite ILIKE $1) AND gid IS NOT NULL RETURNING *;",
195197
[source]
196198
)
197199
.first()
198200
.catch(() => {});
199-
if (deleted && deleted.get("gid")) {
200-
const guildId = deleted.get("gid") as Snowflake;
201+
if (deleted && deleted.gid) {
202+
const guildId = deleted.gid;
201203
this.requestFetch(guildId);
202204

203205
const remainingResult = await this.client.db
@@ -235,17 +237,17 @@ export default class VanityURLs extends Module {
235237

236238
if (alsoDeleteInvite) {
237239
// this should always be true but just in case
238-
if (deleted.get("invite")) {
240+
if (deleted.invite) {
239241
const invite = await this.client
240-
.fetchInvite(deleted.get("invite") as string)
242+
.fetchInvite(deleted.invite)
241243
.catch(() => {});
242244
if (invite && invite.inviterId == this.client.user.id)
243245
await invite.delete().catch(() => {});
244246
}
245247
}
246248
}
247249

248-
return deleted && deleted.get("gid");
250+
return deleted && deleted.gid;
249251
}
250252
}
251253

0 commit comments

Comments
 (0)