5 Working on Rowbot
Nick Chambers edited this page 2021-07-01 03:09:17 +00:00

About

Rowbot is an over-engineered IRC bot that can sometimes remember things. Almost all of rowbot is written in Bash, except for a few external programs that are used.

Dependencies

  • GNU Bash 5

  • rm (common in most POSIX-y places)

  • mktemp (common in most POSIX-y places)

  • mkfifo (common in most POSIX-y places)

  • Socat (for handling TLS connections)

  • sleep (common in most POSIX-y places)

  • mkdir (common in most POSIX-y places)

A Tour of Rowbot

Stats

Information about rowbot usage. Currently, the following information is tracked:

  • START_TIME: the date the original rowbot process launched, in the form of a unix timestamp.

  • RELOADED: the number of times rowbot has been reloaded.

  • LAST_RELOAD: the date the current rowbot process began, in the form of a unix timestamp.

  • LONGEST_LIFE: the longest amount of time any rowbot process has lived, in seconds.

Switch Toggler

Switches that are flicked on to change Bash's behavior. At this time, the following options are enabled:

  • nullglob: globs with no results expand to nothing.

  • dotglob: include "hidden" files in globs.

  • extglob: enable more powerful glob utilities.

Logger

Logging facilities for documenting what rowbot is doing. The log levels in order of priority are:

  • error: for critical problems that have occurred and the admin needs to be aware of.

  • warn: for situations that are unexpected, but not a problem yet.

  • info: for general and informational messages about the state of rowbot.

  • debug: for troubleshooting low-level and complex rowbot operations

For each log level, a function by the same name is available. The utility function is-log-level is also available to determine if a particular input is a valid logging level. The global variable level stores the current level.

Utilities

Utility functions to improve rowbot operations. Currently, this consists of:

  • has: determine if a program is known or not.

  • die: log a fatal error, and exit the program.

  • is-parent: determine if a process image is the parent or a child.

  • is-channel: determine if the origin of a message is a channel.

  • is-bot: determine the likelihood of a message being sent by a bot.

  • is-log-level: determine if a given input is a valid logging level.

  • seconds: convert a given number of seconds to a human-readable time.

Argument Parser for Parsing Arguments

Collect and store GNU-long-style command line arguments.