Auto Responder

AdvancedInteractive

Automatically responds to private messages with a custom message. Shows private message event handling.

15 min read

What It Does

Automatically responds to private messages with a custom message. Shows private message event handling.

Source Code

java
1package com.example;
2
3import net.runelite.api.Client;
4import net.runelite.api.events.PrivateMessageReceived;
5import net.runelite.client.eventbus.Subscribe;
6import net.runelite.client.plugins.Plugin;
7import net.runelite.client.plugins.PluginDescriptor;
8import javax.inject.Inject;
9
10@PluginDescriptor(
11    name = "Auto Responder",
12    description = "Auto responds to PMs"
13)
14public class AutoResponderPlugin extends Plugin {
15    @Inject
16    private Client client;
17
18    private final String responseMessage = "I'm currently AFK, will respond later!";
19
20    @Subscribe
21    public void onPrivateMessageReceived(PrivateMessageReceived event) {
22        String sender = event.getName();
23        // Send response (implementation depends on RuneLite version)
24        System.out.println("Received PM from: " + sender);
25    }
26}

Code Annotations

Line 18

Response message to send

Line 21

Listen for private messages

Line 23

Get sender name

API Classes Used

Client
PrivateMessage

Key Concepts

  • Response message to send
  • Listen for private messages
  • Get sender name

Next Steps

  • Learn about PrivateMessage events
  • Implement message sending
  • Add configurable response