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代码来绘制彭罗斯点阵的教程
Apr 03 Python
Python对文件和目录进行操作的方法(file对象/os/os.path/shutil 模块)
May 08 Python
Python复制Word内容并使用格式设字体与大小实例代码
Jan 22 Python
分分钟入门python语言
Mar 20 Python
基于Python log 的正确打开方式
Apr 28 Python
pandas数据清洗,排序,索引设置,数据选取方法
May 18 Python
python实现决策树ID3算法的示例代码
May 30 Python
Python数据结构与算法(几种排序)小结
Jun 22 Python
python绘制多个子图的实例
Jul 07 Python
python3 批量获取对应端口服务的实例
Jul 25 Python
python使用python-pptx删除ppt某页实例
Feb 14 Python
Python中glob库实现文件名的匹配
Jun 18 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
修改apache配置文件去除thinkphp url中的index.php
2014/01/17 PHP
PHP图片处理之使用imagecopy函数添加图片水印实例
2014/11/19 PHP
php 使用array函数实现分页
2015/02/13 PHP
PHP 验证登陆类分享
2015/03/13 PHP
利用php-cli和任务计划实现刷新token功能的方法
2017/05/03 PHP
使用XHProf查找PHP性能瓶颈的实例
2017/12/13 PHP
PHP实现压缩图片尺寸并转为jpg格式的方法示例
2018/05/10 PHP
Alliance vs Liquid BO3 第一场2.13
2021/03/10 DOTA
类似框架的js代码
2006/11/09 Javascript
JQUERY操作JSON实例代码
2010/02/09 Javascript
jquery实现文本框鼠标右击无效以及不能输入的代码
2010/11/05 Javascript
js隐藏与显示回到顶部按钮及window.onscroll事件应用
2013/01/25 Javascript
Jquery实现弹性滑块滑动选择数值插件
2015/08/08 Javascript
jQuery Ajax页面局部加载方法汇总
2016/06/02 Javascript
使用vue.js实现联动效果的示例代码
2017/01/10 Javascript
Web技术实现移动监测的介绍
2017/09/18 Javascript
js定时器+简单的动画效果实例
2017/11/10 Javascript
puppeteer库入门初探
2019/01/09 Javascript
微信小程序之数据绑定原理解析
2019/08/14 Javascript
浅谈layui分页控件field参数接收对象的问题
2019/09/20 Javascript
Vuex实现购物车小功能
2020/08/17 Javascript
JavaScript大数相加相乘的实现方法实例
2020/10/18 Javascript
简单解决Python文件中文编码问题
2015/11/22 Python
Python对象属性自动更新操作示例
2018/06/15 Python
解决django 新增加用户信息出现错误的问题
2019/07/28 Python
python爬虫 模拟登录人人网过程解析
2019/07/31 Python
Django中的session用法详解
2020/03/09 Python
解决Keras的自定义lambda层去reshape张量时model保存出错问题
2020/07/01 Python
台湾线上百货零售购物平台:friDay购物
2017/08/18 全球购物
System.Array.CopyTo()和System.Array.Clone()有什么区别
2016/06/20 面试题
机电专业毕业生推荐信
2013/11/10 职场文书
客房主管岗位职责
2013/12/09 职场文书
中医专业职业生涯规划书范文
2014/01/04 职场文书
社会调查研究计划书
2014/05/01 职场文书
2014年安全员工作总结
2014/11/13 职场文书
困难补助申请报告
2015/05/19 职场文书