aboutsummaryrefslogtreecommitdiff
path: root/telegrambot.py
blob: af3fd5a256a110c2a8be091cc22bc09da5b91cbf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import logging
from telegram import Update
from telegram.ext import ApplicationBuilder, ContextTypes, MessageHandler, filters
from config import BOT_TOKEN, CHANNEL_ID, USER_ID


async def relay(update: Update, context: ContextTypes.DEFAULT_TYPE):
    if update.message.from_user.id != int(USER_ID):
        return
    await update.message.forward(int(CHANNEL_ID))
    LOG.info(f"Message from {update.message.from_user.name} was forwarded to {CHANNEL_ID}")
    await update.message.delete()

LOG = logging.getLogger(__name__)
app = ApplicationBuilder().token(BOT_TOKEN).build()
app.add_handler(MessageHandler(filters.ALL, relay))
XMR address: 854DmXNrxULU3ZFJVs4Wc8PFhbq29RhqHhY8W6cdWrtFN3qmooKyyeYPcDzZTNRxphhJ5UzASQfAdEMwSteVqymk28aLhqj