leam-tech / frappe_telegram

Telegram Bot support for Frappe / ERPNext.
Other
34 stars 25 forks source link

feat: add support for selecting bot for Telegram Notifcations #8

Closed Abadulrehman closed 2 years ago

Abadulrehman commented 3 years ago

This PR adds the ability to select a bot on defining a Notification with the Telegram channel. Specifically:

  1. It adds a custom field on the Notification Doctype (which will only appear when the Telegram channel is selected): "Send from bot" on which a bot can be selected to send the notification from. If no bot is selected, the default is used to send the notification.
  2. Adds a "Mark as Default" button on Telegram Bot, which will mark the bot as the default bot to send notification from if no bot is selected. A bot is automatically marked as the default on creation, and replaced as default with the most recent one if it is deleted.
  3. Adds a test to test the auto-default behavior, and one to test mark_as_default controller method.