From 51189b340a75ff76d5c9eb7860b4513c4a2ac791 Mon Sep 17 00:00:00 2001 From: Liam Stanley Date: Tue, 4 Jul 2017 01:31:55 -0400 Subject: [PATCH] remove Event.GetChannel and Event.GetUser in favor of global lookup methods --- event.go | 34 ---------------------------------- 1 file changed, 34 deletions(-) diff --git a/event.go b/event.go index fde84f2..49a772b 100644 --- a/event.go +++ b/event.go @@ -380,40 +380,6 @@ func (e *Event) Pretty() (out string, ok bool) { return "", false } -// GetChannel is a helper function around an event which lets you easily obtain -// the channel information from state tracking. Note that this should only -// be called from a PRIVMSG where the message originated from the server. -// The returned result may be nil if not in state, and will panic if called -// when tracking is disabled. -func (e *Event) GetChannel(c *Client) *Channel { - if e == nil { - return nil - } - - if !e.IsFromChannel() { - return nil - } - - return c.LookupChannel(e.Params[0]) -} - -// GetUser is a helper function around an event which lets you easily obtain -// the user information from state tracking. Note that this should only be -// called from a PRIVMSG where the message originated from the server. The -// returned result may be nil if not in state, and will panic if called when -// tracking is disabled. -func (e *Event) GetUser(c *Client) *User { - if e == nil { - return nil - } - - if !e.IsFromChannel() { - return nil - } - - return c.LookupUser(e.Source.Name) -} - // IsAction checks to see if the event is a PRIVMSG, and is an ACTION (/me). func (e *Event) IsAction() bool { if e.Source == nil || e.Command != PRIVMSG || len(e.Trailing) < 9 {