Coder Social home page Coder Social logo

goircbot's People

Contributors

clem1 avatar dependabot[bot] avatar imax9000 avatar knappjf avatar quite avatar s5i avatar stalkr avatar trofi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

goircbot's Issues

bot does not reconnect if connection breaks

If connection drops, e.g. with irc server showing the bot is gone or by issuing a kill, the bot doesn't seem to realize.
I'm expecting a log like: Connection error: dial tcp xxxxxxxxxxxxx - reconnecting in 1 minute

Reconnect logic drops channels

The "disconnected" handler at bot/bot.go:71 rebuilds b.channels from b.Me().Channels() before quitting - presumably, the intent of this is to preserve the effect of joins and parts that have happened since the bot was connected. However, b.Me().Channels() appears to be empty when this handler is run, so the actual effect is to stop the bot from joining any channels at all on reconnection.

Keeping b.channels up to date is probably the right solution in general; my use case is a static list of channels and a long-lived bot, so I can just remove the logic entirely.

Data race in df plugin, or any plugin that sends from a goroutine

Using the example bot, with the df limit altered so it fires, I see:

$ go run -race examplebot.go -host localhost:6667 -channels "#test"
...
WARNING: DATA RACE
Write by goroutine 77:
  runtime.mapassign1()
      /home/michael/work/topics/golang/go/src/runtime/hashmap.go:374 +0x0
  github.com/fluffle/goirc/state.(*Nick).addChannel()
      ~/golang/src/github.com/fluffle/goirc/state/nick.go:73 +0x151
  github.com/fluffle/goirc/state.(*stateTracker).Associate()
      ~/golang/src/github.com/fluffle/goirc/state/tracker.go:214 +0x3ad
  github.com/fluffle/goirc/client.(*Conn).h_JOIN()
      ~/golang/src/github.com/fluffle/goirc/client/state_handlers.go:77 +0x665
  github.com/fluffle/goirc/client.HandlerFunc.Handle()
      ~/golang/src/github.com/fluffle/goirc/client/dispatch.go:24 +0x43
  github.com/fluffle/goirc/client.(*hNode).Handle()
      ~/golang/src/github.com/fluffle/goirc/client/dispatch.go:52 +0xc8
  github.com/fluffle/goirc/client.func·002()
      ~/golang/src/github.com/fluffle/goirc/client/dispatch.go:128 +0x1c4

Previous read by goroutine 6:
  github.com/fluffle/goirc/state.(*Nick).Channels()
      ~/golang/src/github.com/fluffle/goirc/state/nick.go:124 +0x81
  github.com/StalkR/goircbot/plugins/df.(*Alarm).Notify()
      ~/golang/src/github.com/StalkR/goircbot/plugins/df/handlers.go:62 +0x315
  github.com/StalkR/goircbot/plugins/df.(*Alarm).Monitor()
      ~/golang/src/github.com/StalkR/goircbot/plugins/df/handlers.go:46 +0x2c5

Goroutine 77 (running) created at:
  github.com/fluffle/goirc/client.(*hSet).dispatch()
      ~/golang/src/github.com/fluffle/goirc/client/dispatch.go:130 +0x32c
  github.com/fluffle/goirc/client.(*Conn).dispatch()
      ~/golang/src/github.com/fluffle/goirc/client/dispatch.go:161 +0x5a
  github.com/fluffle/goirc/client.(*Conn).runLoop()
      ~/golang/src/github.com/fluffle/goirc/client/connection.go:316 +0x131

Goroutine 6 (running) created at:
  github.com/StalkR/goircbot/plugins/df.Register()
      ~/golang/src/github.com/StalkR/goircbot/plugins/df/handlers.go:97 +0x15c
  main.main()
      ~/golang/src/github.com/StalkR/goircbot/examplebot.go:63 +0x5c4

This seems to be a basic problem with anything that sends from another goroutine.

I guess the best fix is in goirc, so close this if you like, but I thought I'd at least document it for others.

allow setting command prefix

i'd like to use a different character than !.

being able to override all of the command handler would be nice, but if not, a method on Bot or Commands to set the command prefix to e.g. . would do.

support server password

I'd like to set the server password. fluffle/goirc supports it, but your NewBot* functions does not. Would you be up for adding (having that added)? It'd break the API as it stands...

Btw I'm using goircbot for a git* webhook receiving bot; https://github.com/quite/pjodd
But perhaps I'm slowly growing out of goircbot... thinking of multi-network support currently :)

Support connecting to an IRC network with multiple hostnames

