Skip to content
This repository has been archived by the owner on Nov 30, 2022. It is now read-only.

Scripts to automate sending messages in Telegram from command line #266

Merged
merged 4 commits into from
Sep 19, 2020
Merged
Show file tree
Hide file tree
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
Binary file removed Image-Processing/Sobel-edge-detection/Lion.JPG
Binary file not shown.
27 changes: 0 additions & 27 deletions Image-Processing/Sobel-edge-detection/README.md

This file was deleted.

Binary file removed Image-Processing/Sobel-edge-detection/after.png
Binary file not shown.
76 changes: 0 additions & 76 deletions Image-Processing/Sobel-edge-detection/sobel-edge-detect.py

This file was deleted.

26 changes: 26 additions & 0 deletions System-Automation-Scripts/Automate-Telegram/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
## Automate Telegram
- This script can be used to automate the process of sending messages in Telegram
- Here the process of automation is achieved by using the framework Selenium.
- Selenium is a portable framework for testing and automating web applications web applications

## Working

![Image](login.png)

- The user is prompted to login and verify the phone number

- The user will receive a code which has to be entered

![Image](code.png)

- After the verification process, the user can send messages to the contacts

![Image](send.png)

- The user can send multiple messages to the same user

- The user can also send messages to multiple users

![Image](working.PNG)

- An message sent from the commandline
46 changes: 46 additions & 0 deletions System-Automation-Scripts/Automate-Telegram/automate_telegram.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#Imports and dependencies
from selenium import webdriver
import time
from selenium.webdriver.common.keys import Keys

time_wait_sixty = 60
time_wait_four = 4

#Here the process of automation is achieved by using the framework Selenium.
#Selenium is a portable framework for testing and automating web applications web applications

def automate_telegram():
#Path to the chromedriver must be entered without quotations
PATH = input("Enter path to the location chromedriver ")
chrome_path = PATH
#Initiating and setting up the driver
driver = webdriver.Chrome(chrome_path)
#For logging into web telegram, the user must verify the phone number
URL = "https://web.telegram.org/#/login"
driver.get(URL)
time.sleep(time_wait_sixty)
user = 1
while user:
driver.find_element_by_xpath("/html/body/div[1]/div[2]/div/div[1]/div[1]/div/input").click()
name = input("Enter the name of the person ")
driver.find_element_by_xpath("/html/body/div[1]/div[2]/div/div[1]/div[1]/div/input").send_keys(name)
time.sleep(time_wait_four)
driver.find_element_by_xpath("/html/body/div[1]/div[2]/div/div[1]/div[2]/div/div[1]/ul/li").click()
msg = 1
while msg:
message = input("Enter message ")
driver.find_element_by_xpath("/html/body/div[1]/div[2]/div/div[2]/div[3]/div/div[3]/div[2]/div/div/div/form/div[2]/div[5]").send_keys(message)
driver.find_element_by_xpath("/html/body/div[1]/div[2]/div/div[2]/div[3]/div/div[3]/div[2]/div/div/div/form/div[2]/div[5]").send_keys(Keys.ENTER)
print("Do you want to send another message? ")
msg = int(input("Enter 1 to continue, 0 to stop "))
if msg == 0:
break

print("Do you want to send messages to another contact? ")
user = int(input("Enter 1 to continue, 0 to stop "))

return("All messages sent")

if __name__ == "__main__":
automate_telegram()

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.