From db29ed0a96cb78d352b31e18e52dddd3c5fef354 Mon Sep 17 00:00:00 2001 From: Behzad Rabiei <53224485+Behzad-rabiei@users.noreply.github.com> Date: Wed, 6 Dec 2023 16:59:01 +0330 Subject: [PATCH] [DEBUG] --- src/functions/fetchChannels.ts | 1 - src/functions/fetchMembers.ts | 2 -- src/functions/fetchRoles.ts | 2 -- src/index.ts | 7 ++----- 4 files changed, 2 insertions(+), 10 deletions(-) diff --git a/src/functions/fetchChannels.ts b/src/functions/fetchChannels.ts index cb701c96..33b27e4b 100644 --- a/src/functions/fetchChannels.ts +++ b/src/functions/fetchChannels.ts @@ -44,7 +44,6 @@ export default async function fetchGuildChannels(connection: Connection, client: ) as Array; pushChannelsToArray(channelsToStore, textAndVoiceChannels); logger.info({ channels: channelsToStore }) - await channelService.createChannels(connection, channelsToStore); // assuming a 'channelService' } catch (error) { logger.error({ guild_id: platform.metadata?.id, error }, 'Failed to fetch channels'); diff --git a/src/functions/fetchMembers.ts b/src/functions/fetchMembers.ts index c5416a76..0bd981e0 100644 --- a/src/functions/fetchMembers.ts +++ b/src/functions/fetchMembers.ts @@ -40,8 +40,6 @@ export default async function fetchGuildMembers(connection: Connection, client: const membersToStore: IGuildMember[] = []; const fetchMembers = await guild.members.fetch(); pushMembersToArray(membersToStore, [...fetchMembers.values()]); - logger.info({ members: membersToStore }) - await guildMemberService.createGuildMembers(connection, membersToStore); } catch (error) { logger.error({ guild_id: platform.metadata?.id, error }, 'Failed to fetch guild members'); diff --git a/src/functions/fetchRoles.ts b/src/functions/fetchRoles.ts index e15a64c3..6c1b46ba 100644 --- a/src/functions/fetchRoles.ts +++ b/src/functions/fetchRoles.ts @@ -37,8 +37,6 @@ export default async function fetchGuildRoles(connection: Connection, client: Cl const guild = await client.guilds.fetch(platform.metadata?.id); const rolesToStore: IRole[] = []; pushRolesToArray(rolesToStore, [...guild.roles.cache.values()]); - logger.info({ roles: rolesToStore }) - await roleService.createRoles(connection, rolesToStore); } catch (error) { logger.error({ guild_id: platform.metadata?.id, error }, 'Failed to fetch roles'); diff --git a/src/index.ts b/src/index.ts index 55da3b48..464f5b1d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -60,9 +60,9 @@ const fetchMethod = async (msg: any) => { const isPlatformCreated = saga.data['created']; const connection = DatabaseManager.getInstance().getTenantDb(platform.metadata?.id); if (isPlatformCreated) { + await fetchChannels(connection, client, platform); await fetchMembers(connection, client, platform); await fetchRoles(connection, client, platform); - await fetchChannels(connection, client, platform); } else { await guildExtraction(connection, client, platform); } @@ -104,13 +104,12 @@ const notifyUserAboutAnalysisFinish = async ( const fetchInitialData = async (platform: HydratedDocument) => { try { const connection = DatabaseManager.getInstance().getTenantDb(platform.metadata?.id); - await fetchRoles(connection, client, platform); await fetchChannels(connection, client, platform); + await fetchRoles(connection, client, platform); await fetchMembers(connection, client, platform); } catch (error) { logger.error({ error }, 'fetchInitialData is failed'); } - }; // APP @@ -184,9 +183,7 @@ async function app() { const platform = await platformService.getPlatform({ _id: platformId }); - logger.info({ msg, event: Event.DISCORD_BOT.FETCH_MEMBERS, platform, platformId }) if (platform) { - logger.info({ event: "FETCHING Initial DATA" }) const fn = fetchInitialData.bind({}, platform); await saga.next(fn); }