0

I have been working on a snapchat bot to send streaks. since snapchat has no official api I am using pyautogui to click and type things on a android emulator. I want the streaks to display the exact date of the day I send it. the code is

import pyautogui, time
import keyboard
from datetime import date
import datetime
import time
f = open("textlines.txt", 'r')
time.sleep(5)
pyautogui.click(x=934, y=885)
time.sleep(0.5)
pyautogui.click(x=1181, y=89)
time.sleep(0.5)
for word in f:
    pyautogui.typewrite(word)
time.sleep(0.3)
keyboard.write("The date and time is:"(str), date)
pyautogui.click(x=922, y=333)
time.sleep(0.5)
pyautogui.click(x=1165, y=996)
time.sleep(1)
pyautogui.click(x=834, y=148)
time.sleep(0.5)
pyautogui.click(x=860, y=242)
time.sleep(0.5)
pyautogui.click(x=1178, y=986)
time.sleep(1)
pyautogui.click(x=937, y=990)

Textlines is the text that I am using and the clicks is where my mouse is clicking. I keep on getting errors trying to type out the date. any help on how I can do so?

3 Answers3

0
from datetime import datetime
t = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
print(t)
albert
  • 433
  • 8
  • I got the error Traceback (most recent call last): File "C:\Users\gzebe\PycharmProjects\SnapChat\spammer.py", line 8, in t = datetime.now().strftime('%Y-%m-%d %H:%M:%S') AttributeError: module 'datetime' has no attribute 'now' – Gaboni Bones Mar 25 '21 at 18:44
0

According to the Arduino Reference, keyboard.write() only accepts a character (not a string) as a parameter:

Syntax: Keyboard.write(character)

Parameters: character: a char or int to be sent to the computer. Only ASCII characters that are on the keyboard are supported. [...] If sending a numeric type, it sends it as an ASCII character (ex. Keyboard.write(97) will send 'a').

lenka_cizkova
  • 431
  • 1
  • 13
-3

Solution here: How do I convert a datetime to date?

You are calling the date module of the datetime package...

  • 1
    Just because you don't have access to comments doesn't mean you should leave a comment as an "answer" – Jacques Mar 25 '21 at 18:34