Script Wraper
Open in Telegram
Download All New Latest Theme, Plugins, Scripts & Codes Only On "Script Wrap" Stay With "Script Wrap" & Get π πPremium Script πPremium Theme πPremium Plugins πPremium Codes
Show more794
Subscribers
No data24 hours
No data7 days
No data30 days
Posts Archive
I am adding AI voice to my tutorial videos. So you tell me in which language I make video. Hindi / English ?
Guys, I am not talking about money, I am only talking about sharing and giving reactions, and that too is not happening to you.
Please Give Reactions And Share This Channel for More Content.
How to delete previous bot message
Code -
import telebot
bot = telebot.TeleBot('Your Bot Token Here')
@bot.message_handler(commands=['start'])
def start(message):
bot.send_message(message.chat.id, "run /delete command for delete this message")
@bot.message_handler(commands=['delete'])
def delete_previous_message(message):
# Get the ID of the previous message to be deleted
prev_message_id = message.message_id - 1
# Delete the previous message
bot.delete_message(message.chat.id, prev_message_id)
bot.send_message(message.chat.id,"previews bot message deleted."
bot.polling()
Please Share @KaranCoder To Your Friends πHow to send and edit_message_reply_markup
Code -
import telebot
bot = telebot.TeleBot('YOUR_BOT_TOKEN')
@bot.message_handler(commands=['start'])
def start(message):
# Create an inline keyboard
keyboard = telebot.types.InlineKeyboardMarkup()
keyboard.row(
telebot.types.InlineKeyboardButton("Button 1", callback_data='button1'),
telebot.types.InlineKeyboardButton("Button 2", callback_data='button2')
)
bot.send_message(message.chat.id, "Select an option:", reply_markup=keyboard)
@bot.callback_query_handler(func=lambda call: True)
def callback_handler(call):
if call.data == 'button1':
# Handle Button 1 callback
bot.send_message(call.message.chat.id, "Button 1 pressed!")
# Edit the inline keyboard
new_keyboard = telebot.types.InlineKeyboardMarkup()
new_keyboard.row(
telebot.types.InlineKeyboardButton("New Button", callback_data='new_button')
)
bot.edit_message_reply_markup(call.message.chat.id, call.message.message_id, reply_markup=new_keyboard)
elif call.data == 'new_button':
# Handle New Button callback
bot.send_message(call.message.chat.id, "New Button pressed!")
bot.polling()
Please Share @KaranCoder To Your Friends...How to resize_keyboard In Python Telebot...
Code -
import telebot
bot = telebot.TeleBot('YOUR_BOT_TOKEN')
@bot.message_handler(commands=['start'])
def start(message):
# Create a custom reply keyboard with resized buttons
keyboard = telebot.types.ReplyKeyboardMarkup(row_width=2, resize_keyboard=True)
keyboard.add("Button 1", "Button 2", "Button 3", "Button 4")
bot.send_message(message.chat.id, "Select an option:", reply_markup=keyboard)
@bot.message_handler(func=lambda message: True)
def handle_message(message):
if message.text == "Button 1":
# Handle Button 1
bot.send_message(message.chat.id, "Button 1 pressed!")
elif message.text == "Button 2":
# Handle Button 2
bot.send_message(message.chat.id, "Button 2 pressed!")
bot.polling()
Please Share @KaranCoder To Your Friends....How to make telegram bot with python || Android Series
Link - https://youtu.be/y_KGDVR-s10
Description - Please Subscribe Our YouTube Channel
Code Used In Video -
Video Link - https://youtu.be/CnvYRrALHSM
import telebot
# Create an instance of the TeleBot class with your bot token
bot = telebot.TeleBot('here bot token')
# start command
@bot.message_handler(commands=['start'])
def start_message(message):
bot.send_message(message.chat.id,"Welcome to Our Tutorial Bot\n\nPlease Join Our Channel - @KaranCoder || @TGBotsCode\n\n/keyboard - keyboard\n/inline_keyboard - inline keyboard")
# Define the handler for the /keyboard command
@bot.message_handler(commands=['keyboard'])
def keyboard_button(message):
# Create the keyboard markup
keyboard = telebot.types.ReplyKeyboardMarkup(row_width=2)
keyboard.add('Option 1', 'Option 2')
keyboard.add('Option 3', 'Option 4')
# Send the keyboard options to the user
bot.send_message(message.chat.id, 'Please choose an option:', reply_markup=keyboard)
# Define the handler for the /inline_keyboard command
@bot.message_handler(commands=['inline_keyboard'])
def start(message):
# Create the inline keyboard markup
keyboard = telebot.types.InlineKeyboardMarkup()
keyboard.row(
telebot.types.InlineKeyboardButton('Option 1', callback_data='option1'),
telebot.types.InlineKeyboardButton('Option 2', callback_data='option2')
)
keyboard.row(
telebot.types.InlineKeyboardButton('Option 3', callback_data='option3'),
telebot.types.InlineKeyboardButton('Option 4', callback_data='option4')
)
bot.send_message(message.chat.id, 'Please choose an option:', reply_markup=keyboard)
# Define the callback query handler
@bot.callback_query_handler(func=lambda call: True)
def handle_callback_query(call):
# Handle the user's selection based on the callback data
if call.data == 'option1':
bot.send_message(call.message.chat.id, 'You selected Option 1')
elif call.data == 'option2':
bot.send_message(call.message.chat.id, 'You selected Option 2')
elif call.data == 'option3':
bot.send_message(call.message.chat.id, 'You selected Option 3')
elif call.data == 'option4':
bot.send_message(call.message.chat.id, 'You selected Option 4')
# Define the handler for receiving messages
@bot.message_handler(func=lambda message: True)
def handle_message(message):
# Check if the message text matches one of the expected keyboard options
if message.text == 'Option 1':
bot.reply_to(message, 'You selected Option 1')
elif message.text == 'Option 2':
bot.reply_to(message, 'You selected Option 2')
elif message.text == 'Option 3':
bot.reply_to(message, 'You selected Option 3')
elif message.text == 'Option 4':
bot.reply_to(message, 'You selected Option 4')
else:
bot.reply_to(message, 'Option / Keyboard / Command Not Found')
# Start the bot
bot.polling()Repost from πππ ππ π½πππ
Friends, make videos in python series or stop because you do not react to videos.
How to make Telegram Bot - Android Series
Link - https://youtu.be/AhGoA3aiDW8
PlayList - https://youtube.com/playlist?list=PL73F3WfwTymRVRSpONy2Ad3D1pdoG1oXD
Discription - Please Like, Comments & Subscribe
