diff --git a/src/events/channel/channelDelete.ts b/src/events/channel/channelDelete.ts index 5db0749a..31b5eb55 100644 --- a/src/events/channel/channelDelete.ts +++ b/src/events/channel/channelDelete.ts @@ -3,7 +3,6 @@ import { channelService, platformService } from '../../database/services'; import { DatabaseManager } from '@togethercrew.dev/db'; import parentLogger from '../../config/logger'; -console.log('FLAG') const logger = parentLogger.child({ event: 'ChannelDelete' }); export default { diff --git a/src/events/client/ready.ts b/src/events/client/ready.ts index c953ba14..1bdd38b5 100644 --- a/src/events/client/ready.ts +++ b/src/events/client/ready.ts @@ -6,9 +6,6 @@ import fetchRoles from '../../functions/fetchRoles'; import { DatabaseManager } from '@togethercrew.dev/db'; import parentLogger from '../../config/logger'; -console.log('FLAG') - - const logger = parentLogger.child({ event: 'ClientReady' }); export default { diff --git a/src/events/user/userUpdate.ts b/src/events/user/userUpdate.ts index 626a1b67..b92b003c 100644 --- a/src/events/user/userUpdate.ts +++ b/src/events/user/userUpdate.ts @@ -3,9 +3,6 @@ import { guildMemberService, platformService } from '../../database/services'; import { DatabaseManager } from '@togethercrew.dev/db'; import parentLogger from '../../config/logger'; -console.log('FLAG') - - const logger = parentLogger.child({ event: 'UserUpdate' }); export default { name: Events.UserUpdate, diff --git a/src/functions/cronJon.ts b/src/functions/cronJon.ts index bc8438dc..e9cda21f 100644 --- a/src/functions/cronJon.ts +++ b/src/functions/cronJon.ts @@ -5,7 +5,6 @@ import { ChoreographyDict, MBConnection, Status } from '@togethercrew.dev/tc-mes import guildExtraction from './guildExtraction'; import parentLogger from '../config/logger'; import { DatabaseManager } from '@togethercrew.dev/db'; -console.log('FLAG') const logger = parentLogger.child({ event: 'CronJob' }); diff --git a/src/functions/fetchChannels.ts b/src/functions/fetchChannels.ts index 55600adc..dc08145c 100644 --- a/src/functions/fetchChannels.ts +++ b/src/functions/fetchChannels.ts @@ -3,7 +3,6 @@ import { Connection, HydratedDocument } from 'mongoose'; import { IPlatform, IChannel } from '@togethercrew.dev/db'; import { channelService, platformService } from '../database/services'; import parentLogger from '../config/logger'; -console.log('FLAG') const logger = parentLogger.child({ module: 'FetchChannels' }); diff --git a/src/functions/fetchMembers.ts b/src/functions/fetchMembers.ts index dc01d50d..8ef2d943 100644 --- a/src/functions/fetchMembers.ts +++ b/src/functions/fetchMembers.ts @@ -5,7 +5,6 @@ import { IGuildMember, } from '@togethercrew.dev/db'; import { guildMemberService, platformService } from '../database/services'; import parentLogger from '../config/logger'; -console.log('FLAG') const logger = parentLogger.child({ module: 'FetchMembers' }); diff --git a/src/functions/fetchRoles.ts b/src/functions/fetchRoles.ts index 38dcedc1..137259b7 100644 --- a/src/functions/fetchRoles.ts +++ b/src/functions/fetchRoles.ts @@ -4,7 +4,6 @@ import { IPlatform, IRole } from '@togethercrew.dev/db'; import { roleService, platformService } from '../database/services'; import parentLogger from '../config/logger'; -console.log('FLAG') const logger = parentLogger.child({ module: 'FetchRoles' }); diff --git a/src/index.ts b/src/index.ts index 6ca7a0e0..2ac0fb8d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -51,7 +51,6 @@ const fetchMethod = async (msg: any) => { logger.info({ saga: saga.data }, 'the saga info'); const platformId = saga.data['platformId']; const platform = await platformService.getPlatform({ _id: platformId }); - console.log(platform) if (platform) { const isPlatformCreated = saga.data['created']; @@ -160,21 +159,26 @@ async function app() { }); RabbitMQ.onEvent(Event.DISCORD_BOT.FETCH_MEMBERS, async msg => { - logger.info({ msg, event: Event.DISCORD_BOT.FETCH_MEMBERS }, 'is running'); - if (!msg) return; + try { + logger.info({ msg, event: Event.DISCORD_BOT.FETCH_MEMBERS }, 'is running'); + if (!msg) return; - const { content } = msg; - const saga = await MBConnection.models.Saga.findOne({ sagaId: content.uuid }); + const { content } = msg; + const saga = await MBConnection.models.Saga.findOne({ sagaId: content.uuid }); - const platformId = saga.data['platformId']; + const platformId = saga.data['platformId']; - const platform = await platformService.getPlatform({ _id: platformId }); + const platform = await platformService.getPlatform({ _id: platformId }); - if (platform) { - const fn = fetchInitialData.bind({}, platform.metadata?.id); - await saga.next(fn); + if (platform) { + const fn = fetchInitialData.bind({}, platform); + await saga.next(fn); + } + logger.info({ msg, event: Event.DISCORD_BOT.FETCH_MEMBERS }, 'is done'); + } catch (error) { + logger.error({ msg, event: Event.DISCORD_BOT.FETCH_MEMBERS, error }, 'is failed'); } - logger.info({ msg, event: Event.DISCORD_BOT.FETCH_MEMBERS }, 'is done'); + }); // *****************************BULLMQ