Skip to content

Commit

Permalink
fix: add presence status and activity to SuperClient,
Browse files Browse the repository at this point in the history
refactor NetworkManager to handle webhook errors,
and update NetworkLogger description format
  • Loading branch information
dev-737 committed Nov 6, 2023
1 parent 3023b2e commit 137c82a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
9 changes: 9 additions & 0 deletions src/SuperClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import BlacklistManager from './managers/BlacklistManager.js';
import { RemoveMethods } from './typings/index.js';
import { isDevBuild } from './utils/Constants.js';
import CooldownService from './services/CooldownService.js';
import { ActivityType } from 'discord.js';

export default abstract class SuperClient extends Client {
readonly logger = Logger;
Expand Down Expand Up @@ -70,6 +71,14 @@ export default abstract class SuperClient extends Client {
IntentsBitField.Flags.GuildMessages,
IntentsBitField.Flags.GuildMessageReactions,
],
presence: {
status: 'invisible',
activities: [{
name: 'Watching over 400+ networks | /hub browse',
state: 'custom',
type: ActivityType.Custom,
}],
},
});
}

Expand Down
11 changes: 3 additions & 8 deletions src/managers/NetworkManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -588,15 +588,10 @@ export default class NetworkManager extends Factory {
const payload =
typeof message === 'string' ? { content: message, threadId } : { ...message, threadId };

try {
const webhook = new WebhookClient({ url: connection.webhookURL });
return webhook.send(payload);
}
catch {
return null;
}
const webhook = new WebhookClient({ url: connection.webhookURL });
return webhook.send(payload).catch(() => null);
});

return await Promise.all(res);
return res;
}
}
2 changes: 1 addition & 1 deletion src/structures/NetworkLogger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export default class NetworkLogger {
.setAuthor({ name: `${type} ${name} blacklisted`, iconURL })
.setDescription(
stripIndents`
${emojis.dotBlue} **User:** ${name} (${userOrServer.id})
${emojis.dotBlue} **${type}:** ${name} (${userOrServer.id})
${emojis.dotBlue} **Moderator:** ${mod.username} (${mod.id})
${emojis.dotBlue} **Hub:** ${hub?.name}
`,
Expand Down

0 comments on commit 137c82a

Please sign in to comment.