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 代码效率的方法
Jul 03 Python
Python字符串处理之count()方法的使用
May 18 Python
python使用PIL模块实现给图片打水印的方法
May 22 Python
在Python的Django框架中更新数据库数据的方法
Jul 17 Python
Python的爬虫程序编写框架Scrapy入门学习教程
Jul 02 Python
Python之pandas读写文件乱码的解决方法
Apr 20 Python
Python logging模块用法示例
Aug 28 Python
pandas 数据结构之Series的使用方法
Jun 21 Python
python Event事件、进程池与线程池、协程解析
Oct 25 Python
appium+python自动化配置(adk、jdk、node.js)
Nov 17 Python
python周期任务调度工具Schedule使用详解
Nov 23 Python
Pygame游戏开发之太空射击实战敌人精灵篇
Aug 05 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 mongodb扩展时 需要注意的事项
2013/06/18 PHP
支持png透明图片的php生成缩略图类分享
2015/02/08 PHP
php+jquery+html实现点击不刷新加载更多的实例代码
2016/08/12 PHP
浅谈PHP中类和对象的相关函数
2017/04/26 PHP
javascript 面向对象编程  function是方法(函数)
2009/09/17 Javascript
在jquery中处理带有命名空间的XML数据
2011/06/13 Javascript
jquery 提交值不为空的元素示例代码
2013/05/10 Javascript
判断ie的两种简单方法
2013/08/12 Javascript
纯js写的分页表格数据为json串
2014/02/18 Javascript
jquery1.10给新增元素绑定事件的方法
2014/03/06 Javascript
浅析JavaScript访问对象属性和方法及区别
2015/11/16 Javascript
微信小程序 购物车简单实例
2016/10/24 Javascript
Bootstrap模态框(Modal)实现过渡效果
2017/03/17 Javascript
解决vue中对象属性改变视图不更新的问题
2018/02/23 Javascript
微信小程序自定义toast的实现代码
2018/11/16 Javascript
Vue3.0结合bootstrap创建多页面应用
2019/05/28 Javascript
Vue利用Blob下载原生二进制数组文件
2019/09/25 Javascript
Python pickle模块用法实例
2015/04/14 Python
Linux下为不同版本python安装第三方库
2016/08/31 Python
Python使用django搭建web开发环境
2017/06/09 Python
django做form表单的数据验证过程详解
2019/07/26 Python
Python解决pip install时出现的Could not fetch URL问题
2019/08/01 Python
Python中文分词库jieba,pkusegwg性能准确度比较
2020/02/11 Python
用python按照图像灰度值统计并筛选图片的操作(PIL,shutil,os)
2020/06/04 Python
keras绘制acc和loss曲线图实例
2020/06/15 Python
HTML5标签小集
2011/08/02 HTML / CSS
美国球鞋寄卖网站:Stadium Goods
2018/05/09 全球购物
美国室内盆栽植物购买网站:Plants.com
2020/04/24 全球购物
管理学专业个人求职信范文
2013/09/21 职场文书
高中教师考核方案
2014/05/18 职场文书
会计专业自荐书
2014/07/08 职场文书
2015年七一建党节演讲稿
2015/03/19 职场文书
会计求职自荐信
2015/03/26 职场文书
党员承诺书格式范文
2015/04/28 职场文书
python使用pywinauto驱动微信客户端实现公众号爬虫
2021/05/19 Python
MySQL如何使备份得数据保持一致
2022/05/02 MySQL