Skip to content

Commit

Permalink
Added 'notice' action to IRCBee
Browse files Browse the repository at this point in the history
  • Loading branch information
muesli committed Mar 13, 2017
1 parent edaf864 commit 7b833bb
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
11 changes: 9 additions & 2 deletions bees/ircbee/ircbee.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ func (mod *IrcBee) Action(action bees.Action) []bees.Placeholder {
outs := []bees.Placeholder{}

switch action.Name {
case "notice":
fallthrough
case "send":
tos := []string{}
text := ""
Expand All @@ -76,7 +78,12 @@ func (mod *IrcBee) Action(action bees.Action) []bees.Placeholder {
recv = recv[0:strings.Index(recv, "!")]
}

mod.client.Privmsg(recv, text)
switch action.Name {
case "notice":
mod.client.Notice(recv, text)
case "send":
mod.client.Privmsg(recv, text)
}
}
}

Expand Down Expand Up @@ -125,7 +132,7 @@ func (mod *IrcBee) part(channel string) {
}
}

func (mod *IrcBee) statusChange(eventChan chan bees.Event,conn *irc.Conn, line *irc.Line) {
func (mod *IrcBee) statusChange(eventChan chan bees.Event, conn *irc.Conn, line *irc.Line) {
//Line.CMD eq Handler Name ex: JOIN
message := ""
switch line.Cmd {
Expand Down
19 changes: 19 additions & 0 deletions bees/ircbee/ircbeefactory.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,25 @@ func (factory *IrcBeeFactory) Actions() []bees.ActionDescriptor {
},
},
},
{
Namespace: factory.Name(),
Name: "notice",
Description: "Sends a notice to a channel or a private query",
Options: []bees.PlaceholderDescriptor{
{
Name: "channel",
Description: "Which channel to send the message to",
Type: "string",
Mandatory: true,
},
{
Name: "text",
Description: "Content of the message",
Type: "string",
Mandatory: true,
},
},
},
{
Namespace: factory.Name(),
Name: "join",
Expand Down

0 comments on commit 7b833bb

Please sign in to comment.