irc-bot

Crates.ioirc-bot
lib.rsirc-bot
version0.2.1
sourcesrc
created_at2017-05-05 23:47:04.037579
updated_at2018-06-19 00:11:57.314332
descriptionA library for writing Internet Relay Chat (IRC) bots in Rust
homepagehttps://docs.rs/crate/irc-bot
repositoryhttps://github.com/8573/irc-bot.rs
max_upload_size
id13299
size104,617
(8573)

documentation

https://docs.rs/irc-bot

README

irc-bot.rs Docs.rs Crates.io

A library for writing Internet Relay Chat (IRC) bots in the programming language Rust, additionally providing a pre-configured bot for immediate use.

What documentation there is should be available on Docs.rs.

Quick-start

To use this library without writing one's own bot with it, run the provided program src/bin/egbot.rs:

$ # For most people:
$ cargo run
$ # For NixOS users:
$ make run

The name egbot is derived from "e.g.", which means "for example", and is also a pun on the name of Eggdrop, an old IRC bot.

The bot can be configured by editing the YAML file config.yaml. One should at least put one's IRC nick in the admins field — e.g., if one's nick is "Ferris":

admins:
  - nick: Ferris

Configuration fields currently supported are as follows (with values given for example only):

# A string to be used as the bot's IRC nickname. This field is required.
nickname: egbot

# A string to be used as the bot's IRC username (which has little effect
# in most cases). Defaults to the nickname.
username: egbot

# A string to be used as the bot's IRC "realname" or "GECOS string", which
# has still less effect and is often used to display information about a
# bot's software. Defaults to displaying information about the bot's
# software.
realname: 'Built with `irc-bot.rs`.'

# A list of servers to which the bot should connect on start-up.
# Currently, only the first server will be used, and the bot will crash if
# no servers are listed; both of these issues should be fixed at some
# future point.
servers:
  - host: irc.mozilla.org
    port: 6697
    # Whether to use Transport Layer Security. Defaults to `true`.
    tls: true
    # A list of channels that the bot should join after connecting. Note
    # that each channel should be wrapped in quotation marks or otherwise
    # escaped so that the '#' is not taken as the start of a comment.
    channels:
      - '#rust-irc'

# A list of IRC users who will be authorized to direct the bot to run
# certain priviledged commands. For each listed user, the fields `nick`,
# `user`, and `host` may be specified; for each of which that is
# specified, a user will need to have a matching nickname, username, or
# hostname (respectively) to be authorized. All the specified fields must
# match for a user to be authorized.
admins:
  # To be authorized as an administrator of the bot, this user will need
  # to have the nickname "Ferris", the username "~crab", and the hostname
  # "rustacean.net":
  - nick: Ferris
    user: '~crab'
    host: rustacean.net
  # To be authorized as an administrator of the bot, this user will only
  # need have the nickname "c74d":
  - nick: c74d

Building

For most users, it should suffice simply to use Cargo:

$ cargo build

Users of the Linux distribution NixOS may prefer to use the provided Makefile, which wraps the tool nix-shell:

$ make build
Commit count: 305

cargo fmt