auth.tcl 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. # auth.tcl
  2. #
  3. # This script authenticates the bot with an authentication service when it is
  4. # connected to a server. The code and settings below are quite specific to
  5. # QuakeNet's authentication service provided by Q.
  6. #
  7. # Note: the authentication user name and password are stored in this script in
  8. # plain text. This is not very secure. So, be careful and use this script at
  9. # your own risk!
  10. #
  11. # The !register command for registering an account on the authentication
  12. # service is disabled by default. Uncomment the respective bind line below if
  13. # you really need it. Do not forget to comment it out again as soon as you have
  14. # registered the account.
  15. # tested versions, might run on earlier versions
  16. package require Tcl 8.6
  17. package require eggdrop 1.8.4
  18. namespace eval ::auth {
  19. # authentication settings for Q (QuakeNet)
  20. variable serv "Q@CServe.quakenet.org"
  21. variable name "YourQAccountName"
  22. variable pass "YourQAccountPassword"
  23. variable mail "YourMail@Address.com"
  24. }
  25. # authenticate the bot
  26. proc ::auth::auth { type } {
  27. global botnick
  28. variable serv
  29. variable name
  30. variable pass
  31. # authenticate the bot and hide host with +x
  32. putserv "PRIVMSG $serv :AUTH $name $pass"
  33. putserv "MODE $botnick :+x"
  34. putlog "Authenticated $botnick with $name on $serv."
  35. return 0
  36. }
  37. # register the bot with the authentication service
  38. proc ::auth::register {nick host hand chan arg} {
  39. global botnick
  40. variable serv
  41. variable mail
  42. # register current bot nick as account name with the mail address
  43. puthelp "PRIVMSG $nick :Registering $botnick and $mail on $serv."
  44. puthelp "PRIVMSG $serv :HELLO $mail $mail"
  45. putlog "Registered $botnick and $mail on $serv."
  46. return 1
  47. }
  48. namespace eval ::auth {
  49. # bind pub - !register ::auth::register
  50. bind evnt - init-server ::auth::auth
  51. putlog "Loaded auth.tcl"
  52. }