You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

auth.go 713B

123456789101112131415161718192021222324252627282930313233
  1. package main
  2. import (
  3. "github.com/spf13/viper"
  4. "github.com/thoj/go-ircevent"
  5. "strings"
  6. )
  7. func (i *IRCCat) authorisedUser(nick string) bool {
  8. _, exists := i.auth_users[nick]
  9. return exists
  10. }
  11. func (i *IRCCat) handleJoin(e *irc.Event) {
  12. if e.Arguments[0] == viper.GetString("commands.auth_channel") {
  13. i.auth_users[e.Nick] = true
  14. }
  15. }
  16. func (i *IRCCat) handlePart(e *irc.Event) {
  17. if e.Arguments[0] == viper.GetString("commands.auth_channel") {
  18. delete(i.auth_users, e.Nick)
  19. }
  20. }
  21. func (i *IRCCat) handleNames(e *irc.Event) {
  22. if e.Arguments[2] == viper.GetString("commands.auth_channel") {
  23. nicks := strings.Split(e.Arguments[3], " ")
  24. for _, nick := range nicks {
  25. i.auth_users[nick] = true
  26. }
  27. }
  28. }