Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
logger = logging.getLogger('bot')


def start(bot, update):
def command_start(bot, update):
logger.info('Received command /start')
bot.send_message(chat_id=update.message.chat_id, text=config.BOT_GREETING)


def help(bot, update):
def command_help(bot, update):
logger.info('Received command /help')
bot.send_message(
chat_id=update.message.chat_id,
Expand All @@ -28,6 +28,14 @@ def help(bot, update):
)


def command_status(bot, update):
logger.info('bot asked to execute /status commamd')
bot.send_message(
chat_id=update.message.chat_id,
text=f'Status is OK, running since {utils.since()}',
)


def welcome(bot: Bot, update: Update):
logger.info('Received new user event')
new_member = update.message.new_chat_members[0]
Expand Down Expand Up @@ -69,14 +77,6 @@ def reply(bot, update):
)


def status(bot, update):
logger.info('bot asked to execute /status commamd')
bot.send_message(
chat_id=update.message.chat_id,
text=f'Status is OK, running since {utils.since()}',
)


def main():
logging.basicConfig(
level=config.LOG_LEVEL,
Expand All @@ -88,9 +88,9 @@ def main():
updater = Updater(config.TELEGRAM_BOT_TOKEN)
dp = updater.dispatcher

dp.add_handler(CommandHandler('start', start))
dp.add_handler(CommandHandler('help', help))
dp.add_handler(CommandHandler('status', status))
dp.add_handler(CommandHandler('start', command_start))
dp.add_handler(CommandHandler('help', command_help))
dp.add_handler(CommandHandler('status', command_status))
dp.add_handler(MessageHandler(Filters.status_update.new_chat_members, welcome))
dp.add_handler(MessageHandler(Filters.group, reply))

Expand Down