Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import fbchat
- import time
- from datetime import datetime
- #max 9 linijek
- wiad={
- 0: "1. 2. 3. 4. 5. 6. 7. 8. 9. ",
- 1: "jeden",
- 2: "dwa",
- 3: "czy",
- 4: "idk",
- 5: "idk",
- 6: "idk",
- 7: "idk",
- 8: "idk",
- 9: "idk",
- }
- #username = "" #input("Username: ")
- username = ""
- #password = "" #input("Tera daj haslo ")
- password = ""
- client = fbchat.Client(username, password)
- command = (input("Czy na pewno? (Y/N/tera/petla) ")) #chciany program dla komendy petla
- command.lower()
- if command == "y":
- czas1 = input("yyyy-mm-dd hh:mm:ss: ")
- print(czas1)
- while True:
- czas = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
- print(czas)
- time.sleep(1)
- if czas == czas1:
- for i in range(3): #ile wiadomosci
- name = "Kacper Latecki" # input("Name: ")
- friends = client.searchForUsers(name)
- friend = friends[0]
- # msg = input("Message: ")
- msg = wiad[i]
- sent = client.send(fbchat.models.Message(text=msg), thread_id=friend.uid)
- time.sleep(20)
- else:
- break
- elif command == 'tera':
- for i in range(3):
- name = "Kacper Latecki" # input("Name: ")
- friends = client.searchForUsers(name)
- friend = friends[0]
- msg = wiad[i]
- sent = client.send(fbchat.models.Message(text=msg), thread_id=friend.uid)
- elif command == 'petla':
- czas1 = input("yyyy-mm-dd hh:mm:ss: ")
- print(czas1)
- while True:
- czas = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
- print(czas)
- time.sleep(1)
- if czas == czas1:
- for x in range(2): #ile razy te wiadomosci
- time.sleep(60)
- for i in range(2): #ile wiadomosci
- name = "Kacper Latecki" # input("Name: ")
- friends = client.searchForUsers(name)
- friend = friends[0]
- msg = wiad[i]
- sent = client.send(fbchat.models.Message(text=msg), thread_id=friend.uid)
- time.sleep(30)
- print('koniec')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement