mirror of https://github.com/velour/catbase.git
Fixing self remembering problems stemming from lib change.
This commit is contained in:
parent
a91ebde376
commit
0acd004e59
12
bot/bot.go
12
bot/bot.go
|
@ -149,6 +149,9 @@ func (b *Bot) AddHandler(name string, h Handler) {
|
|||
}
|
||||
|
||||
func (b *Bot) SendMessage(channel, message string) {
|
||||
if !strings.HasPrefix(message, actionPrefix) {
|
||||
b.selfSaid(channel, message, false)
|
||||
}
|
||||
for len(message) > 0 {
|
||||
m := irc.Msg{
|
||||
Cmd: "PRIVMSG",
|
||||
|
@ -164,19 +167,16 @@ func (b *Bot) SendMessage(channel, message string) {
|
|||
}
|
||||
b.Client.Out <- m
|
||||
}
|
||||
|
||||
b.selfSaid(channel, message)
|
||||
}
|
||||
|
||||
// Sends action to channel
|
||||
func (b *Bot) SendAction(channel, message string) {
|
||||
// TODO: ADD CTCP ACTION
|
||||
// Notify plugins that we've said something
|
||||
b.selfSaid(channel, message, true)
|
||||
|
||||
message = actionPrefix + " " + message + "\x01"
|
||||
|
||||
b.SendMessage(channel, message)
|
||||
|
||||
// Notify plugins that we've said something
|
||||
b.selfSaid(channel, message)
|
||||
}
|
||||
|
||||
// Handles incomming PRIVMSG requests
|
||||
|
|
|
@ -215,12 +215,13 @@ func (b *Bot) Help(channel string, parts []string) {
|
|||
}
|
||||
|
||||
// Send our own musings to the plugins
|
||||
func (b *Bot) selfSaid(channel, message string) {
|
||||
func (b *Bot) selfSaid(channel, message string, action bool) {
|
||||
msg := Message{
|
||||
User: &b.Me, // hack
|
||||
Channel: channel,
|
||||
Body: message,
|
||||
Raw: message, // hack
|
||||
Action: action,
|
||||
Command: false,
|
||||
Time: time.Now(),
|
||||
Host: "0.0.0.0", // hack
|
||||
|
|
|
@ -58,6 +58,7 @@ func (p *RememberPlugin) Message(message bot.Message) bool {
|
|||
|
||||
for i := len(p.Log[message.Channel]) - 1; i >= 0; i-- {
|
||||
entry := p.Log[message.Channel][i]
|
||||
|
||||
if strings.ToLower(entry.User.Name) == strings.ToLower(nick) &&
|
||||
strings.Contains(
|
||||
strings.ToLower(entry.Body),
|
||||
|
|
Loading…
Reference in New Issue