You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
c74d 7d711a3f55 Update yaml-rust and serde_yaml for security fixes 1 year ago
src Update to Rust 1.29.1 for security fix 1 year ago
.gitignore Ignore rustfmt backup files and Vim swap files 2 years ago
Cargo.toml Update yaml-rust and serde_yaml for security fixes 1 year ago
Makefile Makefile: Add release mode targets 2 years ago
README.md Update README 1 year ago
build.rs Run rustfmt 2 years ago
config.yaml Config: Allow listing channels to join 1 year ago
shell.nix Update to Rust 1.29.1 for security fix 1 year ago

README.md

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