Skip to content

Instantly share code, notes, and snippets.

@KeshavSharmaWeb
Created October 16, 2022 18:52
Show Gist options
  • Save KeshavSharmaWeb/2adf8f5eca029e7f9a9fce5879cd40db to your computer and use it in GitHub Desktop.
Save KeshavSharmaWeb/2adf8f5eca029e7f9a9fce5879cd40db to your computer and use it in GitHub Desktop.
Telegram Bot for greeting new users in the group using Python - Telebot
# pip install pyTelegramBotAPI
import json
from telebot import types
import telebot
token = "ENTER-YOUR-ACCESS-TOKEN-HERE"
bot = telebot.TeleBot(token)
def greet_user(messages):
for message in messages:
for new_member in message.new_chat_members:
bot.send_message(message.chat.id, f'Welcome {new_member.first_name} to the group!')
bot.set_update_listener(greet_user)
if __name__ == '__main__':
bot.infinity_polling()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment