M README.md => README.md +5 -0
@@ 3,6 3,11 @@ Dis**go**rd is an example of or starting point for creating an easy to use and
extensible Discord bot using the [DiscordGo](https://github.com/bwmarrin/discordgo)
library.
+### Dependencies
+
+* Go
+* Lookman functionality relies on [plan9port](https://github.com/9fans/plan9port) and a mirror of the 9front manuals/source
+
### Installing
```
M TODO => TODO +6 -4
@@ 1,14 1,16 @@
Features
-* Automated g!dump'ing of config file (backups?)
-* g!sum acid(1)
-* Support for acid(1) in g!man
+* g!sum acid(1) -- print summary
+* Support for acid(1) format in g!man
* Search man blocks other than 9front's
* Server greeting
* 9front/plan9 source searching
* various cat-v fetches (harmful, page search [get lucky])
* Auto-propaganda processing for images (Black and White -> (9)-ify)
+* g!status -- display status/uptime info
+* g!remindme [time] text -- set a reminder for a given time (should work across bot reboots)
--
Problems
* Move feed caching to another file than the .cfg (seriously this is a fcking mess)
-
+* Scripts should have a universal config such as an environment variable (more portable/configurable)
+* No role/user restrictions (should be a txt file of admin/mod users, maybe)
A rebuild => rebuild +4 -0
@@ 0,0 1,4 @@
+#!/bin/bash
+# Rebuild script for hosting server
+go build; killall glenda; ./glenda > /home/seh/glenda.log 2>&1 &
+
M x/mux/lookman/lookman => x/mux/lookman/lookman +1 -1
@@ 3,7 3,7 @@
# prints out the names of all manual pages containing all the given keywords
rfork e
-# Don't forget to change the bottom sed replacement path (variables don't work)
+# Change these to match environment
sed=/usr/local/plan9port/bin/sed
MIRROR=/usr/share/mirror/plan9front
index=$MIRROR/sys/lib/man/lookman/index
M x/mux/man.go => x/mux/man.go +6 -1
@@ 22,6 22,11 @@ var desc []string = []string{
"Section (8) for things related to administering Plan 9."}
+// Match a term other than the title of the manual page for a manual page (6a should match the 2a man)
+func MatchMan(key string) {
+
+}
+
// Fetch a man page
func (m *Mux) Man(ds *discordgo.Session, dm *discordgo.Message, ctx *Context) {
resp := "\n"
@@ 106,7 111,7 @@ func (m *Mux) Man(ds *discordgo.Session, dm *discordgo.Message, ctx *Context) {
}
// Fetch a summary of a man page
-func (m *Mux) Sum(ds *discordgo.Session, dm *discordgo.Message, ctx *Context) {
+func (m *Mux) Summary(ds *discordgo.Session, dm *discordgo.Message, ctx *Context) {
}
A x/mux/man/matchman => x/mux/man/matchman +34 -0
@@ 0,0 1,34 @@
+#!/bin/rc
+# Usage: matchman key
+# Matches all manual pages with the given name as the key
+
+# Change these to match environment
+p9p=/usr/local/plan9port/bin
+awk=$p9p/awk
+sed=$p9p/sed
+grep=$p9p/grep
+MIRROR=/usr/share/mirror/plan9front
+LIB=$MIRROR/sys/man
+
+matches = ()
+
+sections = `{seq 8}
+for(section in $sections) {
+ pages = `{ls $LIB/$section/*}
+ for(page in $pages) {
+ names = `{$awk 'f{print;f=0} /NAME/{f=1}' $page | awk '{split($0,a, "\\"); print a[1]}' | awk '{split($0,a, "-"); print a[1]}'}
+ names = `{echo $names | $sed 's/,//g'}
+ names = `{echo $names | awk '{split($0,a, ", "); for (i in a) print a[i]}'}
+
+ # We now have a list of names at the top of the man page (if the format is correct)
+
+ for(name in $names) {
+ if(echo $name | $grep -q $1) {
+ matches = ($matches `{echo $page})
+ }
+ }
+ }
+}
+
+echo $matches
+