generated from mwc/lab_riddles
Finished the code it should work now
This commit is contained in:
2
api.py
2
api.py
@@ -49,7 +49,7 @@ class RiddleAPI:
|
|||||||
riddles = self.get_all_riddles()
|
riddles = self.get_all_riddles()
|
||||||
if len(riddles) == 0:
|
if len(riddles) == 0:
|
||||||
raise APIError(["Sorry, there are no riddles on the server!"])
|
raise APIError(["Sorry, there are no riddles on the server!"])
|
||||||
return random.choice(riddles)
|
return choice(riddles)
|
||||||
|
|
||||||
|
|
||||||
def add_riddle(self, question, answer):
|
def add_riddle(self, question, answer):
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
# RiddleView provides a nice user interface for guessing riddles.
|
# RiddleView provides a nice user interface for guessing riddles.
|
||||||
|
|
||||||
from api import RiddleAPI
|
from api import RiddleAPI
|
||||||
|
import requests
|
||||||
|
|
||||||
class RiddleView:
|
class RiddleView:
|
||||||
"Allows a player to interact with a Riddle Server from the Terminal"
|
"Allows a player to interact with a Riddle Server from the Terminal"
|
||||||
|
|||||||
Reference in New Issue
Block a user