Fixes register logic so we only need password.txt when register set to True
This commit is contained in:
parent
971c13cc25
commit
b148c9a1e6
9
bot.py
9
bot.py
@ -1,7 +1,7 @@
|
|||||||
# Welcome to WelcomeBot. Find source, documentation, etc here: https://github.com/shaunagm/WelcomeBot/ Licensed https://creativecommons.org/licenses/by-sa/2.0/
|
# Welcome to WelcomeBot. Find source, documentation, etc here: https://github.com/shaunagm/WelcomeBot/ Licensed https://creativecommons.org/licenses/by-sa/2.0/
|
||||||
|
|
||||||
# Import some necessary libraries.
|
# Import some necessary libraries.
|
||||||
import socket, sys, time, csv, Queue, random, re, pdb, select
|
import socket, sys, time, csv, Queue, random, re, pdb, select, os.path
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
|
|
||||||
# Some basic variables used to configure the bot.
|
# Some basic variables used to configure the bot.
|
||||||
@ -12,7 +12,7 @@ channel_greeters = ['shauna', 'paulproteus', 'marktraceur']
|
|||||||
wait_time = 60
|
wait_time = 60
|
||||||
hello_list = [r'hello', r'hi', r'hey', r'yo', r'sup']
|
hello_list = [r'hello', r'hi', r'hey', r'yo', r'sup']
|
||||||
help_list = [r'help', r'info', r'faq', r'explain yourself']
|
help_list = [r'help', r'info', r'faq', r'explain yourself']
|
||||||
registered = true # If users don't want to identify, change the value to false.
|
registered = False # If users don't want to identify, change the value to false.
|
||||||
|
|
||||||
|
|
||||||
#########################
|
#########################
|
||||||
@ -72,9 +72,10 @@ def join_irc(ircsock):
|
|||||||
ircsock.send("USER {0} {0} {0} :This is http://openhatch.org/'s greeter bot"
|
ircsock.send("USER {0} {0} {0} :This is http://openhatch.org/'s greeter bot"
|
||||||
".\n".format(botnick)) # bot authentication
|
".\n".format(botnick)) # bot authentication
|
||||||
ircsock.send("NICK {}\n".format(botnick)) # Assign the nick to the bot.
|
ircsock.send("NICK {}\n".format(botnick)) # Assign the nick to the bot.
|
||||||
|
if os.path.isfile("password.txt"):
|
||||||
with open("password.txt", 'r') as f:
|
with open("password.txt", 'r') as f:
|
||||||
password = f.read()
|
password = f.read()
|
||||||
if registered == true:
|
if registered == True:
|
||||||
ircsock.send("PRIVMSG {} {} {} {}".format("NickServ","IDENTIFY", botnick, password))
|
ircsock.send("PRIVMSG {} {} {} {}".format("NickServ","IDENTIFY", botnick, password))
|
||||||
ircsock.send("JOIN {} \n".format(channel)) # Joins channel
|
ircsock.send("JOIN {} \n".format(channel)) # Joins channel
|
||||||
|
|
||||||
@ -245,5 +246,3 @@ def main():
|
|||||||
|
|
||||||
if __name__ == "__main__": # This line tells the interpreter to only execute main() if the program is being run, not imported.
|
if __name__ == "__main__": # This line tells the interpreter to only execute main() if the program is being run, not imported.
|
||||||
sys.exit(main())
|
sys.exit(main())
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user