Add a prefix adapter to implement ! commands and ignoring help in public channels
This commit is contained in:
@@ -14,6 +14,7 @@ import (
|
||||
"github.com/tcolgate/hugot"
|
||||
"github.com/tcolgate/hugot/adapters/irc"
|
||||
|
||||
"ur.gs/lysenko/adapters"
|
||||
"ur.gs/lysenko/handlers/deadline"
|
||||
"ur.gs/lysenko/handlers/quotedb"
|
||||
)
|
||||
@@ -53,6 +54,11 @@ func main() {
|
||||
}
|
||||
|
||||
adapter := irc.New(config, channelList...)
|
||||
prefix_adapter := adapters.NewPrefixAdapter(adapter, "!")
|
||||
prefix_adapter.PrivateHelpOnly = true
|
||||
|
||||
ctx := context.Background()
|
||||
go prefix_adapter.Run(ctx)
|
||||
|
||||
db, err := quotedb.New(*quotes)
|
||||
if err != nil {
|
||||
@@ -67,5 +73,5 @@ func main() {
|
||||
mux.HandleCommand(deadline.NewCommand("edb.RandQuoteHandler{QuoteDB: db}))
|
||||
mux.HandleCommand(deadline.NewCommand("edb.QuoteHandler{QuoteDB: db}))
|
||||
|
||||
hugot.ListenAndServe(context.Background(), mux, adapter)
|
||||
hugot.ListenAndServe(ctx, mux, prefix_adapter)
|
||||
}
|
||||
|
Reference in New Issue
Block a user