Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

33
LINES

< > BotCompany Repo | #1002674 // Test PircBot with responding to messages

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Uses 75K of libraries. Click here for Pure Java version (57L/1K/2K).

1  
!752
2  
!1002672 // pircbot library
3  
4  
import org.jibble.pircbot.*;
5  
6  
p {
7  
  new MyBot bot;
8  
  bot.setVerbose(true);
9  
  bot.connect("irc.freenode.net");
10  
  bot.joinChannel("#pircbot");
11  
}
12  
13  
static class MyBot extends PircBot {
14  
  MyBot() {
15  
    setName("a12345");
16  
    setAutoNickChange(true);
17  
  }
18  
  
19  
  public void onMessage(String channel, String sender,
20  
                        String login, String hostname, String message) {
21  
    if (message.equalsIgnoreCase("time")) {
22  
      String time = new java.util.Date().toString();
23  
      sendMessage(channel, sender + ": The time is now " + time);
24  
    }
25  
  }
26  
  
27  
  public void onPrivateMessage(String sender,
28  
                               String login,
29  
                               String hostname,
30  
                               String message) {
31  
    sendMessage(sender, "Howdy stranga");
32  
  }
33  
}

Author comment

Began life as a copy of #1002673

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1002674
Snippet name: Test PircBot with responding to messages
Eternal ID of this version: #1002674/1
Text MD5: 6a1ce72d66e0584f1bb4740902df3bed
Transpilation MD5: 1053fb0c8d563ac12b37b2df85c7a9de
Author: stefan
Category: javax
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-02-12 16:53:31
Source code size: 857 bytes / 33 lines
Pitched / IR pitched: No / No
Views / Downloads: 614 / 615
Referenced in: [show references]