Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- __module_name__ = "defaultmodule"
- __module_version__ = "1.0"
- __module_description__ = """
- My default module, containing all the things I find necessary.
- """
- import xchat
- import random
- xchat.prnt("Attempting to load module...")
- fquestions = []
- questionnumb = 0
- answer = ""
- def initiate_game():
- f = open("/home/brax/.xchat2/questions.txt")
- i = 0
- for line in f:
- fquestions[i] = line
- i = i+1
- xchat.emit_print("Channel Message", "TriviaBot", """
- Trivia Game, (C) Braxton Spence, 2009.
- Type [question] to start another question.
- Type only what you think is the answer, not "is it _______?"
- """)
- f.close()
- def question(numb):
- questionnumb = numb
- answer = fquestions[numb+1]
- xchat.emit_print("Channel Message", "TriviaBot", "Question 1: " + fquestions[numb])
- def get_answer(word, word_eol, userdata):
- if word[1] == answer:
- xchat.emit_print("Channel Message", "TriviaBot", "Congratulations! *Gives cookie to " + word[0] + "*")
- elif word[1] == "[question]":
- question((random.randint(0,(len(fquestions))/2)*2))
- xchat.hook_print("Channel Message", get_answer)
- xchat.prnt("Module loaded.")
- initiate_game()
Add Comment
Please, Sign In to add comment