General Functions

misbot.general.start(bot, update)

Initial message sent to all users. Starts registration conversation, passes control to credentials()

misbot.general.register(bot, update, user_data)

Let all users register with their credentials. Similar to start() but this function can be invoked by /register command.

If user’s chatID & DOB are already present in database then ends the conversation. Otherwise, if only chatID is present, then stores StudentID (PID) in user_data dict & gives control to parent_login() function.

If both conditions are false, then asks user to input Student details (PID & Password) and gives control to credentials()

misbot.general.credentials(bot, update, user_data)

Store user credentials in a database. Takes student info (PID & password) from update.message.text and splits it into Student_ID & Password and checks if they are correct with misbot.mis_utils.check_login() and stores them in the Chat table. Finally, sends message asking users to enter DOB and gives control to parent_login() after storing Student_ID (PID) in user_data dict.

misbot.general.parent_login(bot, update, user_data)

user_data dict contains Student_ID key from credentials(). Extracts DOB from update.message.text and checks validity using misbot.mis_utils.check_parent_login() before adding it to database. Finally, sends a message to the user requesting them to start using /attendance or /itinerary commands.

misbot.general.delete(bot, update)

Delete a user’s credentials if they wish to stop using the bot or update them.

misbot.general.cancel(bot, update)

Cancel registration operation (terminates conv_handler)

misbot.general.unknown(bot, update)

Respond to incomprehensible messages/commands with some canned responses.

misbot.general.help_text(bot, update)

Display help text.

misbot.general.tips(bot, update)

Send a random tip about the bot.

misbot.general.error_callback(bot, update, error)

Simple error handling function. Handles PTB lib errors

misbot.general.subscription(bot, update)

Sends text detailing the subscription model