溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

Python如何實現(xiàn)微信表情包炸群功能

發(fā)布時間:2021-02-10 18:53:39 來源:億速云 閱讀:505 作者:小新 欄目:開發(fā)技術

小編給大家分享一下Python如何實現(xiàn)微信表情包炸群功能,相信大部分人都還不怎么了解,因此分享這篇文章給大家參考一下,希望大家閱讀完這篇文章后大有收獲,下面讓我們一起去了解一下吧!

Python實現(xiàn)微信表情包炸群效果,具體代碼如下所示;

# -*- coding = utf-8 -*-
# @Time : 2021/1/26 15:19
# @Author : 陳良興
# @File : 微信表情包炸群.py
# @Software : PyCharm

# 運行程序 > 輸入次數(shù) > 回車 > 打開微信對話框 > 將鼠標放置在“發(fā)送”按鈕處即可

from pynput.keyboard import Controller as KB        #控制鍵盤輸入
from pynput.mouse import Controller,Button         #控制鼠標點擊
import time
import random

Wechat_expression = [
  "[微笑]","[撇嘴]","[色]","[發(fā)呆]","[得意]","[流淚]","[害羞]","[閉嘴]","[睡]","[大哭]","[尷尬]",
  "[發(fā)怒]","[調(diào)皮]","[呲牙]","[驚訝]","[難過]","[囧]","[抓狂]","[吐]","[偷笑]","[愉快]","[白眼]",
  "[傲慢]","[困]","[驚恐]","[憨笑]","[悠閑]","[咒罵]","[疑問]","[噓]","[暈]","[衰]","[骷髏]","[豬頭]",
  "[敲打]","[再見]","[擦汗]","[摳鼻]","[鼓掌]","[壞笑]","[右哼哼]","[鄙視]","[委屈]","[快哭了]",
  "[陰險]","[親親]","[可憐]","[笑臉]","[生病]","[臉紅]","[破涕為笑]","[恐懼]","[失望]","[無語]",
  "[嘿哈]","[捂臉]","[奸笑]","[機智]","[皺眉]","[耶]","[吃瓜]","[加油]","[汗]","[天啊]","[Emm]",
  "[社會社會]","[旺柴]","[好的]","[打臉]","[哇]","[翻白眼]","[666]","[讓我看看]","[嘆氣]","[苦澀]",
  "[裂開]","[嘴唇]","[愛心]","[心碎]","[擁抱]","[強]","[弱]","[握手]","[勝利]","[抱拳]","[勾引]",
  "[拳頭]","[OK]","[合十]","[啤酒]","[咖啡]","[蛋糕]","[玫瑰]","[凋謝]","[菜刀]","[便便]","[月亮]",
  "[太陽]","[禮物]","[紅包]","[發(fā)]","[福]","[跳跳]","[發(fā)抖]","[轉(zhuǎn)圈]","[炸彈]","[慶祝]","[煙花]"
]

#鍵盤控制函數(shù)
def keyboardInput(string):
  keyboard = KB()
  keyboard.type(string)

#鼠標控制函數(shù)
def mouseClick():
  mouse = Controller()
  mouse.press(Button.left)
  mouse.release(Button.left)

#響應函數(shù)
def response(number):
  time.sleep(5)             #延遲5s響應
  for i in range(number):
    sentence = random.choice(Wechat_expression)
    keyboardInput(sentence)
    mouseClick()
    time.sleep(0.4)           #每條消息間隔0.4秒


if __name__ == "__main__":
  while True:
  	print("\033[1;32m發(fā)動機已啟動,隨時可以出發(fā)!\033[0m")
    Num = input("\033[1;32m請輸入轟炸次數(shù):\033[0m")
    if Num.isdigit():
      response(int(Num))
      print("\033[1;33m報告長官,轟炸完畢,請求下一步作戰(zhàn)計劃?。?!\033[0m")
    else:
      print("\033[1;31m輸入錯誤,請重新輸入一個整數(shù)?。。033[0m")

    #詢問是否繼續(xù)
    answer = input("\033[1;34m是否執(zhí)行下一次作戰(zhàn)計劃?(y 或者 n):\033[0m")
    if answer == "y":
      print("\033[1;33m繼續(xù)轟炸!?。033[0m")
      continue
    if answer == "n":
      print("\033[1;33m停止轟炸,給他們喘口氣!??!\033[0m")
      break
    else:
      print("\033[1;31m輸入錯誤,請輸入“y”或者“n”!!!\033[0m")

操作如下:

首先,運行代碼,輸入次數(shù)。

Python如何實現(xiàn)微信表情包炸群功能

然后,打開微信對話框,將鼠標放置在“發(fā)送”按鈕處,即可實現(xiàn)自動隨機發(fā)送表情包。

Python如何實現(xiàn)微信表情包炸群功能

最后,根據(jù)自己的選擇是否繼續(xù)執(zhí)行操作。

Python如何實現(xiàn)微信表情包炸群功能

以上是“Python如何實現(xiàn)微信表情包炸群功能”這篇文章的所有內(nèi)容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內(nèi)容對大家有所幫助,如果還想學習更多知識,歡迎關注億速云行業(yè)資訊頻道!

向AI問一下細節(jié)

免責聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權內(nèi)容。

AI