[project @ 2003-04-04 02:49:43 by unknown_lamer]
authorunknown_lamer <unknown>
Fri, 4 Apr 2003 02:49:43 +0000 (02:49 +0000)
committerunknown_lamer <unknown>
Fri, 4 Apr 2003 02:49:43 +0000 (02:49 +0000)
Added a new script and updated the example configuration

examples/bot.autoexec [new file with mode: 0644]
examples/bot.conf [new file with mode: 0644]
examples/bot.help [new file with mode: 0644]
examples/bot.init [new file with mode: 0644]
examples/bot.shit [new file with mode: 0644]
examples/bot.users [new file with mode: 0644]
scripts/country
scripts/hello
scripts/log.scm [new file with mode: 0644]

diff --git a/examples/bot.autoexec b/examples/bot.autoexec
new file mode 100644 (file)
index 0000000..408d4d2
--- /dev/null
@@ -0,0 +1,8 @@
+; -*- guile-scheme -*-
+
+;;; Loads all bot-modules listed in scripts.load
+(let ((scripts (open-file "scripts.load" "r")))
+  (let load-loop ((script (read scripts)))
+    (cond ((not (eof-object? script))
+          (bot:load-module script)
+          (load-loop (read scripts))))))
\ No newline at end of file
diff --git a/examples/bot.conf b/examples/bot.conf
new file mode 100644 (file)
index 0000000..b50b523
--- /dev/null
@@ -0,0 +1,46 @@
+# Sample configuration file for Bobot++
+# Copyright (c) 1997 Etienne BERNARD
+# Copyright (C) 2003 Clinton Ebadi (Heavily modified)
+
+# Nickname of the bot
+# nick = <string>
+nick = TestBot
+
+# Username of the bot (remember : nick!username@hostname)
+# username = <string>
+username = lamerbot
+
+# IRCname of the bot (shown with /whois)
+# ircname = <string>
+ircname = Scheme Me!
+
+# Command char of the bot
+# cmdchar = <char>
+cmdchar = !
+
+# Filename for the bot's userlist
+# userlist = <filename>
+userlist = bot.users
+
+# Filename for the bot's shitlist
+# shitlist = <filename>
+shitlist = bot.shit
+
+# Log file
+# logfile = <filename> (you can put /dev/null if you don't want logs)
+logfile = bot.log
+
+# Server
+# server = <name> [<port> [<password>]]
+server = irc.freenode.net
+#server = trollaxor.com
+#server = irc.oftc.net
+
+# Channels for the bot
+# channel = <channelname>:<initial modes>:<modes to keep>:<channel key>
+# Example:
+# channel = #one:nt:::
+# channel = &two:nst:nst:
+# channel = #three:nstk key:nstk:key
+# etc...
+channel = #bobot:nt:nt::
diff --git a/examples/bot.help b/examples/bot.help
new file mode 100644 (file)
index 0000000..cd66324
--- /dev/null
@@ -0,0 +1,182 @@
+:ACTION [\ 2<channel>\ 2\ 2<message>\ 2
+Makes the bot do an action on \ 2<channel>\ 2.
+
+:ADDUSER \ 2<nick>\ 2|\ 2<mask>\ 2 \ 2<channelMask>\ 2 \ 2<level>\ 2 \ 2<prot>\ 2 \ 2<autoop>\ 2
+Adds an user to the userlist, for a nick!user@host matching the
+one given, on a channel matching the \ 2<channelMask>\ 2 given.
+The \ 2<level>\ 2 can be: | The \ 2<prot>\ 2 can be:  | The \ 2<autoop>\ 2 can be: 
+  0 - No level      |   0 - No protection |  0 - No auto-op
+  1 - User          |   1 - No ban        |  1 - Op on join
+  2 - Trusted User  |   2 - No kick       |
+  3 - Friend        |   3 - No deop       |
+  4 - Master        |                     |
+
+:ADDSERVER \ 2<host name>\ 2|\ 2<ip address>\ 2 [\ 2<port number>\ 2]
+Adds the server specified by \ 2<host name>\ 2 or \ 2<ip address>\ 2 to
+the server list.
+
+:ADDSHIT \ 2<nick>\ 2|\ 2<mask>\ 2 \ 2<channelMask>\ 2 \ 2<level>\ 2 \ 2<time>\ 2 [\ 2<reason>\ 2]
+Adds an user to the shitlist, for a nick!user@host matching the
+one given, on a channel matching the \ 2<channelMask>\ 2 given.
+The \ 2<level>\ 2 can be:
+  0 - No shit
+  1 - No op
+  2 - Kick and Ban on join
+  3 - Kick and Ban on join, no deban
+
+:ALIAS \ 2<new name>\ 2 \ 2<old name>\ 2
+Makes an alias, and adds the function \ 2<new name>\ 2, that will do
+exactly the same command as \ 2<old name>\ 2. Useful for lazy people :-)
+
+:BAN [\ 2<channel>\ 2\ 2<mask>\ 2|\ 2<nick>\ 2
+Bans \ 2<mask>\ 2 or \ 2<nick>\ 2 from \ 2<channel>\ 2. You need to be a trusted
+user to ban with a \ 2<mask>\ 2.
+
+:CHANGELEVEL \ 2<nick>\ 2|\ 2<mask>\ 2 \ 2<channel mask>\ 2 \ 2<new level>\ 2
+Gives \ 2<nick>\ 2 or \ 2<mask>\ 2 level \ 2<new level>\ 2 on channel(s)
+\ 2<channel mask>\ 2. Note that you can not change level for someone
+whose level is greater than yours, and that you can not give a
+level greater than yours.
+
+:CHANNELS
+Prints the channel(s) where the bot is currently.
+
+:CYCLE [\ 2<channel>\ 2]
+Makes the bot leave and join \ 2<channel>\ 2.
+
+:DCCLIST
+Gives the list of all DCC Chat connections.
+
+:DEBAN [\ 2<channel>\ 2\ 2<mask>\ 2|\ 2<nick>\ 2
+Debans \ 2<mask>\ 2 or \ 2<nick>\ 2 from \ 2<channel>\ 2. You need to be a trusted
+user to deban with a \ 2<mask>\ 2.
+
+:DELSERVER \ 2<server number>\ 2
+Deletes server from server list whose number in the server list
+is \ 2<server number>\ 2
+
+:DELUSER \ 2<nick>\ 2|\ 2<mask>\ 2 \ 2<channelMask>\ 2
+Removes \ 2<nick>\ 2 or \ 2<mask>\ 2 from the userlist.
+
+:DELSHIT \ 2<nick>\ 2|\ 2<mask>\ 2 \ 2<channelMask>\ 2
+Removes \ 2<nick>\ 2 or \ 2<mask>\ 2 from the shitlist.
+
+:DEOP [\ 2<channel>\ 2\ 2<mask>\ 2|\ 2<nick>\ 2
+Deops \ 2<mask>\ 2 or \ 2<nick>\ 2 on \ 2<channel>\ 2.
+
+:DIE [\ 2<reason>\ 2]
+Makes the bot stop immediately.
+
+:HELP [\ 2<topic>\ 2]
+Prints this help, or prints help about \ 2<topic>\ 2 if supplied.
+See the topics available for you with "HELP" without arguments.
+
+:IDENT \ 2<channel>\ 2 \ 2<password>\ 2
+Identifies you on the bot. Note that you should not use this
+command in public...
+
+:INVITE [\ 2<channel>\ 2\ 2<nick>\ 2
+Invites \ 2<nick>\ 2 on \ 2<channel>\ 2.
+
+:JOIN \ 2<channel>\ 2
+Makes the bot join \ 2<channel>\ 2.
+
+:KEEP [\ 2<channel>\ 2\ 2<modes>\ 2
+Sets the \ 2<modes> \ 2 that the bot will keep for \ 2<channel>\ 2.
+See also STATS.
+
+:KICK [\ 2<channel>\ 2\ 2<mask>\ 2|\ 2<nick>\ 2 [\ 2<reason>\ 2]
+Kicks \ 2<mask>\ 2 or \ 2<nick>\ 2 out of \ 2<channel>\ 2, because of \ 2<reason>\ 2.
+You need to be a trusted user to use a \ 2<mask>\ 2.
+
+:KICKBAN [\ 2<channel>\ 2\ 2<mask>\ 2|\ 2<nick>\ 2 [\ 2<reason>\ 2]
+Bans then kicks \ 2<mask>\ 2 or \ 2<nick>\ 2 out of \ 2<channel>\ 2,
+because of \ 2<reason>\ 2.
+You need to be a trusted user to use a \ 2<mask>\ 2.
+
+:LOAD
+Reloads the userlist from disk.
+
+:LOCK [\ 2<channel>\ 2]
+Locks topic on \ 2<channel>\ 2.
+
+:MODE [\ 2<channel>\ 2\ 2<mode string>\ 2
+Sends \ 2<mode string>\ 2 as mode for \ 2<channel>\ 2.
+
+:NAMES [\ 2<channel>\ 2]
+Shows the nicknames and status of users on \ 2<channel>\ 2.
+
+:NEXTSERVER
+Makes the bot connect to the next server in its server list.
+
+:NICK \ 2<nick>\ 2
+Makes the bot use nickname \ 2<nick>\ 2.
+
+:NSLOOKUP \ 2<nick>\ 2|\ 2<host>\ 2|\ 2<ip address>\ 2
+Does a nameserver query about \ 2<nick>\ 2's host, \ 2<host>\ 2 or
+\ 2<ip address>\ 2.
+
+:OP [\ 2<channel>\ 2\ 2<nick>\ 2
+Ops \ 2<nick>\ 2 on \ 2<channel>\ 2.
+
+:PART [\ 2<channel>\ 2]
+Makes the bot leave \ 2<channel>\ 2.
+
+:PASSWORD \ 2<password>\ 2
+Changes your password on the bot. Use "NONE" as password
+if you want to clear it.
+Do not use this command in public!
+
+:RECONNECT
+Makes the bot reconnect to its current server.
+
+:RSPYMESSAGE
+Removes you from the spy list.
+
+:SAVE
+Saves the userlist.
+
+:SAY [\ 2<channel>\ 2\ 2<message>\ 2
+Makes the bot say \ 2<message>\ 2 on \ 2<channel>\ 2.
+
+:SERVER \ 2<server number>\ 2
+Select the server to connect to. \ 2<server number>\ 2 is the number of
+the server in the serverlist.
+
+:SERVERLIST
+Shows the bot's serverlist.
+
+:SHITLIST
+Shows the bot's shitlist.
+
+:SPYLIST
+Shows the bot's spylist.
+
+:SPYMESSAGE
+Adds you to the spylist
+
+:STATS [\ 2<channel>\ 2]
+Gives \ 2<channel>\ 2's statistics.
+
+:TBAN [\ 2<channel>\ 2\ 2<nick>\ 2|\ 2<mask>\ 2 \ 2<time>\ 2
+Bans \ 2<nick>\ 2 or \ 2<mask>\ 2 from \ 2<channel>\ 2 for \ 2<time>\ 2 seconds.
+
+:TKBAN [\ 2<channel>\ 2\ 2<nick>\ 2|\ 2<mask>\ 2 \ 2<time>\ 2 [\ 2<reason>\ 2]
+Bans \ 2<nick>\ 2 or \ 2<mask>\ 2 from \ 2<channel>\ 2 for \ 2<time>\ 2 seconds,
+then kicks him/them because of \ 2<reason>\ 2.
+
+:TOPIC [\ 2<channel>\ 2] [\ 2<topic>\ 2]
+If no \ 2<topic>\ 2 is given, prints \ 2<channel>\ 2's topic. Otherwise,
+the bot will change \ 2<channel>\ 2's topic to \ 2<topic>\ 2.
+
+:UNLOCK [\ 2<channel>\ 2]
+Makes the bot unlock topic on \ 2<channel>\ 2.
+
+:USERLIST
+Shows the bot's userlist.
+
+:WHO [\ 2<channel>\ 2]
+Show your level on \ 2<channel>\ 2.
+
+:WHOIS [\ 2<channel>\ 2\ 2<nick>\ 2
+Shows information about \ 2<nick>\ 2 on \ 2<channel>\ 2.
diff --git a/examples/bot.init b/examples/bot.init
new file mode 100644 (file)
index 0000000..b98b4b6
--- /dev/null
@@ -0,0 +1,16 @@
+t topic
+k kick
+w who
+wi whois
+nsl nslookup
+b ban
+tb tban
+db deban
+kb kickban
+bkick kickban
+tkb tkban
+me op
+o op
+do deop
+leave part
+l part
diff --git a/examples/bot.shit b/examples/bot.shit
new file mode 100644 (file)
index 0000000..e8bd2b1
--- /dev/null
@@ -0,0 +1 @@
+*!root@*.*:*:2:-1:You're on my shitlist, lamer
diff --git a/examples/bot.users b/examples/bot.users
new file mode 100644 (file)
index 0000000..b0edf75
--- /dev/null
@@ -0,0 +1,2 @@
+*!*YOURUSERNAME@*:#*:4:1:0:-1:*NONE*
+*!*@*:#*:0:0:0:-1:*NONE*
index 6241c01..a9d638b 100644 (file)
         (bot:say channel (string-append ext " is " (cadr t)))
         (bot:say channel (string-append "I don't know which country stands for " ext)))))
 
-(bot:addcommand "country" get-country #t 2 1)
+(bot:addcommand "country" get-country #t 2 bot:user-none)
index 7b0827d..c39b1f4 100644 (file)
@@ -1,6 +1,8 @@
 (define (hello c n)
-  (if (string=? n "")
-    (bot:say c "Hello world !")
-    (bot:say c (string-append "Hello " n " !"))))
+        (if (string=? n "")
+            (bot:say c "Hello world !")
+            (bot:say c (string-append "Hello " n " !"))
+        )
+)
 
 (bot:addcommand "hello" hello #t 2 0)
diff --git a/scripts/log.scm b/scripts/log.scm
new file mode 100644 (file)
index 0000000..554b1a4
--- /dev/null
@@ -0,0 +1,127 @@
+;;; simple logging script
+;;; Note that this doesn't get what the bot says
+;;; and logs everything to the same file :(
+
+(use-modules (ice-9 rdelim))
+
+(define log-port (open-file "channels.log" "al"))
+
+(define (time-stamp)
+  (strftime "(%H:%M:%S) " (gmtime (current-time))))
+
+(display (str-app
+         "\n== STARTING LOG [ " 
+         (strftime "%F " (gmtime (current-time)))
+         (time-stamp)
+         "] ==\n") log-port)
+
+(let ((pub-func 
+       (lambda (f t p)
+              (write-line (str-app
+                           (string-downcase! t) " "
+                           (time-stamp)
+                           "<" f "> " p)
+                          log-port))))
+  (bot:addhook hooks/public ".*"
+            pub-func
+            10000 #t "log")
+  (bot:addhook hooks/send/public ".*"
+              pub-func 1000 #t "log"))
+
+(let ((act-hook
+       (lambda (f t p)
+        (write-line
+         (str-app
+          (string-downcase! t) " "
+          (time-stamp)
+          "* " 
+          (car (string-split f #\!))
+          " " p)
+         log-port))))
+  (bot:addhook hooks/action ".*"
+              act-hook
+              10000 #t "log")
+  (bot:addhook hooks/send/action ".*"
+              act-hook 10000 #t "log"))
+
+(bot:addhook hooks/join ".*.*"
+            (lambda (name channel)
+              (write-line (str-app 
+                           (string-downcase! channel) " "
+                           (time-stamp)
+                           name " joined " 
+                           (string-downcase! channel))
+                          log-port))
+            10000 #t "log")
+
+(bot:addhook hooks/kick ".*"
+            (lambda (who op channel reason)
+              (write-line
+               (str-app
+                (string-downcase! channel) " "
+                (time-stamp)
+                who " was kicked from " channel
+                " by " op " (" reason ")") log-port))
+            10000 #t "log")
+
+(bot:addhook hooks/mode ".*"
+            (lambda (who channel mode)
+              (write-line
+               (str-app 
+                (string-downcase! channel) " "
+                (time-stamp)
+                who " set mode " mode
+                " on " (string-downcase! channel))
+               log-port))
+            10000 #t "log")
+
+(bot:addhook hooks/nickname ".*"
+            (lambda (orig new)
+              (write-line
+               (str-app 
+                "--- "
+                (time-stamp)
+                orig " is now known as "
+                new) log-port))
+            10000 #t "log")
+
+(bot:addhook hooks/leave ".*"
+            (lambda (who channel)
+              (write-line
+               (str-app
+                (string-downcase! channel) " "
+                (time-stamp)
+                who " has left channel " 
+                        (string-downcase! channel))
+               log-port))
+            10000 #t "log")
+
+(bot:addhook hooks/signoff ".*"
+            (lambda (who rest)
+              (write-line
+               (str-app 
+                "--- "
+                (time-stamp)
+                who " has left IRC (" 
+                        (substring rest 1 (string-length rest)) ")")
+               log-port))
+            10000 #t "log")
+
+(bot:addhook hooks/topic ".*"
+            (lambda (op channel new-topic)
+              (write-line
+               (str-app 
+                (string-downcase! channel) " "
+                (time-stamp)
+                op " has changed the topic on "
+                        (string-downcase! channel)
+                        " to: " new-topic)
+               log-port ))
+            10000 #t "log")
+
+(add-hook! bot:exit-hook (lambda ()
+                          (display  (str-app 
+                                     "== ENDING LOG [ " 
+                                     (strftime "%F " (gmtime (current-time)))
+                                     (time-stamp)
+                                     "] ==\n") log-port)))
\ No newline at end of file