diff --git a/src/migrations/db/1695210587863-add-isgeneratedbyweebhook-to-rawinfo-schema.ts b/src/migrations/db/1695210587863-add-isgeneratedbyweebhook-to-rawinfo-schema.ts deleted file mode 100644 index ea38a08e..00000000 --- a/src/migrations/db/1695210587863-add-isgeneratedbyweebhook-to-rawinfo-schema.ts +++ /dev/null @@ -1,27 +0,0 @@ -import 'dotenv/config'; -import { Client, GatewayIntentBits, } from 'discord.js'; -import { platformService } from '../../database/services'; -import { connectDB } from '../../database'; -import config from '../../config'; -import webhookLogic from '../utils/webhookLogic'; -import { DatabaseManager } from '@togethercrew.dev/db'; - -const { Guilds, GuildMembers, GuildMessages, GuildPresences, DirectMessages } = GatewayIntentBits; - -export const up = async () => { - const client = new Client({ - intents: [Guilds, GuildMembers, GuildMessages, GuildPresences, DirectMessages], - }); - - await client.login(config.discord.botToken); - await connectDB(); - const platforms = await platformService.getPlatforms({}); - for (let i = 0; i < platforms.length; i++) { - const connection = await DatabaseManager.getInstance().getTenantDb(platforms[i].metadata?.id); - await webhookLogic(connection, client, platforms[i].metadata?.id); - } -}; - -export const down = async () => { - // TODO: Implement rollback logic if needed -}; diff --git a/src/migrations/utils/isBotLogic.ts b/src/migrations/utils/isBotLogic.ts index dc923f23..0f8e7715 100644 --- a/src/migrations/utils/isBotLogic.ts +++ b/src/migrations/utils/isBotLogic.ts @@ -27,16 +27,12 @@ function pushMembersToArray(arr: IGuildMember[], guildMembersArray: GuildMember[ export default async function isBotLogic(connection: Connection, client: Client, guildId: Snowflake) { logger.info({ guild_id: guildId }, 'add-isBot-to-guilbMember-schema migration is running'); try { - console.log(guildId) const botGuildMembers = []; const noneBotGuildMembers = []; const guild = await client.guilds.fetch(guildId); - console.log(guild.id) const membersToStore: IGuildMember[] = []; - console.log(1) const fetchedMembers = await guild.members.fetch(); - console.log(2) const guildMembers = pushMembersToArray(membersToStore, [...fetchedMembers.values()]); console.log(guildMembers.length, guildId)