DEV Community

rexdivakar
rexdivakar

Posted on

Notifly


Logo

Star the repo if you love it !!

Table of Contents

About the package

A Simple Bot to push notifications during an event trigger.

Built With

Install the package

Run the following terminal commands to install the package on the given distros.

  • Termux :
pkg install python3 
Enter fullscreen mode Exit fullscreen mode
pip3 install notifly
Enter fullscreen mode Exit fullscreen mode
  • Ubuntu/Debian
sudo apt install python3-pip
Enter fullscreen mode Exit fullscreen mode
pip3 install notifly
Enter fullscreen mode Exit fullscreen mode
  • Arch
sudo pacman -S python3-pip
Enter fullscreen mode Exit fullscreen mode
pip3 install notifly
Enter fullscreen mode Exit fullscreen mode

This may take a while depending on the network speed.

Prerequisites

  • Python3 It is preinstalled in Ubuntu 20.04. To check the version use command :
python3 --version
Enter fullscreen mode Exit fullscreen mode

If it is not preinstalled for some reason, proceed here and download as per requirement.

Run the following command in terminal to download the required packags for running the tool locally :

  • Using requirements file :
pip3 install -r requirements.txt
Enter fullscreen mode Exit fullscreen mode
  • Directly download :
pip3 install requests==2.20.0
Enter fullscreen mode Exit fullscreen mode

Working of the tool

To see how the tool works, create a telegram bot.

  1. Creating the telegram bot
    1. Open Telegram messenger, sign in to your account or create a new one.
    2. Enter @botfather in the search tab and choose this bot.Note, official Telegram bots have a blue checkmark beside their name.
    3. Click Start to activate BotFather bot.
    4. Choose or type /newbot and send it.
    5. Choose a name for the bot, the bot can be found by its username in searches. The username must be unique and end with the word bot.
  2. Getting the bot API token
    • Newly created bot
  • Already existing bot
    1. Run sample code
from notifly import telegram

token = input("Enter bot token : ")
bot=notifly.BotHandler(token)
text = input("Enter text message : ")
print(bot.send_message(text))
opt_image = input("Do you want to send image ?")
if(opt_image=='y' or opt_image=='Y'):
    img_path = input("Enter full image path : ")
    bot.send_image(img_path)
Enter fullscreen mode Exit fullscreen mode

Contributing

  1. Fork the Project
  2. Create your Feature Branch
git checkout -b feature/mybranch
Enter fullscreen mode Exit fullscreen mode
  1. Commit your Changes
git commit -m 'Add something'
Enter fullscreen mode Exit fullscreen mode
  1. Push to the Branch
git push origin feature/mybranch
Enter fullscreen mode Exit fullscreen mode
  1. Open a Pull Request

Follow the given commands or use the amazing GitHub GUI

Happy Contributing 😃

Github Repo

Top comments (0)