This commit is contained in:
+9
-3
@@ -76,6 +76,10 @@ func (bot *Bot) Connect(server string, ssl bool, maxRetries int) (err error) {
|
||||
return err
|
||||
}
|
||||
|
||||
func (bot *Bot) ClientState() irc.ClientState {
|
||||
return bot.client.State()
|
||||
}
|
||||
|
||||
func (bot *Bot) addChannel(channelName string) *Channel {
|
||||
if bot.channels[channelName] != nil {
|
||||
return bot.channels[channelName]
|
||||
@@ -156,12 +160,14 @@ func (bot *Bot) loop() {
|
||||
}
|
||||
}
|
||||
|
||||
if len(joins) > 0 {
|
||||
bot.client.Join(joins...)
|
||||
}
|
||||
if len(parts) > 0 {
|
||||
log.Println("Leaving", strings.Join(parts, ", "))
|
||||
bot.client.Part(parts...)
|
||||
}
|
||||
if len(joins) > 0 {
|
||||
log.Println("Joining", strings.Join(joins, ", "))
|
||||
bot.client.Join(joins...)
|
||||
}
|
||||
}
|
||||
|
||||
case <-bot.loopCtx.Done():
|
||||
|
||||
@@ -132,7 +132,7 @@ func (channel *Channel) loop() {
|
||||
if target != nil {
|
||||
me, ok := target.UserList().User(channel.client.Nick())
|
||||
if !ok || !strings.ContainsRune(me.Modes, 'o') {
|
||||
channel.client.Say(channel.name, "This unit require operator privileges to serve this request.")
|
||||
channel.client.Say(channel.name, "This unit has insufficient privileges.")
|
||||
break
|
||||
}
|
||||
|
||||
|
||||
@@ -14,10 +14,14 @@ type Config struct {
|
||||
User string `json:"user"`
|
||||
RealName string `json:"realName"`
|
||||
} `json:"bot"`
|
||||
Debug struct {
|
||||
Enabled bool `json:"enabled"`
|
||||
Listen string `json:"listen"`
|
||||
} `json:"debug"`
|
||||
Server struct {
|
||||
Address string `json:"server"`
|
||||
SSL bool `json:"ssl"`
|
||||
}
|
||||
} `json:"server"`
|
||||
API struct {
|
||||
Endpoint string `json:"endpoint"`
|
||||
Username string `json:"username"`
|
||||
@@ -32,7 +36,7 @@ type Config struct {
|
||||
} `json:"commands"`
|
||||
Names struct {
|
||||
ChanServ string `json:"chanserv"`
|
||||
}
|
||||
} `json:"names"`
|
||||
}
|
||||
|
||||
var mutex sync.Mutex
|
||||
|
||||
Reference in New Issue
Block a user