@c4syner/

TextFlow

Python

Social Messaging Platform

fork
loading
Files
  • main.py
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
import json_store_client
import getpass


jsonStoreToken = "268319420c53a61fb727e74ddb9124347772472ae449c25fd3ccacac6756ff9d" # Insert your token here.
client = json_store_client.Client(jsonStoreToken)

# Save data to the "foo" key.
#client.store("foo", {"alfa": "bravo", "charlie": "delta"})

# Get the data from the "foo" key.
#data = client.retrieve("foo")

#print(data["alfa"]) # => "bravo"

# Deletes the data after printing parts of it.
#client.delete("foo");

def pauseCont():
    input("\n\n\n\nPress Enter to continue...")
    print(chr(27) + "[2J")

def cls():
    print(chr(27) + "[2J")    

def createAccount():
    jsonStoreToken = "268319420c53a61fb727e74ddb9124347772472ae449c25fd3ccacac6756ff9d" # Insert your token here.
    client = json_store_client.Client(jsonStoreToken)

    while(True):
        user = input("Create a Username: ")
        data = client.retrieve(user)
        if(data == None):
            cls()
            break
        else:
            print("Username Taken...")
            pauseCont()
    print("Username Available!")

    print("Create a Password: ", end='')
    password = getpass.getpass()
    client.store(user, {user: password})


def messageRoom(user): 

    jsonStoreToken = "268319420c53a61fb727e74ddb9124347772472ae449c25fd3ccacac6756ff9d" # Insert your token here.
    client = json_store_client.Client(jsonStoreToken)

    cls()

    print("Welcome to the Global Message Board!")
    while(True):
        pass #for now

def login():
    jsonStoreToken = "268319420c53a61fb727e74ddb9124347772472ae449c25fd3ccacac6756ff9d" # Insert your token here.
    client = json_store_client.Client(jsonStoreToken)
    print("Do you currently have an account? (y/n)")
    resp = input()
    cls()
    if(resp == "y"):
        user = str(input("Username: "))
        password = str(input("Password: "))
        cls()
        actPass = client.retrieve(user)
        if(actPass == None):
            print("Invalid User Information")
            print("Program Terminated... Rerun and login with valid credentials")
            SystemExit
        else:
            actPass = actPass[user]
            messageRoom(user)
    else:
        createAccount()


print("""
        ,----,                                                                         
      ,/   .`|                                                                         
    ,`   .'  :                       ___        ,---,.  ,--,                           
  ;    ;     /                     ,--.'|_    ,'  .' |,--.'|                           
.'___,/    ,'                      |  | :,' ,---.'   ||  | :     ,---.           .---. 
|    :     |           ,--,  ,--,  :  : ' : |   |   .':  : '    '   ,'\         /. ./| 
;    |.';  ;   ,---.   |'. \/ .`|.;__,'  /  :   :  :  |  ' |   /   /   |     .-'-. ' | 
`----'  |  |  /     \  '  \/  / ;|  |   |   :   |  |-,'  | |  .   ; ,. :    /___/ \: | 
    '   :  ; /    /  |  \  \.' / :__,'| :   |   :  ;/||  | :  '   | |: : .-'.. '   ' . 
    |   |  '.    ' / |   \  ;  ;   '  : |__ |   |   .''  : |__'   | .; :/___/ \:     ' 
    '   :  |'   ;   /|  / \  \  \  |  | '.'|'   :  '  |  | '.'|   :    |.   \  ' .\    
    ;   |.' '   |  / |./__;   ;  \ ;  :    ;|   |  |  ;  :    ;\   \  /  \   \   ' \ | 
    '---'   |   :    ||   :/\  \ ; |  ,   / |   :  \  |  ,   /  `----'    \   \  |--"  
             \   \  / `---'  `--`   ---`-'  |   | ,'   ---`-'              \   \ |     
              `----'                        `----'                          '---"      
                                                                                       
""")

print("\t\t\nA simple text only social media platform!")
pauseCont()
login()