main
Stef Dunlap 2023-03-03 21:52:17 -05:00
parent 58617e078b
commit e94955f468
2 changed files with 18 additions and 7 deletions

2
.gitignore vendored
View File

@ -1 +1 @@
venv env

View File

@ -1,3 +1,4 @@
import argparse
import irc.bot import irc.bot
import time import time
import re import re
@ -47,12 +48,22 @@ class PlayBot(irc.bot.SingleServerIRCBot):
# Set the bot's nickname back to its original nickname # Set the bot's nickname back to its original nickname
connection.nick(self._nickname) connection.nick(self._nickname)
if __name__ == "__main__": if __name__ == "__main__":
channel = "#playhouse" parser = argparse.ArgumentParser(description='PlayBot - an IRC bot for performing plays')
nickname = "PlayBot" parser.add_argument('-c', '--channel', default='#playhouse', help='the IRC channel to join')
server = "localhost" parser.add_argument('-n', '--nickname', default='PlayBot', help='the nickname for the bot')
port = 6667 parser.add_argument('-s', '--server', default='localhost', help='the IRC server to connect to')
play_file = "play.txt" parser.add_argument('-p', '--port', default='6667', help='the port to connect to on the IRC server')
parser.add_argument('-f', '--file', default="play.txt", dest='play_file', help='the file containing the play script')
args = parser.parse_args()
channel = args.channel
nickname = args.nickname
server = args.server
port = int(args.port)
play_file = args.play_file
bot = PlayBot(channel, nickname, server, port, play_file) bot = PlayBot(channel, nickname, server, port, play_file)
bot.start() bot.start()