Skip to content
This repository was archived by the owner on Oct 9, 2025. It is now read-only.

Commit 5bd416d

Browse files
committed
feat(network): prevent accounts that are not newer than 7 days from using interchat
1 parent 3c34bdb commit 5bd416d

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

locales

src/managers/NetworkManager.ts

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ export default class NetworkManager extends Factory {
5050
* @param message The network message to handle.
5151
*/
5252
public async handleNetworkMessage(message: NetworkMessage) {
53-
const locale = await message.client.getUserLocale(message.author.id);
53+
message.author.locale = await message.client.getUserLocale(message.author.id);
54+
const { locale } = message.author;
5455

5556
const isNetworkMessage = await db.connectedList.findFirst({
5657
where: { channelId: message.channel.id, connected: true },
@@ -301,11 +302,19 @@ export default class NetworkManager extends Factory {
301302
* @param hubId - The ID of the hub the message is being sent in.
302303
* @returns A boolean indicating whether the message passed all checks.
303304
*/
304-
public async runChecks(
305-
message: Message,
306-
settings: HubSettingsBitField,
307-
hubId: string,
308-
): Promise<boolean> {
305+
public async runChecks(message: Message, settings: HubSettingsBitField, hubId: string) {
306+
const sevenDaysAgo = Date.now() - 1000 * 60 * 60 * 24 * 7;
307+
// if account is created within the last 7 days
308+
if (message.author.createdTimestamp > sevenDaysAgo) {
309+
await message.channel.send(
310+
t(
311+
{ phrase: 'network.accountTooNew', locale: message.author.locale },
312+
{ user: `${message.author}` },
313+
),
314+
);
315+
return false;
316+
}
317+
309318
const blacklistManager = this.client.getBlacklistManager();
310319

311320
const isUserBlacklisted = await db.userData.findFirst({

0 commit comments

Comments
 (0)