Example #1
0
def tracker(condition,message):
   if condition=='S':
    _username=message.from_user.username
    _userId=str(message.from_user.id)
    if _userId not in users_id:
            users_id.append(_userId)
            users.append(user(_username,_userId))
    UserLog.salvaUsers('users.dat',users)
Example #2
0
                                       '/help : shows this message\n'



"""
Now we prepare our "global variables" , i decide to initialize update_id as 1 , you can put whatever you want it shuouldn't 
make any difference at runtime.
Remember: Once we make program start he will fetch the first message not received since the last shutdown.

Then we read from users.dat trough our UserLog module the list of users previously stored and we store in a users list
(users_id for only the id, is more practical for checks and other controls)

"""
update_id=1
#La lista degli utenti che vado ad accettare durante la durata di vita del bot
users=UserLog.readUsers('users.dat')
users_id=UserLog.getUsersId(users)

"""
Privacy section: we can decide to store or not to store in this run the data regarding users that will call our Bot.

"""
print(version+'\nVuoi settare il tracking degli utenti?[S/N]')
condition=input()
while condition!='S' and condition!='N':
    condition=input('Hai scritto:'+condition+'\nS/N, altrimenti qua ci impalliamo a vita.')


"""
Here starts the actual program: we put ourselves in a infinite loop that we'll non-stop try to fetch new messages from servers.
"""