This project aims to create a bot that allows the user to connect to different Social Media platforms at Once. and be able to view and post from a simple discord Command .
Instagram Cog Facebook Cog Linkdin Cog
This cog allows users to connect their Instagram accounts via OAuth or manually, view posts, delete posts, and view insights. Users are tracked in a SQLite database by Discord ID.
- Install dependencies:
pip install discord.py requests python-dotenv
- Create a
.envfile with:
APP_ID=your_facebook_app_id
APP_SECRET=your_facebook_app_secret
REDIRECT_URI=https://yourredirect.uri/callback
-
Ensure
database.dbexists or will be created automatically. -
Load the cog in your bot:
await bot.load_extension("cogs.instagram_cog")- Starts the OAuth flow to connect Instagram account.
- Stores token and username in database.
- Manually register a token for testing or dev purposes.
- Stores token and username in database.
-
Lists all Instagram posts for the connected account.
-
Displays embedded image, caption, type, timestamp, and shortened URL.
-
Adds buttons per post:
-
Delete Post: Deletes the post.
-
View Details: Shows all data for the post.
-
View Insights: Shows metrics depending on media type:
- IMAGE:
reach, likes, comments, saved - VIDEO:
reach, likes, comments, video_views, shares - REELS:
reach, likes, comments, plays, shares, saved
- IMAGE:
-
- Removes the user from the database.
- Disconnects Instagram account from bot.
-
userstable:discord_id: Discord user ID (unique)username: Instagram usernameinstagram_token: Access token for API calls