NewBot API supports a single hostname (https://github.com/StalkR/goircbot/blob/master/bot/bot.go#L35), we'll need to change that, possibly introducing a slice of host, port and SSL (maybe in a string if we use host:+port format where + is optional for SSL).
And to be able to reconnect, we'll need to keep that slice somewhere in BotImpl https://github.com/StalkR/goircbot/blob/master/bot/bot.go#L99

goirc client.Config struct supports a single hostname (https://github.com/fluffle/goirc/blob/master/client/connection.go#L65). Possibly we can keep that.

We'll need to think carefully about this as it's a breaking API change, so I'd prefer to get it right first time.

data race in renick plugin

Probably related to #8

$ go run -race ~/go/src/github.com/StalkR/goircbot/examplebot.go -host=xxxxx -channels=#xxxxx -nick=xxxxx
==================
WARNING: DATA RACE
Write by goroutine 37:
  github.com/fluffle/goirc/client.(*Conn).Me()
      ~/go/src/github.com/fluffle/goirc/client/connection.go:175 +0xf0
  github.com/StalkR/goircbot/plugins/renick.func·001()
      ~/go/src/github.com/StalkR/goircbot/plugins/renick/handlers.go:25 +0x47
  github.com/fluffle/goirc/client.HandlerFunc.Handle()
      ~/go/src/github.com/fluffle/goirc/client/dispatch.go:24 +0x44
  github.com/fluffle/goirc/client.(*hNode).Handle()
      ~/go/src/github.com/fluffle/goirc/client/dispatch.go:52 +0xcf
  github.com/fluffle/goirc/client.func·002()
      ~/go/src/github.com/fluffle/goirc/client/dispatch.go:128 +0x208

Previous write by goroutine 36:
  github.com/fluffle/goirc/client.(*Conn).Me()
      ~/go/src/github.com/fluffle/goirc/client/connection.go:175 +0xf0
  github.com/StalkR/goircbot/bot.func·002()
      ~/go/src/github.com/StalkR/goircbot/bot/bot.go:68 +0x151
  github.com/fluffle/goirc/client.HandlerFunc.Handle()
      ~/go/src/github.com/fluffle/goirc/client/dispatch.go:24 +0x44
  github.com/fluffle/goirc/client.(*hNode).Handle()
      ~/go/src/github.com/fluffle/goirc/client/dispatch.go:52 +0xcf
  github.com/fluffle/goirc/client.func·002()
      ~/go/src/github.com/fluffle/goirc/client/dispatch.go:128 +0x208

Goroutine 37 (running) created at:
  github.com/fluffle/goirc/client.(*hSet).dispatch()
      ~/go/src/github.com/fluffle/goirc/client/dispatch.go:130 +0x39a
  github.com/fluffle/goirc/client.(*Conn).dispatch()
      ~/go/src/github.com/fluffle/goirc/client/dispatch.go:169 +0xcf
  github.com/fluffle/goirc/client.(*Conn).h_001()
      ~/go/src/github.com/fluffle/goirc/client/handlers.go:46 +0x150
  github.com/fluffle/goirc/client.HandlerFunc.Handle()
      ~/go/src/github.com/fluffle/goirc/client/dispatch.go:24 +0x44
  github.com/fluffle/goirc/client.(*hNode).Handle()
      ~/go/src/github.com/fluffle/goirc/client/dispatch.go:52 +0xcf
  github.com/fluffle/goirc/client.func·002()
      ~/go/src/github.com/fluffle/goirc/client/dispatch.go:128 +0x208

Goroutine 36 (finished) created at:
  github.com/fluffle/goirc/client.(*hSet).dispatch()
      ~/go/src/github.com/fluffle/goirc/client/dispatch.go:130 +0x39a
  github.com/fluffle/goirc/client.(*Conn).dispatch()
      ~/go/src/github.com/fluffle/goirc/client/dispatch.go:169 +0xcf
  github.com/fluffle/goirc/client.(*Conn).h_001()
      ~/go/src/github.com/fluffle/goirc/client/handlers.go:46 +0x150
  github.com/fluffle/goirc/client.HandlerFunc.Handle()
      ~/go/src/github.com/fluffle/goirc/client/dispatch.go:24 +0x44
  github.com/fluffle/goirc/client.(*hNode).Handle()
      ~/go/src/github.com/fluffle/goirc/client/dispatch.go:52 +0xcf
  github.com/fluffle/goirc/client.func·002()
      ~/go/src/github.com/fluffle/goirc/client/dispatch.go:128 +0x208
==================

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.