conf.sh 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. # The configuration file of bashy2.
  2. modes=12
  3. irc_port=6667
  4. irc_host='irc.sdf.org'
  5. irc_pass="$HOME/.oline"
  6. cmd_dir='./bits/commands'
  7. if [[ "$HOSTNAME" = 'iceland' ]] || [[ "$HOSTNAME" = 'sverige' ]]; then
  8. bot_user='BASHy2'
  9. bot_nick='BASHy2'
  10. bot_nick2='BASHy2-EU'
  11. bot_real='A BASH Bot'
  12. elif [[ "$HOSTNAME" = 'odin' ]]; then
  13. bot_user="BASHy2-EU"
  14. bot_nick='BASHy2-EU'
  15. bot_nick2='BASHy2'
  16. bot_real='BASHy2 in Europe'
  17. else
  18. printf '\n%s\n\n' 'Where am I?'
  19. exit 1
  20. fi
  21. function auth {
  22. # Authenticates users based on their username and host.
  23. if [[ "$nick" = "$bot_nick" ]]; then
  24. flag='aohv'
  25. else
  26. flag=''
  27. case "$host" in
  28. 'mab.sdf.org'|'ma.sdf.org'|'iceland.sdf.org'|'vps2.sdf.org'|'oper.sdf.org')
  29. flag='ohv'
  30. return ;;
  31. *'.sdf.org'|'sdf.lonestar.org'|'sdf.org')
  32. flag='v'
  33. test "$HOSTNAME" = 'odin' && return ;;
  34. *'.sdf-eu.org'|'sdf-eu.org'|*'.sdfeu.org'|'sdfeu.org')
  35. flag='v'
  36. test "$HOSTNAME" = 'iceland' && return ;;
  37. *)
  38. return ;;
  39. esac
  40. case "$(id "$user")" in
  41. *'600(MetaARPA)'*)
  42. flag='ohv' ;;
  43. *'500(arpa)'*)
  44. flag='hv' ;;
  45. esac
  46. fi
  47. }
  48. function 2botpriv {
  49. # Ensures the bots won't play /msg ping pong.
  50. if [[ "$nick" = "$bot_nick2" ]]; then
  51. return 0
  52. fi
  53. }
  54. function 2botjoin {
  55. # Silences the bot when the other one takes over.
  56. if [[ "$nick" = "$bot_nick2" ]]; then
  57. quiet=0
  58. fi
  59. }
  60. function 2botquit {
  61. # Makes the bot take over when the other one quits.
  62. local nick="${1:1}"
  63. if [[ "$nick" = "$bot_nick2" ]]; then
  64. quiet=1
  65. fi
  66. }