-
Notifications
You must be signed in to change notification settings - Fork 212
Scripts to automate sending messages in Telegram from command line #266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
3949b43
Scripts to automate sending messages in Telegram from command line added
35c456b
Update README.md
Namyalg a022e07
Updated README with a screenshot of the working script
f2c6a8b
Merge branch 'Automate-Telegram' of https://github.com/Namyalg/Awesom…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file not shown.
This file was deleted.
Oops, something went wrong.
Binary file not shown.
76 changes: 0 additions & 76 deletions
76
Image-Processing/Sobel-edge-detection/sobel-edge-detect.py
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| ## 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 ## | ||
|
||
|
|
||
|  | ||
|
|
||
| - The user is prompted to login and verify the phone number | ||
|
|
||
| - The user will receive a code which has to be entered | ||
|
|
||
|  | ||
|
|
||
| - After the verification process, the user can send messages to the contacts | ||
|
|
||
|  | ||
|
|
||
| - The user can send multiple messages to the same user | ||
|
|
||
| - The user can also send messages to multiple users | ||
|
|
||
46 changes: 46 additions & 0 deletions
46
System-Automation-Scripts/Automate-Telegram/automate_telegram.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update to
# Automate Telegram