Eggdrop
Eggdrop is the oldest Internet Relay Chat (IRC) bot still in active development.
Install tcllib and tls and pycryptodome
emerge -av dev-tcltk/tcllib dev-tcltk/tls dev-python/pycryptodome
Compile eggdrop from source
git clone https://github.com/eggheads/eggdrop
cd eggdrop
./configure
make config
make $(nproc)
make install DEST=/mnt/usb/eggdrop
Start eggdrop
./eggdrop -m yourbot.conf
Send hello to your bot
/msg <yourbot> hello
pass <yourpass> (when replied)
Send dcc commands
/dcc chat <yourbot> .help
Setup your eggdrop
.+chan #<channel>
.chanset #channel chanmode +k <password>
.chanset #channel +autoop
.save
Set blowkey
/joín #channel
/blowkey set s8#G%pn#%iam*l#w$VZLGki5#e0AWalU
Scripts
Rehash script
bind pub - "!rehash" rehash_cmd
bind msg - "!rehash" rehash_cmd_pm
# Channel command
proc rehash_cmd {nick uhost hand chan text} {
putserv "PRIVMSG $chan :Rehashing..."
rehash
}
# PM command
proc rehash_cmd_pm {nick uhost hand text} {
putserv "PRIVMSG $nick :Rehashing..."
rehash
}
Show network bandwidth from proc
bind pub - "!bww" bandwidth_check
proc bandwidth_check {nick host handle chan text} {
set iface "eno1"
set data1 [exec awk -v iface=$iface {$1 ~ iface {gsub(/:/,"",$1); print $2, $10}} /proc/net/dev]
foreach {rx1 tx1} $data1 {}
after 1000
set data2 [exec awk -v iface=$iface {$1 ~ iface {gsub(/:/,"",$1); print $2, $10}} /proc/net/dev]
foreach {rx2 tx2} $data2 {}
set rxkbs [expr {($rx2 - $rx1) / 1024}]
set txkbs [expr {($tx2 - $tx1) / 1024}]
puthelp "PRIVMSG $chan :Bandwidth on $iface → Download: ${rxkbs} KB/s | Upload: ${txkbs} KB/s"
}
Allow a specifik user to be invited only
bind msg - "!invite" invite_cmd
proc invite_cmd {nick uhost handle text} {
set allowed_user "wuseman"
set target_channel "#-GreyZone-"
if { [string tolower $nick] != [string tolower $allowed_user] } {
return
}
# Check if the command is sent via private message, not in a channel
if {![string match "#*" $text]} {
putserv "INVITE $nick $target_channel"
putserv "PRIVMSG $nick :You have been invited to $target_channel."
}
}
Automatically start eggdrop at boot
Editera /etc/init.d/eggdrop
vim /etc/init.d/eggdrop
Add the following to /etc/init.d/eggdrop
#!/sbin/openrc-run
description="Eggdrop IRC bot"
command="/mnt/usb/eggdrop/eggdrop"
command_args="/mnt/usb/eggdrop/eggdrop.conf"
command_background="yes"
pidfile="/run/eggdrop.pid"
directory="/mnt/usb/eggdrop"
depend() {
need net
}
Make script executable
chmod +x /etc/init.d/eggdrop
Add eggdrop to default runlevel
rc-update add eggdrop default
Test setup directly
rc-service eggdrop start
Resource(s)