def getChats(self):

        self.skc = SkypeChats(self)
        chts = self.skc.recent()
        while chts:
            for el in chts:
                if el.startswith("19"):
                    self.elements[el] = chts.get(el).topic
                    print(chts.get(el).topic, "->", el)

            chts = self.skc.recent()
Example #2
0
 def get_messages(self, target):
     try:
         chats_object = SkypeChats(self.skype_object)
         messages = chats_object.recent()
         single_chat = messages["8:" + target]
         results = []
         for message in single_chat.getMsgs():
             content = message.content
             sender = message.userId
             recipient = message.chatId
             time = message.time
             time = datetime.strptime(time, "%Y-%m-%d %H:%M:%S.%f")
             if "8:" + sender != recipient:
                 sender = self.username
             results.append(
                 GatherMessage(str(content), str(sender), str(recipient),
                               time))
         return results
     except:
         print('No Recent Messages')
         return []
def main():

    # Sign in.
    try:
        load_dotenv()
        password = os.environ.get('SKYPE_PASSWORD')
        email = os.environ.get('SKYPE_EMAIL')
        sk = Skype(email, password)
    except:
        print("sign in error: " + str(e))
        sys.exit()

    # Get a random contact.
    try:
        chats = list(SkypeChats(
            sk).recent().keys())  # SkypeChats(sk).recent() is a dictionary.
        # That's why it has a keys() method.
        chat = sk.chats[random.choice(chats)]
    except:
        print("get contact error: " + str(e))
        sys.exit()

    # Read old messages
    try:
        chat.getMsgs()
    except:
        print("read message error: " + str(e))
        sys.exit()

    # Create a random message.
    letters = string.ascii_letters
    random_string = ''.join(random.choice(letters) for i in range(10))

    # Send message.
    try:
        msg = chat.sendMsg(random_string)
    except:
        print("send message error: " + str(e))
        sys.exit()
class SkypeManager(Skype):
    def __init__(self, user, pwd):
        self.elements = {}
        self.usr = user
        self.password = pwd
        super().__init__(self)

    def connect(self):
        self.conn.soapLogin(self.usr, self.password)

    def remove_all_groups(self):
        print("Showing all chats to be deleted...", end="\n\n")
        self.getChats()
        sure = input("Are you sure to remove all chats? y/n")
        sure = True if sure == "y" else False
        if sure:
            self.remove_groups()
        print("\nFinished.")

    def getChats(self):

        self.skc = SkypeChats(self)
        chts = self.skc.recent()
        while chts:
            for el in chts:
                if el.startswith("19"):
                    self.elements[el] = chts.get(el).topic
                    print(chts.get(el).topic, "->", el)

            chts = self.skc.recent()

    def remove_groups(self):
        for k, v in self.elements.items():
            try:
                print("Leaving", v, "with key:", k, "...", end="")
                self.skc.chat(k).leave()
                print("Left Success!")
                print("Deleting", v, "with key:", k, "...", end="")
                self.skc.chat(k).delete()
                print("Deletion Success!")
            except SkypeApiException as sae:
                print("Failed! :(")
                print("\tCaused by:", sae)
Example #5
0
from skpy import Skype,SkypeChats
import sqlite3
import os.path
import time
from datetime import timedelta,datetime,date

from google.oauth2 import service_account
import json
import dialogflow_v2 as dialogflow

sk=Skype("___skype id____","skype password___")

a=SkypeChats(sk)
m=a.chat('19:[email protected]')

memb=m.userIds

def dict_user(msg):                 #converting into dictonary of members
  lib=[]
  ll=[]
  info=[]

  for i in msg:
      lib.append(str(i))

  dict={}
  for k in range(0,len(lib)):
      x=lib[k].split('\n')[1::]
      for i in x:
          ll.append(i.split(': '))
          for j in range(0,len(ll)):
Example #6
0
from skpy import Skype, SkypeChats

sk = Skype("*****@*****.**", "leepallox123")
skc = SkypeChats(sk)
print(skc.recent())
Example #7
0
from skpy import Skype, SkypeChats

# Run this to get recent messages, consequently conversation ids
sk = Skype("nishizuka23", "curioso")
skc = SkypeChats(sk)
skc.recent()