About the hard process of using java to make a WeChat robot

Be sure to watch until the end, otherwise the consequences will be serious~

1. Technology stack

1. Cute cat framework, official website cute cat forum
2. Simpler-robot framework, official website WeChat-cute cat-httpapi
3, springboot

2. Cute cat environment construction

2.1 The current implementation of WeChat robots:

  1. Program injection
  2. Crack the WeChat protocol

The cute cat is the former. You need to install and download a specific version of WeChat locally, because the base address of each version and the address of some functions are not necessarily the same, and the memory structure may also be different, so the specific version of the cute cat is only valid for a specific version of WeChat.
Cute Cat is a WeChat auxiliary tool jointly developed and debugged by Sister Tou and other easy language lovers (thanks to them).easy languageDevelopment, so most of the time it will be reported as poison (easy language: blame me~), if you believe it, add it to the trust file and use it. If you don't believe it, please use other methods to build a WeChat robot.

2.2 Install WeChat and WeChat settings (recommended)

If you have not installed it, double-click to install it, remember to select the directory, otherwise it will automatically put the C drive. If you have installed it locally, double-click to install it, and then you will be prompted whether to roll back to the old version, click OK, and wait for the installation to complete.

WeChat settings: cancel version automatic update

Operation steps: Click Settings -> General Settings, cancel the automatic upgrade of WeChat when there is an update.

insert image description here

2.3 Install Cute Cat

Download and unzip, if the system prompts that the folder contains a virus and has been automatically deleted, please set the directory where you unzipped the cute fur as a whitelist in win's security high school. As mentioned above, the cute cat realizes the function of a robot through easy language injection. Originally Program injection will be reported to be poisoned by some software, not to mention easy language (shivering and cold)
precautions:
○ Version inconsistency: If the prompt version is inconsistent, the download link will be opened. The official link of the cute cat has been suspended, please use the above Download from the link or find resources by yourself, WeChat version 2.6.8.52
○ System virus report: Please manually restore the deleted files and quarantined files of the cute cat, and add the cute cat folder to the whitelist
○ Internal error: general restart or reinstall It can be solved. If it still can't, please try another computer. Some servers or very old systems need to install patches before they can be used normally.
After it is opened correctly, the following folder will appear, open the cute cat file, if it pops up and needs to surf the Internet, click Allow access
insert image description here

2.4 The basic page is as follows

insert image description here
insert image description here
insert image description here

3. Configure the springboot environment

3.1 Introducing dependencies

 <properties>
        <java.version>1.8</java.version>
        <simbot.version>2.3.0</simbot.version>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>love.forte.simple-robot</groupId>
                <artifactId>parent</artifactId>
                <version>${simbot.version}</version>
                <scope>import</scope>
                <type>pom</type>
            </dependency>
        </dependencies>
    </dependencyManagement>
 <!-- 可爱猫组件依赖。如果使用版本控制,则不需要填写version。 -->
        <dependency>
            <groupId>love.forte.simple-robot</groupId>
            <artifactId>component-lovelycat-httpapi</artifactId>
        </dependency>
        <dependency>
            <groupId>love.forte.simple-robot</groupId>
            <artifactId>core-spring-boot-starter</artifactId>
        </dependency>
        <dependency>
            <groupId>love.forte.simple-robot</groupId>
            <artifactId>api</artifactId>
        </dependency>

3.2 Write a startup class

/**
 * @author yinfeng
 * @description 启动类
 * @since 2021/12/22 22:50
 */
@EnableSimbot
@EnableScheduling
@SpringBootApplication
@Slf4j
public class WxRobotApplication {
    
    

    public static void main(String[] args) {
    
    
        SpringApplication.run(WxRobotApplication.class, args);
        log.info("微信机器人启动成功~~~~");
    }

}

3.3 Set up message monitoring

/**
 * @author yinfeng
 * @description 机器人监听
 * @since 2021/11/6 20:51
 */
@Component
@Slf4j
public class MessageListener {
    
    

    /**
     * 监听私聊消息
     */
    @OnPrivate
    public void privateMsg(PrivateMsg privateMsg, MsgSender sender) {
    
    
        sender.SENDER.sendPrivateMsg(privateMsg,"444");
    }


    /**
     * 监听群消息
     */
    @OnGroup
    public ReplyAble groupMsg(GroupMsg groupMsg, MsgSender sender) {
    
    
        // 默认关闭群聊模式,需要的话把注释去掉
        return null;
    }
}

4. Painful lessons

When I was about to finish, WeChat suddenly gave mehint

insert image description here
insert image description here

this. . . In my heart, it seems like 10 million grass and mud horses are running wild ! ! !
insert image description here

This is too uncomfortable! ! !
I just registered the number! ! !
At this point, the wechat robot making tutorial declares failure! ! !

5. Summary

Due to the risk of being banned, the code will not be open-sourced, just for your
reference

おすすめ

転載: blog.csdn.net/a1774381324/article/details/122461852