Skip to content

Commit

Permalink
feat(invites): Use cache for guild vanity URL
Browse files Browse the repository at this point in the history
  • Loading branch information
reboxer committed Dec 17, 2019
1 parent eb76e53 commit 5a4f517
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/invites/commands/invites/inviteCodes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export default class extends Command {
isWidget: !code.inviter
}));

const vanityInv = await guild.getVanity().catch(() => undefined);
const vanityInv = guild.vanityURL || (await guild.getVanity().catch(() => undefined));
if (vanityInv && vanityInv.code) {
newDbCodes.push({
code: vanityInv.code,
Expand Down
4 changes: 2 additions & 2 deletions src/invites/services/Tracking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ export class TrackingService {

let isVanity = false;
if (inviteCodesUsed.length === 0) {
const vanityInv = await guild.getVanity().catch(() => undefined);
const vanityInv = guild.vanityURL || (await guild.getVanity().catch(() => undefined));
if (vanityInv && vanityInv.code) {
isVanity = true;
inviteCodesUsed.push(vanityInv.code as string);
Expand Down Expand Up @@ -749,7 +749,7 @@ export class TrackingService {
// Collect concurrent promises
const promises: any[] = [];

const vanityInv = await guild.getVanity().catch(() => undefined);
const vanityInv = guild.vanityURL || (await guild.getVanity().catch(() => undefined));
if (vanityInv && vanityInv.code) {
newInviteCodes.push({
code: vanityInv.code,
Expand Down

0 comments on commit 5a4f517

Please sign in to comment.