Code Monkey home page Code Monkey logo

alfred's Introduction

alfred

Alfred is a python library that allows you to send messages or files via telegram directly from your pyhton code

install

git clone https://github.com/lucagarau/alfred
pip install alfred-bot.tar.gz

get start

To start receiving messages from Alfred, create a telegram bot and get the bot token.

Create a bot.py file to start sending messages.

  from alfred_bot import Alfred

  chat_id = 123445667
  token = "Your Bot Token"
  bot = Alfred(chat_id,token)
  bot.send_message("poho")
  

Send file or photo

To send files or photos use the bot's dedicated methods

  from alfred_bot import Alfred

  photo_path = "/home/photo.png"
  file_path = "/home/document.txt"

  chat_id = 123445667
  token = "Your Bot Token"

  bot = Alfred(chat_id,token)
  bot.send_photo(photo_path)
  bor.send_file(file_path)

Send broadcast

To send messages, files or photos to multiple users at the same time, you must first add the users to the recipient list and then call the broadcast methods

  from alfred_bot import Alfred

 
  chat_id_broadcast_1 = 1244614141
  chat_id_broadcast_2 = 1231412412

  chat_id = 123445667
  token = "Your Bot Token"
  bot = Alfred(chat_id,token)


  alfred.add_user("Nolan", chat_id_broadcast_1)
  alfred.add_user("Chazelle", chat_id_broadcast_2)

  bot.send_message("poho", broadcast = True)
 

alfred's People

Contributors

lucagarau avatar

Stargazers

JacopoMereu avatar Federico Meloni avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.