Skip to content

Commit

Permalink
fix(discord-worker-actions): renamed errors for better understanding
Browse files Browse the repository at this point in the history
Took 4 minutes
  • Loading branch information
Croos3r committed Nov 5, 2023
1 parent 66c383f commit cd48d89
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 20 deletions.
20 changes: 1 addition & 19 deletions backend/workers/discord/src/guilds/on-boost.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,33 +23,15 @@ export default async function onGuildBoost(discordClient: DiscordOauth2) {

let { premium_since: initialPremiumSince } = await getGuildMember();

if (initialPremiumSince === undefined || initialPremiumSince === null) {
await onError(client, {
identifier: params.identifier,
error: "discord-on-guild-boost",
isAuthError: false,
});
return;
}

setInterval(async () => {
const { premium_since: newPremiumSince } = await getGuildMember();

if (newPremiumSince === undefined || newPremiumSince === null) {
await onError(client, {
error: "discord-on-guild-boost",
identifier: params.identifier,
isAuthError: false,
});
return;
}

if (newPremiumSince !== initialPremiumSince) {
initialPremiumSince = newPremiumSince;
const guild = await getGuild();
if (!guild) {
await onError(client, {
error: "discord-on-guild-boost",
error: "Cannot find guild",
identifier: params.identifier,
isAuthError: false,
});
Expand Down
2 changes: 1 addition & 1 deletion backend/workers/discord/src/guilds/on-timeout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default async function onGuildTimeout(discordClient: DiscordOauth2) {
if (newTimeoutState && new Date().getTime() < new Date(newTimeoutState).getTime()) {
if (!guild) {
await onError(client, {
error: "discord-on-guild-timeout",
error: "Cannot find guild",
identifier: params.identifier,
isAuthError: false,
});
Expand Down

0 comments on commit cd48d89

Please sign in to comment.