Giter VIP home page Giter VIP logo

ldpl-irc-bot's Introduction

The LDPL IRC Bot Library

Version License Size

The LDPL IRC Bot Library is a super easy to use IRC bot library for LDPL. It lets you write LDPL programs that connect to IRC servers, join channels, send messages and react to received messages in the simplest way possible. This library requires LDPL 4.3 or greater.

๐Ÿงฐ Installation

You can install this library by hand or using LPM.

๐Ÿ“ฆ Installing using LPM

Open a terminal and write lpm install ldpl_irc_bot. Once downloaded, include it in your LDPL project by adding the line:

using package ldpl_irc_bot

before the data and procedure sections of your source file. The library is ready to be used.

โœ‹๐Ÿป Installing by hand

Include the library into your LDPL project by copying the folder ldpl-irc-bot to your project directory and then adding the line:

include "ldpl-irc-bot/ldpl_irc_bot.ldpl"

before the data and procedure sections of your source file. The library is ready to be used.

๐Ÿ“š Documentation

This library adds five new statements to the language:

  • irc set nick <text> sets <text> as the nick of your IRC bot.
  • irc set server <text> on port <text> sets the server and port your bot will connect to.
  • irc add channel <text> adds a channel to the list of channels your bot will join when it connects to the server.
  • irc start bot connects your bot to the IRC server and then joins all the specified channels.
  • irc send <text> to <text> sends <text> to the channel or user named <text>.

This library also requires you to define the following subprocedures:

ircbot.onmessage

This sub is executed when your bot receives a message (both privately or on a channel). msg_text contains the message that was received, msg_from contains the nick of the user who sent the message and msg_channel contains the name of the channel the message was sent to (or the nick of your bot if it was a direct message).

sub ircbot.onmessage
    parameters:
        msg_text is text
        msg_from is text
        msg_channel is text
    procedure:
        # ...
end sub

ircbot.onjoin

This sub is executed when someone joins a channel your bot is in. join_name contains the nick of the user who joined and join_channel contains the name of the channel they joined.

sub ircbot.onjoin
    parameters:
        join_name is text
        join_channel is text
    procedure:
        # ...
end sub

ircbot.onpart

This sub is executed when someone leaves a channel your bot is in. part_name contains the nick of the user who left and part_channel contains the name of the channel they parted from.

sub ircbot.onpart
    parameters:
        part_name is text
        part_channel is text
    procedure:
        # ...
end sub

๐Ÿซ Example

The file example-bot.ldpl contains an example bot written using this library.

๐ŸŽ Contributing

If you add any features to the library that you'd like to share, be sure to ring us with a pull request and we'll add them to the library! Every contribution is welcome!

โš– License

The LDPL IRC Bot Library is heavily based on SirLogsalot by Gokberk Yaltirakli. His code is released under the MIT License and so is this library.

ldpl-irc-bot's People

Contributors

lartu avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

ldpl-irc-bot's Issues

Update library to LDPL 4.0

LDPL 4.0 introduced a lot of changes to the language and this library might be outdated. It should be brought back to date and made simpler to use.

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.