Spaces:
Paused
Paused
| import logging | |
| import requests | |
| from telegram import Update | |
| from telegram.ext import Updater, CommandHandler, CallbackContext | |
| # Set up logging | |
| logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging.INFO) | |
| # Your SocPanel API key and endpoint | |
| SOC_PANEL_API_KEY = 'yho1ES9sQ51udmTgAapCtRqJtM8zeiLKoLkHod1QWkR8bzSkttHb8yifFrNf' | |
| SOC_PANEL_API_URL = 'https://socpanel.com/privateApi' | |
| # Your Telegram bot token | |
| TELEGRAM_BOT_TOKEN = '7684829859:AAHABWrxsMDF3L9Xo4A5xZBwtIu76dL19dY' | |
| def start(update: Update, context: CallbackContext) -> None: | |
| update.message.reply_text('Welcome to the Followers Bot! Use /add_follower to add a follower.') | |
| def add_follower(update: Update, context: CallbackContext) -> None: | |
| # Example of how to call the SocPanel API to add a follower | |
| user_id = context.args[0] if context.args else None | |
| if user_id: | |
| response = requests.post(f"{SOC_PANEL_API_URL}/add_follower", data={ | |
| 'api_key': SOC_PANEL_API_KEY, | |
| 'user_id': user_id | |
| }) | |
| if response.status_code == 200: | |
| update.message.reply_text(f"Follower {user_id} added successfully!") | |
| else: | |
| update.message.reply_text("Failed to add follower.") | |
| else: | |
| update.message.reply_text("Please provide a user ID.") | |
| def main() -> None: | |
| updater = Updater(TELEGRAM_BOT_TOKEN) | |
| dispatcher = updater.dispatcher | |
| dispatcher.add_handler(CommandHandler("start", start)) | |
| dispatcher.add_handler(CommandHandler("add_follower", add_follower)) | |
| updater.start_polling() | |
| updater.idle() | |
| if __name__ == '__main__': | |
| main() |