8000 GitHub - liamzdenek/go-irc: Go IRC framework that follows idiomatic Go practices. Also a bot that converts RSS feeds to IRC messages
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Go IRC framework that follows idiomatic Go practices. Also a bot that converts RSS feeds to IRC messages

License

Notifications You must be signed in to change notification settings

liamzdenek/go-irc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-rss-to-irc

This is an IRC bot that converts rss feeds into irc channel messages.

It also ops users that match a certain ident if the bot has op.

Case Against go-ircevent

Go-ircevent is callback based. The package controls the worker thread, and it handles delegation of events. This is not very idiomatic, particularly because an IRC socket behaves like a pair of channels, one for receiving, and one for sending.

That is how this library works. A main loop will look something like this:

import ("github.com/liamzdenek/go-irc/irc");
import ("github.com/liamzdenek/go-irc/irc/irce"); // extras

func main() {
	name := "testbot9000";
	channel := "#testbot9000";

	i := irc.NewIRC("irc.stormbit.net:6667");
	for e := range i.Rx {
		irce.LogHandler(e); // log.Printf() this event

		// handle IRC pings
		if i.PingHandler(e) {
			continue;
		}

		switch l := e.(type) {
		case *irc.EConnect:
			i.Tx <- &irc.Line{
				Command: "NICK",
				Arguments: []string{name},
			};
			i.Tx <- &irc.Line{
				Command: "USER",
				Arguments: []string{name, "8", "*"},
				Suffix: "The cake is a lie",
			};
		case *irc.Line:
			switch l.Command {
			case "001":
				i.Tx <-&irc.Line{
					Command: "JOIN",
					Arguments: []string{channel},
				};
			}
		}
	}
}

About

Go IRC framework that follows idiomatic Go practices. Also a bot that converts RSS feeds to IRC messages

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages

0