Skip to content

About

Eggdrop scripts for PISG: channel requests approved by hand, profiles, and GitHub patch notes in IRC

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🤖 pisg-eggdrop

Let people ask for IRC channel statistics from a bot, and let the ops approve them. A small set of Eggdrop scripts that run the "stats for everyone" service around PISG, the Perl IRC Statistics Generator.

Eggdrop Tcl Python License


✨ What you get

Script What it does
pisg-service.tcl /msg pisg !request #chan queues a request. An op approves it by hand (!approve), then the bot joins, checks the channel is registered with X, logs it, and writes the pisg config for it. Cleans up dead channels by itself.
pisg-id.tcl !id in #pisg runs a private question-and-answer (nick, aliases, avatar, sex, link) and queues a stats profile for ops approval.
pisg-profile.tcl Profiles: pisginfo (sex, avatar, link), pisgbio, pisgmerge, pisgname (the name the stats show), pisgshow, pisgdel. The bot identifies people by their X account.
pisg-netlist.tcl Popular channels of the network: once an hour LIST >40, keeps the busiest 60 (name, people, topic) for the network page.
pisg-github.tcl + gh-notify.py Says every new commit and release of a GitHub repository in a channel — the project's patch notes.

Everything is plain Tcl and one Python file. No database, no web server, no extra bot.

🧭 How it fits together

flowchart LR
    U([IRC user]) -- "/msg pisg !request #chan" --> B[Eggdrop<br/>pisg-service.tcl]
    B -- "request + !approve / !decline" --> O([#pisg.ops])
    O -- approved --> B
    B -- joins, logs --> L[(logs/chan.log)]
    B -- writes --> C[channels.auto.cfg]
    C --> P[pisg every 3 h]
    L --> P
    P --> W[[HTML statistics]]
    G[(GitHub API)] -- gh-notify.py --> B
    B -- "[PISG] new commit…" --> P2([#pisg])
Loading
  1. A user asks for their channel with !request. Nothing happens yet: the request goes in a queue and the ops are told in their own channel.
  2. An op answers with !approve #chan or !decline #chan [reason]. The requester is told either way.
  3. After approval the bot joins, asks the network for the channel modes and only keeps the channel if it is registered with X (+R). Otherwise it leaves and tells the requester why.
  4. The bot logs the channel in Eggdrop format and writes a <channel> block for pisg into channels.auto.cfg. Your normal pisg run (cron) turns the log into HTML.

Why approval by hand? An IRC network limits how many channels one connection may join. A bot open to everyone fills up in a day. A person in the loop keeps the service small, useful, and abuse-free.

🚀 Quick start

# 1. a folder both the bot and pisg can use
sudo groupadd pisg && sudo usermod -aG pisg eggdrop && sudo usermod -aG pisg www-data
sudo mkdir -p /srv/pisg/logs /srv/pisg/history
sudo chown -R root:pisg /srv/pisg && sudo chmod -R 2770 /srv/pisg

# 2. the scripts
cp scripts/pisg-service.tcl scripts/pisg-id.tcl scripts/pisg-github.tcl scripts/gh-notify.py  ~/eggdrop/scripts/
# eggdrop.conf
set keep-all-logs 1
set logfile-suffix ".log"

source scripts/pisg-service.tcl
source scripts/pisg-id.tcl
source scripts/pisg-github.tcl      ;# optional: patch notes in #pisg
# pisg.cfg
<include="/srv/pisg/channels.auto.cfg">   # one block per approved channel, written by the bot
<include="/srv/pisg/profiles.cfg">        # profiles approved with !id

Rehash the bot (.rehash), open your ops channel, and you are done. Full walk-through: docs/INSTALL.md.

💬 Commands

Who Command Result
anyone /msg pisg !request #chan queue a request (max 2 waiting per person)
anyone !stats (in a channel the bot is in) the link to that channel's statistics
channel op !remove the bot leaves, statistics stop, logs stay
#pisg !id private profile questions, sent to the ops
ops !pending list the waiting requests
ops !approve #chan accept: the bot joins
ops !decline #chan [reason] refuse, the requester gets the reason
ops !confirm <nick> / !deny <nick> answer a profile
bot owner /msg pisg !rebuild rewrite channels.auto.cfg

All the replies to people are NOTICEs, so nobody gets pinged in a channel. More in docs/COMMANDS.md.

⚙️ Configuration

Every script has one array set svc { … } block at the top. Change the values there.

namespace eval pisgsvc {
    array set svc {
        dir        "/srv/pisg"
        outdir     "/var/www/pisg"
        baseurl    "https://stats.example.org/pisg"
        max        40
        opschan    "#pisg.ops"
        pend_max   25
        pend_each  2
        pend_days  7
        idle_days  14
        regmode    "R"
        protected  {#pisg}
    }
}

What the main ones mean: outdir is where pisg writes the HTML; max must stay under the network's limit of channels per connection; opschan is where requests are approved; pend_max / pend_each cap the waiting queue for everybody / for one person; pend_days drops requests nobody answered; idle_days makes the bot leave quiet channels; regmode is the channel mode that proves X registration; protected channels can never be removed with !remove.

The complete list is in docs/CONFIGURATION.md.

🔒 Privacy

The bot keeps a nick, a channel name and a time per request, in channels.txt and pending.txt. It never writes a hostmask to a file or to a web page. The channel logs it writes are what pisg reads; if you publish the statistics, say so (and what you keep) in a privacy policy. Notes in docs/PRIVACY.md.

🧪 Requirements

  • Eggdrop 1.10 (uses getaccount for X accounts when the network provides them)
  • Tcl 8.6, Python 3.6+ (only for gh-notify.py)
  • PISG 1.0 or newer to turn the logs into pages
  • An Undernet-style X service. On another network change regmode, or set it to "" and edit reject to skip the check.

🤝 Related

  • PISG/pisg: the statistics generator
  • PISG/pisg.online: the website that uses all of this, with the Apache, cron and privacy-page setup

📄 Licence

GPL-2.0, like PISG. See LICENSE.

About

Eggdrop scripts for PISG: channel requests approved by hand, profiles, and GitHub patch notes in IRC

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages