@@ -119,10 +119,25 @@ def Group_Exists(x):
119
119
return 1
120
120
return 0
121
121
if Group_Exists (x ):
122
- #Going To Private Chat Group
123
- import PublicChats
124
- PublicChats .main (username , x )
125
- KahesiModeOnn (username )
122
+ #check Weather User Is member Or Not
123
+ def mem_or_not (username ):
124
+ for iterate in pug_details .find ():
125
+ if iterate ["GName" ] == x :
126
+ for i in iterate ["Members" ]["username" ]:
127
+ if i ['username' ] == username :
128
+ return 1
129
+ return 0
130
+ return 0
131
+ if mem_or_not (username ):
132
+ #Going To Public Chat Group
133
+ import PublicChats
134
+ PublicChats .main (username , x )
135
+ KahesiModeOnn (username )
136
+ else :
137
+ print ("=============================================" )
138
+ print ("Sorry User You Need to Join This Group First" )
139
+ print ("=============================================" )
140
+ PuGrp (username )
126
141
else :
127
142
#Redirecting Back to PuGrp function
128
143
print ("Sorry No Such Group Exists! But You Can Always Create One" )
@@ -166,7 +181,7 @@ def KahesiModeOnn(username):
166
181
print ("Enter 1 to gain access to Global Chat" )
167
182
print ("Enter 2 to gain access to LOGOUT" )
168
183
print ("Enter 3 to go to your Public Chat Groups" )
169
- print ("Enter 4 to go to your Public Chat Groups" )
184
+ print ("Enter 4 to go to your Private Chat Groups" )
170
185
print ("Enter 5 to create New Public Group" )
171
186
print ("Enter 6 to create New Private Group" )
172
187
x = int (input ())
@@ -250,7 +265,10 @@ def NPuGrp(username):
250
265
"username" : [username ]
251
266
},
252
267
"Members" : {
253
- "username" : [username ]
268
+ "username" : [{
269
+ "username" : username ,
270
+ }
271
+ ]
254
272
},
255
273
"Chats" : [
256
274
{
0 commit comments