Python微信、QQ自动发消息

# 消息轰炸
# 微信、QQ皆可用
import time
from pynput.keyboard import Controller as key_col
from pynput.mouse import Button,Controller
def keyboard_input(string):
    keyboard = key_col() # 控制键盘
    keyboard.type(string) # 键盘输入string
def mouse_click():
    mouse = Controller() # 控制鼠标
    mouse.press(Button.left) # 按住鼠标左键
    mouse.release(Button.left) # 松开鼠标左键
def main(number,string):
    print('开始消息轰炸')
    time.sleep(5) # 等待5for i in range(number):
        keyboard_input(string + str(i)) # str(i)记录次数
        mouse_click()
        time.sleep(0.3) # 等待0.3print('消息轰炸结束')
if __name__=='__main__':
    main(10,'测试测试') # 自行修改需要输入的内容

未附截图,请自行测试,复制即可用。

未完待续

你可能感兴趣的:(python小脚本,python)