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 相关文章推荐
安装ElasticSearch搜索工具并配置Python驱动的方法
Dec 22 Python
python实现决策树分类算法
Dec 21 Python
在Pandas中DataFrame数据合并,连接(concat,merge,join)的实例
Jan 29 Python
使用pyhon绘图比较两个手机屏幕大小(实例代码)
Jan 03 Python
python实现高斯投影正反算方式
Jan 17 Python
tensorflow 报错unitialized value的解决方法
Feb 06 Python
python GUI库图形界面开发之PyQt5单选按钮控件QRadioButton详细使用方法与实例
Feb 28 Python
python正则表达式 匹配反斜杠的操作方法
Aug 07 Python
Python3 ffmpeg视频转换工具使用方法解析
Aug 10 Python
python自动打开浏览器下载zip并提取内容写入excel
Jan 04 Python
python中操作文件的模块的方法总结
Feb 04 Python
手残删除python之后的补救方法
Jun 26 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简单系统查询模块代码打包下载
2008/06/07 PHP
php数组转成json格式的方法
2015/03/09 PHP
PHP后台实现微信小程序登录
2018/08/03 PHP
学习YUI.Ext第五日--做拖放Darg&Drop
2007/03/10 Javascript
jquery1.4.2 for Visual studio 2010 模板文件
2010/07/14 Javascript
js面向对象 多种创建对象方法小结
2012/05/21 Javascript
js调用后台servlet方法实例
2013/06/09 Javascript
js读取被点击次数的简单实例(从数据库中读取)
2014/03/07 Javascript
JavaScript也谈内存优化
2014/06/06 Javascript
在HTML代码中使用JavaScript代码的例子
2014/10/16 Javascript
JQuery实现可直接编辑的表格
2015/04/16 Javascript
使用AOP改善javascript代码
2015/05/01 Javascript
jQuery取得iframe中元素的常用方法详解
2016/01/14 Javascript
详谈JS中实现种子随机数及作用
2016/07/19 Javascript
利用jQuery对无序列表排序的简单方法
2016/10/16 Javascript
Vue.js 递归组件实现树形菜单(实例分享)
2016/12/21 Javascript
Ionic2开发环境搭建教程
2020/08/20 Javascript
javaScript手机号码校验工具类PhoneUtils详解
2017/12/08 Javascript
NVM安装nodejs的方法实用步骤
2019/01/16 NodeJs
JS中实现一个下载进度条及播放进度条的代码
2019/06/10 Javascript
JavaScript 预解析的4种实现方法解析
2019/09/03 Javascript
Vue优化:常见会导致内存泄漏问题及优化详解
2020/08/04 Javascript
python中os操作文件及文件路径实例汇总
2015/01/15 Python
python实现斐波那契数列的方法示例
2017/01/12 Python
Python 基础教程之包和类的用法
2017/02/23 Python
python 微信好友特征数据分析及可视化
2020/01/07 Python
python里的单引号和双引号的有什么作用
2020/06/17 Python
Java byte数组操纵方式代码实例解析
2020/07/22 Python
解决pycharm 格式报错tabs和space不一致问题
2021/02/26 Python
Set里的元素是不能重复的,那么用什么方法来区分重复与否呢?
2016/08/18 面试题
运动会广播稿150字
2014/02/19 职场文书
新年团拜会主持词
2014/04/02 职场文书
护理专业毕业生自荐书
2014/05/24 职场文书
机关党员公开承诺书
2014/08/30 职场文书
商业计划书范文
2019/04/24 职场文书
python数据可视化JupyterLab实用扩展程序Mito
2021/11/20 Python