Python实现微信表情包炸群,最后被群主踢了

共 5560字,需浏览 12分钟

 ·

2021-05-21 17:27


作者:Leuanghinghttps://blog.csdn.net/weixin_46153372/article/details/113183632

代码实现

# -*- 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的问题  | 零基础学了8个月的Python  | 实战项目 |学Python就是这条捷径


干货:爬取豆瓣短评,电影《后来的我们》 | 38年NBA最佳球员分析 |   从万众期待到口碑扑街!唐探3令人失望  | 笑看新倚天屠龙记 | 灯谜答题王 |用Python做个海量小姐姐素描图 |碟中谍这么火,我用机器学习做个迷你推荐系统电影


趣味:弹球游戏  | 九宫格  | 漂亮的花 | 两百行Python《天天酷跑》游戏!


AI: 会做诗的机器人 | 给图片上色 | 预测收入 | 碟中谍这么火,我用机器学习做个迷你推荐系统电影


小工具: Pdf转Word,轻松搞定表格和水印! | 一键把html网页保存为pdf!|  再见PDF提取收费! | 用90行代码打造最强PDF转换器,word、PPT、excel、markdown、html一键转换 | 制作一款钉钉低价机票提示器! |60行代码做了一个语音壁纸切换器天天看小姐姐!


年度爆款文案


点阅读原文,领廖雪峰视频资料!

浏览 11
点赞
评论
收藏
分享

手机扫一扫分享

分享
举报
评论
图片
表情
推荐
点赞
评论
收藏
分享

手机扫一扫分享

分享
举报