Home
› There are no categories

Telegram Bot Coding
Code 1
🖥️ Account
balance = str(User.getData("balance"))
wallet = str(User.getData('wallet'))
user = str(u)
user_info = bot.get_chat(u)
first_name = user_info.first_name if user_info.first_name else "No First Name"
username = user_info.username if user_info.username else "No Username"
user_id = user_info.id if user_info.id else "No User ID"
msg = f"""🙍♂️ Your Name: {first_name}
🔥 Username: @{username}
🚀 User ID: {user_id}
💳 Wallet: {wallet}
💰 Balance: {balance} টাকা"""
bot.replyText(u, msg, parse_mode="html")
Code 2
📊 Status
users = str(Bot.info().userstat)
withdraw = libs.Resources.globalRes('withdraw').value()
bot.replyText(
u, f"*📊 Total Users*: {users} *users*\n\n🚀Online Users : {users} ", parse_mode="markdown")
Code 3
💳 Wallet
wallet = User.getData("wallet")
bot.replyText(
chat_id=message.chat.id,
text=f"""💳 Current Wallet: {wallet}
⚙️ If you want to set or change your wallet, click here: /SetWallet""",
parse_mode="html"
)
Code 4
💲 Withdrawal
def withdraw():
wall = User.getData("wallet")
bal = User.getData("balance")
Mini_Withdraw = "10"
Max_Withdraw = str(int(bal))
if bal == None:
return
if wall == None:
bot.replyText(
u, "😎 Please set your wallet first. Transactions are not possible without it.", parse_mode="html")
return
if bal >= int(Mini_Withdraw):
bot.replyText(
u, f"💰 Minimum withdrawal: {Mini_Withdraw} টাকা. \n🚀 Maximum withdrawal: {Max_Withdraw} টাকা.\n\n📝 Now, আপনি কত টাকা উইথড্র করবেন তা পরিমাণ লিখুন 👇.", parse_mode="html")
Bot.handleNextCommand("Withdraw2")
else:
bot.replyText(
u, f"❌ Minimum withdrawal amount is {Mini_Withdraw} টাকা.", parse_mode="html")
return
withdraw()
Code 5
✅ Check
def check():
channels = [
'@tbpycofficial', '@tbpycofficial', '@tbpycofficial', '@tbpycofficial',
]
for channel in channels:
membership_status = bot.getChatMember(channel, u)
if membership_status.status == 'left':
return False
return True
if check():
keyboard = ReplyKeyboardMarkup(True)
keyboard.row("🖥️ Account", "⚡ Referral")
keyboard.row("💳 Wallet", "💲 Withdrawal")
keyboard.row("SUPPORT 💸")
keyboard.row("📊 Status")
bot.replyText(
chat_id=message.chat.id,
text="🎉 Welcome to the main menu. You can now use this bot.",
reply_markup=keyboard,
parse_mode="markdown"
)
refer = User.getData("refer")
bonus_given = User.getData("ref_bonus")
if refer is not None and bonus_given is None:
bot.replyText(
chat_id=refer,
text="💰 You have received 1 টাকা for referring a new user.",
parse_mode="markdown"
)
ref_balance = int(User.getData("balance", user=refer)) + 1
User.saveData("balance", ref_balance, user=refer)
ref_count = int(User.getData("ref_count", user=refer)) + 1
User.saveData("ref_count", ref_count, user=refer)
User.saveData("ref_bonus", True)
else:
bot.replyText(
chat_id=u,
text="❌ You need to join all our channels first.",
parse_mode="markdown"
)
Code 6
⚡ Referral
per_refer = "1 টাকা"
total_refer = str(User.getData("ref_count"))
bot_username = str(Bot.info().username)
link = f"https://t.me/{bot_username}?start={str(u)}"
msg = f"""
🏅 Per Referral: {per_refer}
📎 Your Referral Link: {link}
📊 Your Total Referrals: {total_refer} টি
🚫 Fake and cheat referrals will not be paid
"""
bot.replyText(u, msg, parse_mode="html")
Code 7
Withdraw2
def com(u):
u = str(u)
wallet = str(User.getData('wallet'))
user_info = bot.get_chat(u)
username = user_info.username if user_info.username else "No Username"
try:
amount = int(message.text)
bal = float(User.getData('balance'))
except:
bot.replyText(u, "⚠️ The amount entered is incorrect, please provide only numbers.",
parse_mode="markdown")
return
if amount < 2:
bot.replyText(u, "❌ To complete a withdrawal, you must have at least 10 টাকা in your account.",
parse_mode="markdown")
return
if amount > bal:
bot.replyText(u, "😳 The withdrawal amount exceeds your available balance.",
parse_mode="markdown")
return
currency = "টাকা"
balance = bal - amount
User.saveData("balance", balance)
payment_channel = "@tbpycofficial"
bot_username = str(Bot.info().username)
if payment_channel != "None":
bot.replyText(
chat_id=payment_channel,
text=f"""
Withdrawal Completed Successfully ✅
🚀 User ID: {u}
🔥 Username: @{username}
💰 Amount: {amount} {currency}
⏳ Payment Status: pending
💳 Wallet: <code>{wallet}</code>
🤖 Bot Link: @{bot_username}""",
parse_mode="html"
)
bot.replyText(
chat_id=u,
text=f"""
Withdrawal Request Successful ✅
🚀 User ID: {u}
🔥 Username: @{username}
💰 Amount: {amount} {currency}
⏳ Payment Status: Pending
💳 Wallet: <code>{wallet}</code>
🔗 Payment Channel: {payment_channel}""",
parse_mode="html"
)
com(u)
Code 8
SetWallet2
User.saveData('wallet', message.text)
bot.replyText(u, "*✅ Success*", parse_mode="markdown")
Code 9
SUPPORT 💸
bot.replyText(
chat_id=u,
text="☎️ *উথড্র দেওয়ার ২৪ ঘন্টার মেধ্যে পেমেন্ট না পেলে যোগাযোগ করুন:- @SK_Sawon_Islam \n"
"উইথড্র দেওয়ার পর অবশ্যই নক দিবেন :-@tbpycofficial *\n\n",
parse_mode="markdown"
)
Code 10
/start
text = """If you want to continue using this bot, you need to join all the channels below:@chackbv
✅ Click the 'Check' button if you have joined all the channels."""
is_invited = User.getData("is_invited")
already = User.getData('bot_user')
if already is None:
User.saveData('balance', 0)
User.saveData('ref_count', 0)
User.saveData('withdrawn', 0)
User.saveData('bot_user', True)
if Bot.getData('total_users') is None:
Bot.saveData('total_users', 1)
else:
t = int(Bot.getData('total_users')) + 1
Bot.saveData('total_users', t)
keyboard = InlineKeyboardMarkup([
[
InlineKeyboardButton("👑OWNER👑", url="https://t.me/tbpycofficial"),
InlineKeyboardButton("Support", url="https://t.me/tbpycofficial")
],
[
InlineKeyboardButton("Support", url="https://t.me/tbpycofficial")
],
[
InlineKeyboardButton("PAYMENT💰", url="https://t.me/tbpycofficial")
],
[InlineKeyboardButton("✅ Check", callback_data="✅ Check")]
])
refer = message.text.split(" ")
if message.text == "/start":
bot.replyText(u, "Developed by @tbpyc", parse_mode="html")
if is_invited is None:
User.saveData('is_invited', True)
bot.sendPhoto(
chat_id=u,
photo="https://imgur.com/a/8jcJLZk",
caption=text,
parse_mode="html",
reply_markup=keyboard
)
else:
if str(u) == refer[1]:
if is_invited is None:
User.saveData("is_invited", True)
bot.sendPhoto(
chat_id=u,
photo="https://imgur.com/a/8jcJLZk",
caption=text,
parse_mode="html",
reply_markup=keyboard
)
else:
if is_invited is None:
bot_user = User.getData("bot_user", user=refer[1])
if bot_user is not None:
User.saveData("refer", refer[1])
User.saveData("is_invited", True)
bot.sendPhoto(
chat_id=u,
photo="https://imgur.com/a/8jcJLZk",
caption=text,
parse_mode="html",
reply_markup=keyboard
)
Code 11
/bcast
bot.replyText(u, "🔍 <b>Forward Your Message To Broadcast</b>")
Bot.handleNextCommand("/bc")
Code 12
/bc
idd = '8133346948'
if str(idd) != str(message.chat.id):
bot.sendMessage(chat_id=u, text="❌ Command not found")
else:
code = f"""bot.forwardMessage(chat_id=u,from_chat_id='''{message.chat.id}''',message_id='''{message.message_id}''')"""
task = Bot.broadcast(code=code)
bot.sendMessage("<b>📣 Broadcast Sent...</b>")
Bot.saveData(task, None)
Code 13
/SetWallet
bot.replyText(u, "📝 Please Your Bkash Number", parse_mode="html")
Bot.handleNextCommand("SetWallet2")
Page 1 of 13
0 Comments: