Files
the-jailor/wwwroot/core/appData.js
2025-11-09 10:23:23 +01:00

52 lines
1.6 KiB
JavaScript

import 'dotenv/config';
import {Client, GatewayIntentBits} from "discord.js";
import {MessageSender} from "./base/MessageSender.js";
import {InstagramTokenManager} from "./instagram/instagramTokenManager.js";
import {TikTokTokenManager} from "./tiktok/tiktokTokenManager.js";
import JsonManager from "./utils/jsonManager.js";
import {InstagramPoller} from "./instagram/instagramPoller.js";
import {UsersToken} from "./usersToken.js";
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildMembers,
]
});
const sender = new MessageSender(client);
const instagramID = process.env.INSTAGRAM_CLIENT_ID;
const instagramSecret = process.env.INSTAGRAM_CLIENT_SECRET;
const updateChannelID = process.env.BOT_UPDATE_CHANNEL_ID;
const socialChannelID = process.env.SOCIAL_CHANNEL_ID
const filePath = ".instagram_client_tokens.json";
const usersToken = new UsersToken(filePath)
const instagramTokenManager = new InstagramTokenManager(
{clientID : instagramID, clientSecret : instagramSecret, usersToken : usersToken}
);
const instagramPoller = new InstagramPoller(process.env.INSTAGRAM_POST_LIST, process.env.INSTAGRAM_POST_DETAILS, instagramTokenManager);
export const data = {
client,
sender,
instagramPoller,
updateChannelID,
socialChannelID,
instagramTokenManager,
//tiktokTokenManager
};
/*
const tiktokTokenManager = new TikTokTokenManager(
{filepath : ".tiktok_client_tokens.json", clientKey : "", clientSecret : ""}
);
*/