diff --git a/classes/chat.py b/classes/chat.py index 6e0c1799..11716144 100644 --- a/classes/chat.py +++ b/classes/chat.py @@ -1,5 +1,6 @@ class Chat(): def __init__(self): - pass - pass \ No newline at end of file + self._users = [] # users in this chatroom + def add_user(self, user): + self._users += user \ No newline at end of file diff --git a/classes/shell.py b/classes/shell.py index cd68b1df..c3fb3c7e 100644 --- a/classes/shell.py +++ b/classes/shell.py @@ -1,6 +1,6 @@ import os, cmd -class telepyShell(cmd.Cmd): +class TelepyShell(cmd.Cmd): intro='Welcome to telepy interactive shell. Type help or ? for help.\n' prompt='>' diff --git a/classes/user.py b/classes/user.py index 50c5ad24..16927a3a 100644 --- a/classes/user.py +++ b/classes/user.py @@ -1,5 +1,11 @@ class User(): + me = None + ''' current connected user ''' + + friends = [] + ''' current connected user's friends ''' + def __init__(self, uid): self.uid = uid diff --git a/telepy.py b/telepy.py index 4871037c..5d04f1cc 100644 --- a/telepy.py +++ b/telepy.py @@ -1,7 +1,7 @@ #CLI like interface import argparse, getopt, os, io, struct, mtproto -from classes.shell import telepyShell +from classes.shell import TelepyShell if __name__ == '__main__': parser = argparse.ArgumentParser('telepy',description='Python implementation of telegram API.') @@ -14,4 +14,4 @@ if __name__ == '__main__': args = parser.parse_args() if args.command is None: - telepyShell().cmdloop() \ No newline at end of file + TelepyShell().cmdloop() \ No newline at end of file diff --git a/testing.py b/testing.py index 125d1dd6..f904c64a 100644 --- a/testing.py +++ b/testing.py @@ -1,25 +1,8 @@ # -*- coding: utf-8 -*- -import os -import io -import struct -# Deal with py2 and py3 differences -try: # this only works in py2.7 - import configparser -except ImportError: - import ConfigParser as configparser -import mtproto +from classes.telepy import Telepy +telepy = Telepy() - -config = configparser.ConfigParser() -# Check if credentials is correctly loaded (when it doesn't read anything it returns []) -if not config.read('credentials'): - print("File 'credentials' seems to not exist.") - exit(-1) -ip = config.get('App data', 'ip_address') -port = config.getint('App data', 'port') - -Session = mtproto.Session(ip, port) -Session.create_auth_key() - -future_salts = Session.method_call('get_future_salts', num=3) \ No newline at end of file +# telepy._config #it's 'private' but can be accessed. Python's intelligent-programmer way. lol. Besides, we're in testing.py! +# telepy._session +# telepy._salt