Python实现微信表情包炸群功能


Posted in Python onJanuary 28, 2021

Python实现微信表情包炸群效果,具体代码如下所示;

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

# 运行程序 > 输入次数 > 回车 > 打开微信对话框 > 将鼠标放置在“发送”按钮处即可

from pynput.keyboard import Controller as KB        #控制键盘输入
from pynput.mouse import Controller,Button         #控制鼠标点击
import time
import random

Wechat_expression = [
  "[微笑]","[撇嘴]","[色]","[发呆]","[得意]","[流泪]","[害羞]","[闭嘴]","[睡]","[大哭]","[尴尬]",
  "[发怒]","[调皮]","[呲牙]","[惊讶]","[难过]","[??","[抓狂]","[吐]","[偷笑]","[愉快]","[白眼]",
  "[傲慢]","[困]","[惊恐]","[憨笑]","[悠闲]","[咒骂]","[疑问]","[嘘]","[晕]","[衰]","[骷髅]","[猪头]",
  "[敲打]","[再见]","[擦汗]","[抠鼻]","[鼓掌]","[坏笑]","[右哼哼]","[鄙视]","[委屈]","[快哭了]",
  "[阴险]","[亲亲]","[可怜]","[笑脸]","[生病]","[脸红]","[破涕为笑]","[恐惧]","[失望]","[无语]",
  "[嘿哈]","[捂脸]","[奸笑]","[机智]","[皱眉]","[耶]","[吃瓜]","[加油]","[汗]","[天啊]","[Emm]",
  "[社会社会]","[旺柴]","[好的]","[打脸]","[哇]","[翻白眼]","[666]","[让我看看]","[叹气]","[苦涩]",
  "[裂开]","[嘴唇]","[爱心]","[心碎]","[拥抱]","[强]","[弱]","[握手]","[胜利]","[抱拳]","[勾引]",
  "[拳头]","[OK]","[合十]","[啤酒]","[咖啡]","[蛋糕]","[玫瑰]","[凋谢]","[菜刀]","[便便]","[月亮]",
  "[太阳]","[礼物]","[红包]","[?]","[福]","[跳跳]","[发抖]","[转圈]","[炸弹]","[庆祝]","[烟花]"
]

#键盘控制函数
def keyboardInput(string):
  keyboard = KB()
  keyboard.type(string)

#鼠标控制函数
def mouseClick():
  mouse = Controller()
  mouse.press(Button.left)
  mouse.release(Button.left)

