Giter VIP home page Giter VIP logo

botplate's Introduction

BotPlate

A Java IRC bot template-ish thing.

IRCBot.java

This contains the core functionality of the IRC bot. The constructor takes as arguments:

  • IRC Server
  • Channel
  • Bot Nickname
  • Port to connect to the server

It contains functions to write messages to a channel/person, as well as to write generic IRC commands.

Most importantly, it contains a collection of MessageHandler objects. The collection of MessageHandlers are initialized to contain a ping handler. On receiving the PING message from the server, this handler responds with a corresponding PONG message so the server does not drop our connection.

There exists an addHander function which allows a user to extend their bot with any MessageHandler object.

When a bot receives a message, it will iterate over all its MessageHandlers and call the handle function on the message.

MessageHandler.java

This is an abstract class with a concrete constructor, which takes the IRCBot it will be handling messages for as an argument, and stores it as an instance variable called bot.

There is exactly one abstract method:

abstract void handle(Message message);

Where Message is an object corresponding to the parts defined in the IRC client protocol, RFC 2812

Create MessageHandlers and add them to instances of IRCBots to augment their functionality.

App.java

An example IRCBot implementation, which contains a MessageHandler that when it hears "hello exampleBot" in the channel, it responds with "Hey!"

botplate's People

Contributors

mgaut72 avatar

Watchers

Sean Stephens avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.