Skip to content

Commit

Permalink
bot: format the code
Browse files Browse the repository at this point in the history
  • Loading branch information
Behzad-rabiei committed Oct 24, 2024
1 parent 0fa7a73 commit 5c89dd0
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 78 deletions.
16 changes: 2 additions & 14 deletions bot/src/database/services/channel.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,7 @@ async function createChannel(
): Promise<IChannel | null> {
try {
return await connection.models.Channel.create(channel)
// eslint-disable-next-line @typescript-eslint/no-explicit-any
} catch (error: any) {
// if (error.code === 11000) {
// logger.warn({ database: connection.name, channel_id: channel.channelId }, 'Failed to create duplicate channel');
// return null;
// }
// logger.error({ database: connection.name, channel_id: channel.channelId, error }, 'Failed to create channel');
} catch (error) {
return null
}
}
Expand All @@ -51,13 +45,7 @@ async function createChannels(
return await connection.models.Channel.insertMany(channels, {
ordered: false,
})
// eslint-disable-next-line @typescript-eslint/no-explicit-any
} catch (error: any) {
// if (error.code === 11000) {
// logger.warn({ database: connection.name }, 'Failed to create duplicate channels');
// return [];
// }
// logger.error({ database: connection.name, error }, 'Failed to create channels');
} catch (error) {
return []
}
}
Expand Down
23 changes: 1 addition & 22 deletions bot/src/database/services/guildMember.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,7 @@ async function createGuildMember(
): Promise<IGuildMember | null> {
try {
return await connection.models.GuildMember.create(guildMember)
// eslint-disable-next-line @typescript-eslint/no-explicit-any
} catch (error: any) {
// if (error.code === 11000) {
// logger.warn(
// { database: connection.name, guild_member_id: guildMember.discordId },
// 'Failed to create duplicate guild member',
// );
// return null;
// }
// logger.error(
// {
// database: connection.name,
// guild_member_id: guildMember.discordId,
// error,
// },
// 'Failed to create guild member',
// );
} catch (error) {
return null
}
}
Expand All @@ -57,11 +41,6 @@ async function createGuildMembers(
})
// eslint-disable-next-line @typescript-eslint/no-explicit-any
} catch (error: any) {
// if (error.code === 11000) {
// logger.warn({ database: connection.name }, 'Failed to create duplicate guild members');
// return [];
// }
// logger.error({ database: connection.name, error }, 'Failed to create guild members');
return []
}
}
Expand Down
29 changes: 2 additions & 27 deletions bot/src/database/services/rawInfo.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,7 @@ async function createRawInfo(
): Promise<IRawInfo | null> {
try {
return await connection.models.RawInfo.create(rawInfo)
// eslint-disable-next-line @typescript-eslint/no-explicit-any
} catch (error: any) {
// if (error.code === 11000) {
// logger.warn(
// {
// database: connection.name,
// channel_id: rawInfo.channelId,
// message_id: rawInfo.messageId,
// },
// 'Failed to create duplicate rawInfo',
// );
// return null;
// }
// logger.error(
// {
// database: connection.name,
// channel_id: rawInfo.channelId,
// message_id: rawInfo.messageId,
// },
// 'Failed to create rawInfo',
// );
} catch (error) {
return null
}
}
Expand All @@ -55,12 +35,7 @@ async function createRawInfos(
return await connection.models.RawInfo.insertMany(rawInfos, {
ordered: false,
})
// eslint-disable-next-line @typescript-eslint/no-explicit-any
} catch (error: any) {
// if (error.code === 11000) {
// logger.warn({ database: connection.name }, 'Failed to create duplicate rawInfos');
// return [];
// }
} catch (error) {
logger.error(
{ database: connection.name, error },
'Failed to create rawInfos'
Expand Down
16 changes: 2 additions & 14 deletions bot/src/database/services/role.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,7 @@ async function createRole(
): Promise<IRole | null> {
try {
return await connection.models.Role.create(role)
// eslint-disable-next-line @typescript-eslint/no-explicit-any
} catch (error: any) {
// if (error.code === 11000) {
// logger.warn({ database: connection.name, role_id: role.roleId }, 'Failed to create duplicate role');
// return null;
// }
// logger.error({ database: connection.name, role_id: role.roleId, error }, 'Failed to create role');
} catch (error) {
return null
}
}
Expand All @@ -46,13 +40,7 @@ async function createRoles(
return await connection.models.Role.insertMany(roles, {
ordered: false,
})
// eslint-disable-next-line @typescript-eslint/no-explicit-any
} catch (error: any) {
// if (error.code === 11000) {
// logger.warn({ database: connection.name }, 'Failed to create duplicate roles');
// return [];
// }
// logger.error({ database: connection.name, error }, 'Failed to create roles');
} catch (error) {
return []
}
}
Expand Down
2 changes: 1 addition & 1 deletion bot/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ async function app(): Promise<void> {
}

app().catch((error) => {
logger.fatal(error, 'Failed To start the application!!!!!')
logger.fatal(error, 'Failed To start the application!')
})

0 comments on commit 5c89dd0

Please sign in to comment.