File size: 1,637 Bytes
4bd737c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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()