diff options
| author | Christine Dodrill <me@christine.website> | 2016-12-09 09:40:54 -0800 |
|---|---|---|
| committer | Christine Dodrill <me@christine.website> | 2016-12-09 09:40:54 -0800 |
| commit | e4dbf078675f42472cbb1191b039a0a7a1c16715 (patch) | |
| tree | 847614a102a62f71449b8991d7a520d72605213e /irc | |
| parent | 9eef0e7863920c60983a9a769466ce186ce87661 (diff) | |
| download | x-e4dbf078675f42472cbb1191b039a0a7a1c16715.tar.xz x-e4dbf078675f42472cbb1191b039a0a7a1c16715.zip | |
update bncadmin to have a few partyline commands
Diffstat (limited to 'irc')
| -rw-r--r-- | irc/bncadmin/main.go | 57 | ||||
| -rw-r--r-- | irc/bncadmin/run.sh | 2 |
2 files changed, 51 insertions, 8 deletions
diff --git a/irc/bncadmin/main.go b/irc/bncadmin/main.go index 99a9b81..c2c7d20 100644 --- a/irc/bncadmin/main.go +++ b/irc/bncadmin/main.go @@ -73,16 +73,18 @@ func NewBot() *Bot { func (b *Bot) Handle(c *irc.Client, m *irc.Message) { b.setupDaemon.Do(func() { go func() { - b.lookingForUserNetworks = true - c.Writef("PRIVMSG *status ListAllUserNetworks") - time.Sleep(2 * time.Second) // always sleep 2 - b.lookingForUserNetworks = false + for { + b.lookingForUserNetworks = true + c.Writef("PRIVMSG *status ListAllUserNetworks") + time.Sleep(2 * time.Second) // always sleep 2 + b.lookingForUserNetworks = false - time.Sleep(1 * time.Hour) + time.Sleep(1 * time.Hour) + } }() }) - // log.Printf("in >> %s", m) + log.Printf("in >> %s", m) switch m.Command { case "PRIVMSG": @@ -136,11 +138,52 @@ func (b *Bot) HandleStarStatus(c *irc.Client, m *irc.Message) { } func (b *Bot) HandlePartyLineCommand(c *irc.Client, m *irc.Message) { + split := strings.Fields(m.Trailing()) + username := m.Prefix.Name[1:] + + if len(split) == 0 { + return + } + + switch strings.ToLower(split[0]) { + case "help": + c.Writef("PRIVMSG ?%s :Commands available:", username) + c.Writef("PRIVMSG ?%s :- ChangeName <new desired \"real name\">", username) + c.Writef("PRIVMSG ?%s : Changes your IRC \"real name\" to a new value instead of the default", username) + c.Writef("PRIVMSG ?%s :- Reconnect", username) + c.Writef("PRIVMSG ?%s : Disconnects from PonyChat and connects to PonyChat again", username) + c.Writef("PRIVMSG ?%s :- Help", username) + c.Writef("PRIVMSG ?%s : Shows this Message", username) + case "changename": + if len(split) < 1 { + c.Writef("NOTICE %s :Usage: ChangeName <new desired \"real name\">") + return + } + gecos := strings.Join(split[1:], " ") + c.Writef("PRIVMSG *controlpanel :Set RealName %s %s", username, gecos) + c.Writef("PRIVMSG ?%s :Please reply %q to confirm changing your \"real name\" to: %s", username, "Reconnect", gecos) + case "reconnect": + c.Writef("PRIVMSG ?%s :Reconnecting...", username) + c.Writef("PRIVMSG *controlpanel Reconnect %s PonyChat", username) + } } func (b *Bot) HandleCommand(c *irc.Client, m *irc.Message) { - + split := strings.Fields(m.Trailing()) + if split[0][0] == ';' { + switch strings.ToLower(split[0][1:]) { + case "request": + c.Write("PRIVMSG #bnc :In order to request a BNC account, please connect to the bouncer server (bnc.ponychat.net, ssl port 6697, allow untrusted certs) with your nickserv username and passsword in the server password field (example: AzureDiamond:hunter2)") + case "help": + c.Write("PRIVMSG #bnc :PonyChat bouncer help is available here: https://ponychat.net/help/bnc/") + case "rules": + c.Write("PRIVMSG #bnc :Terms of the BNC") + c.Write("PRIVMSG #bnc :- Do not use the BNC to evade channel bans") + c.Write("PRIVMSG #bnc :- Do not use the BNC to violate any network rules") + c.Write("PRIVMSG #bnc :- Do not use the BNC to connect to any other IRC network than PonyChat") + } + } } func (b *Bot) RemoveNetwork(c *irc.Client, username, network string) { diff --git a/irc/bncadmin/run.sh b/irc/bncadmin/run.sh index 9f8bd84..9b6d9cf 100644 --- a/irc/bncadmin/run.sh +++ b/irc/bncadmin/run.sh @@ -8,4 +8,4 @@ docker push xena/bncadmin hyper rm -f bncadmin ||: hyper pull xena/bncadmin -hyper run --name bncadmin -dit --size s1 --env-file .env xena/bncadmin +hyper run --name bncadmin -dit --size s2 --env-file .env xena/bncadmin |