#响应函数
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发动机已启动,随时可以出发!\033[0m")
    Num = input("\033[1;32m请输入轰炸次数:\033[0m")
    if Num.isdigit():
      response(int(Num))
      print("\033[1;33m报告长官,轰炸完毕,请求下一步作战计划!!!\033[0m")
    else:
      print("\033[1;31m输入错误,请重新输入一个整数!!!\033[0m")

    #询问是否继续
    answer = input("\033[1;34m是否执行下一次作战计划?(y 或者 n):\033[0m")
    if answer == "y":
      print("\033[1;33m继续轰炸!!!\033[0m")
      continue
    if answer == "n":
      print("\033[1;33m停止轰炸,给他们喘口气!!!\033[0m")
      break
    else:
      print("\033[1;31m输入错误,请输入“y”或者“n”!!!\033[0m")

操作如下:

首先,运行代码,输入次数。

Python实现微信表情包炸群功能

然后,打开微信对话框,将鼠标放置在“发送”按钮处,即可实现自动随机发送表情包。

Python实现微信表情包炸群功能

最后,根据自己的选择是否继续执行操作。

Python实现微信表情包炸群功能

到此这篇关于Python实现微信表情包炸群功能的文章就介绍到这了,更多相关Python微信表情包炸群内容请搜索三水点靠木以前的文章或继续浏览下面的相关文章希望大家以后多多支持三水点靠木!

Python 相关文章推荐
浅析python 中__name__ = '__main__' 的作用
Jul 05 Python
python采集百度百科的方法
Jun 05 Python
python 写入csv乱码问题解决方法
Oct 23 Python
Python实现PS图像调整之对比度调整功能示例
Jan 26 Python
解决pycharm无法识别本地site-packages的问题
Oct 13 Python
关于python pycharm中输出的内容不全的解决办法
Jan 10 Python
python编程进阶之类和对象用法实例分析
Feb 21 Python
jupyter修改文件名方式(TensorFlow)
Apr 21 Python
Python ini文件常用操作方法解析
Apr 26 Python
Django后端分离 使用element-ui文件上传方式
Jul 12 Python
Matplotlib 折线图plot()所有用法详解
Jul 28 Python
安装pytorch时报sslerror错误的解决方案
May 17 Python
Python基于opencv的简单图像轮廓形状识别(全网最简单最少代码)
Jan 28 #Python
python如何构建mock接口服务
Jan 28 #Python
pytest fixtures装饰器的使用和如何控制用例的执行顺序
Jan 28 #Python
如何用tempfile库创建python进程中的临时文件
Jan 28 #Python
python基于Kivy写一个图形桌面时钟程序
Jan 28 #Python
python+opencv3.4.0 实现HOG+SVM行人检测的示例代码
Jan 28 #Python
详解Python调用系统命令的六种方法
Jan 28 #Python
You might like
PHP MVC模式在网站架构中的实现分析
2010/03/04 PHP
php版小黄鸡simsimi聊天机器人接口分享
2014/01/26 PHP
ThinkPHP跳转页success及error模板实例教程
2014/07/17 PHP
PHP开启opcache提升代码性能
2015/04/26 PHP
php+mysql实现的二级联动菜单效果详解
2016/05/10 PHP
Laravel5.1 框架表单验证操作实例详解
2020/01/07 PHP
javaScript 简单验证代码(用户名,密码,邮箱)
2009/09/28 Javascript
文本框获得焦点和失去焦点的判断代码
2012/03/18 Javascript
JS实现点击颜色块切换指定区域背景颜色的方法
2015/02/25 Javascript
Bootstrap CSS布局之图像
2016/12/17 Javascript
JS+Ajax实现百度智能搜索框
2017/08/04 Javascript
jQuery实现下拉菜单动态添加数据点击滑出收起其他功能
2018/06/14 jQuery
Vue源码解读之Component组件注册的实现
2018/08/24 Javascript
Cookbook组件形式:优化 Vue 组件的运行时性能
2018/11/25 Javascript
[57:37]EG vs Mineski 2018国际邀请赛小组赛BO2 第二场 8.16
2018/08/17 DOTA
centos下更新Python版本的步骤
2013/02/12 Python
10款最好的Web开发的 Python 框架
2015/03/18 Python
Python实现读取邮箱中的邮件功能示例【含文本及附件】
2017/08/05 Python
Python通过调用mysql存储过程实现更新数据功能示例
2018/04/03 Python
Python代码太长换行的实现
2019/07/05 Python
python basemap 画出经纬度并标定的实例
2019/07/09 Python
python实现读取excel文件中所有sheet操作示例
2019/08/09 Python
python3 深浅copy对比详解
2019/08/12 Python
python 数据分析实现长宽格式的转换
2020/05/18 Python
详解python方法之绑定方法与非绑定方法
2020/08/17 Python
Python利用matplotlib绘制散点图的新手教程
2020/11/05 Python
详解HTML5中的元素与元素
2015/08/17 HTML / CSS
通息工程毕业生自荐信
2013/10/16 职场文书
党员自我评价分享
2013/12/13 职场文书
法律顾问服务方案
2014/05/15 职场文书
2014机关干部学习“焦裕禄精神”思想汇报
2014/09/19 职场文书
村主任个人对照检查材料
2014/10/01 职场文书
2015年学校综合治理工作总结
2015/07/20 职场文书
2016年党员承诺书范文
2016/03/24 职场文书
解决Golang中goroutine执行速度的问题
2021/05/02 Golang
教你使用Jenkins集成Harbor自动发布镜像
2022/04/03 Servers