Skip to content
Snippets Groups Projects
Commit decc9b57 authored by lh1008's avatar lh1008 💬
Browse files

Merge branch 'wel_come' into 'master'

Wel_come bot message

See merge request churchofmonero/monerojobsbot!2
parents 9e373354 395cd384
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/python3
""" Module that displays first start bot message """
import logging
from telegram.ext import CommandHandler
from telegram.ext import Updater
from telegram import Update
from telegram.ext import CommandHandler, Updater, MessageHandler, Filters
from telegram.ext import CallbackContext
updater = Updater(token='', use_context=True)
dispatcher = updater.dispatcher
......@@ -15,9 +16,29 @@ def start(update, context):
start_handler = CommandHandler('start', start)
dispatcher.add_handler(start_handler)
updater.start_polling()
update.stop()
if __name__ == "__main__":
start()
def user_joined(update: Update, context: CallbackContext):
""" Method that welcomes a user """
# Get the username
user = update.effective_user.username
# Check if the user has a username. If not,
# use the first name which is always there
if user:
user = "@" + user
else:
user = update.effective_user.first_name
# Create a message that greets the user
msg = "Hey " + user + " welcome to Monero Service!"
# Send that message to the group
context.bot.send_message(update.message.chat_id, msg)
# Create a MessageHandler that will only listen to message about joined users
join = MessageHandler(Filters.status_update.new_chat_members, user_joined)
# Add the new handler to the dispatcher of the bot
updater.dispatcher.add_handler(join)
updater.start_polling()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment