|
| 1 | +##################################################### Skype Automation ###################################################### |
| 2 | +################################################ Developed By Avdhesh Varshney ############################################## |
| 3 | +############################################ (https://github.com/Avdhesh-Varshney) ########################################## |
| 4 | + |
| 5 | +'''Install Python Packages as listed below using these commands in the terminal |
| 6 | +
|
| 7 | +Sr. No. Package Name Commands |
| 8 | +1. os pip install os |
| 9 | +2. skpy pip install SkPy |
| 10 | +
|
| 11 | +After install all these packages then import all of them in this file.''' |
| 12 | + |
| 13 | +# Importing libraries |
| 14 | +import os |
| 15 | +from skpy import Skype |
| 16 | + |
| 17 | +os.system("cls" if os.name == "nt" else "clear") |
| 18 | + |
| 19 | +# Global variables for username and password |
| 20 | +print("\nWelcome to Skype Automation 🤖\n") |
| 21 | +username = input("Enter your Skype username: ") |
| 22 | +password = input("\nEnter your Skype password: ") |
| 23 | +print("\n\n\tWait for some time for login...\n") |
| 24 | + |
| 25 | +# Login into the skype account |
| 26 | +try: |
| 27 | + slogin = Skype(username, password) |
| 28 | + |
| 29 | +except: |
| 30 | + print("\nEither internet is not working or credentials are wrong !\n") |
| 31 | + exit(0) |
| 32 | + |
| 33 | +# Fetching all chats of skype account |
| 34 | +def allChats(): |
| 35 | + chats = slogin.chats |
| 36 | + j = 1 |
| 37 | + for i in chats: |
| 38 | + print(f"\n\n############ Chat-{j} ############\n") |
| 39 | + print(i) |
| 40 | + j = j+1 |
| 41 | + |
| 42 | +# Fetching all contacts of skype account |
| 43 | +def allContacts(): |
| 44 | + contacts = slogin.contacts |
| 45 | + j = 1 |
| 46 | + for i in contacts: |
| 47 | + print(f"\n\n############ Contact-{j} ############\n") |
| 48 | + print(i) |
| 49 | + j = j+1 |
| 50 | + |
| 51 | +# Sending direct message to the any user |
| 52 | +def sendMessage(): |
| 53 | + message = input("Enter Your Message: ") |
| 54 | + to = input("\nEnter ID of Skype user: ") |
| 55 | + ch = slogin.contacts[to] |
| 56 | + ch.chat.sendMsg(message) |
| 57 | + |
| 58 | + print("\nMessage Delivered !\n") |
| 59 | + |
| 60 | +# Create group on skype |
| 61 | +def createGroup(): |
| 62 | + arr = [] |
| 63 | + j = 1 |
| 64 | + n = int(input("Enter number of members of group: ")) |
| 65 | + for i in range(n): |
| 66 | + id = input(f"\nEnter ID of user {j}: ") |
| 67 | + arr.append(id) |
| 68 | + j = j+1 |
| 69 | + |
| 70 | + # Create a group |
| 71 | + slogin.chats.create(arr) |
| 72 | + |
| 73 | + print("\nGroup Created !\n") |
| 74 | + |
| 75 | +# Send a image to the user |
| 76 | +def sendImage(): |
| 77 | + to = input("Enter ID of Skype user: ") |
| 78 | + ch = slogin.contacts[to] |
| 79 | + path = input("\nEnter path of Image file: ") |
| 80 | + fileName = input("\nEnter Filename: ") |
| 81 | + with open(path, 'rb') as f: |
| 82 | + ch.chat.sendFile(f, fileName, image=True) |
| 83 | + |
| 84 | + print("\nImage Shared !\n") |
| 85 | + |
| 86 | +# Share any contact with the other user |
| 87 | +def shareContact(): |
| 88 | + to = input("Enter ID of Skype user: ") |
| 89 | + contact = [] |
| 90 | + ct = input("\nContact of Whom: ") |
| 91 | + contact.append(ct) |
| 92 | + ch = slogin.contacts[to] |
| 93 | + ch.sendContact(slogin.contacts[contact]) |
| 94 | + |
| 95 | + print("\nContact Shared !\n") |
| 96 | + |
| 97 | +# Main function |
| 98 | +def main(): |
| 99 | + |
| 100 | + while True: |
| 101 | + # Get user's choice |
| 102 | + os.system('cls') |
| 103 | + print('''\n*********************** Welcome to Skype Automation 🤖 ***********************\n |
| 104 | + \t\tEnter 1️⃣ to show user profile |
| 105 | + \t\tEnter 2️⃣ to enlist all the Contacts |
| 106 | + \t\tEnter 3️⃣ to enlist all the Chats |
| 107 | + \t\tEnter 4️⃣ to create a group |
| 108 | + \t\tEnter 5️⃣ to send a direct message to a user |
| 109 | + \t\tEnter 6️⃣ to send a image |
| 110 | + \t\tEnter 7️⃣ to share contact of any people |
| 111 | + \t\tEnter 0️⃣ to exit the program\n''') |
| 112 | + |
| 113 | + try: |
| 114 | + value = int(input("Enter your choice: ")) |
| 115 | + except ValueError: |
| 116 | + print("\nInvalid input! \n\nPlease enter a number from the options.") |
| 117 | + continue |
| 118 | + |
| 119 | + os.system('cls') |
| 120 | + print("\n*********************** Welcome to Skype Automation 🤖 ***********************\n") |
| 121 | + |
| 122 | + if value == 0: |
| 123 | + os.system('cls') |
| 124 | + print("\n******************* Thanks for using Skype Automation 🤖 Program 👋 *******************\n\n") |
| 125 | + exit(0) |
| 126 | + |
| 127 | + elif value == 1: |
| 128 | + print("\nFetching Data from Internet...\n") |
| 129 | + print(slogin.user) |
| 130 | + |
| 131 | + elif value == 2: |
| 132 | + print("\nFetching Details of All Contacts...\n") |
| 133 | + allContacts() |
| 134 | + |
| 135 | + elif value == 3: |
| 136 | + print("\nFetching Details of All Chats...\n") |
| 137 | + allChats() |
| 138 | + |
| 139 | + elif value == 4: |
| 140 | + print("\nCreate a group with other users...\n") |
| 141 | + createGroup() |
| 142 | + |
| 143 | + elif value == 5: |
| 144 | + print("\nSending a direct message to a user...\n") |
| 145 | + sendMessage() |
| 146 | + |
| 147 | + elif value == 6: |
| 148 | + print("\nSending image directly to the user...\n") |
| 149 | + sendImage() |
| 150 | + |
| 151 | + elif value == 7: |
| 152 | + print("\nSharing contact of any user...\n") |
| 153 | + shareContact() |
| 154 | + |
| 155 | + else: |
| 156 | + print("\nInvalid choice. Please enter a valid number from the options.\n") |
| 157 | + |
| 158 | + input("\n\nPress 'Enter Key' to continue !\n\n") |
| 159 | + |
| 160 | +# Driver function |
| 161 | +if __name__ == "__main__": |
| 162 | + main() |
0 commit comments