〽️ Random Hindi And English Joke Sender With Refresh Button [Telebot Codes].
💓 Command: /joke
🔍 TPY:
chnl = "@Privates_Bots"#edit with channel username
markup = InlineKeyboardMarkup()
markup.add(InlineKeyboardButton(text="🔁 Refresh", callback_data="/joke edit"))
ran = libs.Random.randomInt(100000, 999999999)
anime = "https://telegra.ph/file/041ba93a1a78a5be851fa.jpg"
response = HTTP.get(
'https://hindi-jokes-api.onrender.com/jokes?api_key=598dbd0d14871e0d522a48b4e8da')
quotes = response.json()
joke = quotes['jokeContent']
content = HTTP.get(
f"https://lingva.ml/api/v1/hi/en/{joke}")
trans = content.json() # Convert the response to JSON
translate = trans['translation'] # Access the 'translation' field
Text = f'''
📍 Random Jokes!
\n🇮🇳 Hindi:
{joke}
\n🇬🇧 English:
{translate}\n
🎙 Last Clicked By {u}
'''
media = InputMediaPhoto(media=f"{anime}", caption=f"{Text}", parse_mode='html')
if params == 'None':
bot.sendPhoto(chat_id=chnl, photo=anime, caption=Text, reply_markup=markup)
if params == "edit":
bot.editMessageMedia(chat_id=chnl, message_id=message.message_id, media=media, reply_markup=markup)
🧑🏼💻 Created By: @Swastik_Raj
💓 Command: /joke
🔍 TPY:
chnl = "@Privates_Bots"#edit with channel username
markup = InlineKeyboardMarkup()
markup.add(InlineKeyboardButton(text="🔁 Refresh", callback_data="/joke edit"))
ran = libs.Random.randomInt(100000, 999999999)
anime = "https://telegra.ph/file/041ba93a1a78a5be851fa.jpg"
response = HTTP.get(
'https://hindi-jokes-api.onrender.com/jokes?api_key=598dbd0d14871e0d522a48b4e8da')
quotes = response.json()
joke = quotes['jokeContent']
content = HTTP.get(
f"https://lingva.ml/api/v1/hi/en/{joke}")
trans = content.json() # Convert the response to JSON
translate = trans['translation'] # Access the 'translation' field
Text = f'''
📍 Random Jokes!
\n🇮🇳 Hindi:
{joke}
\n🇬🇧 English:
{translate}\n
🎙 Last Clicked By {u}
'''
media = InputMediaPhoto(media=f"{anime}", caption=f"{Text}", parse_mode='html')
if params == 'None':
bot.sendPhoto(chat_id=chnl, photo=anime, caption=Text, reply_markup=markup)
if params == "edit":
bot.editMessageMedia(chat_id=chnl, message_id=message.message_id, media=media, reply_markup=markup)
🧑🏼💻 Created By: @Swastik_Raj