File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ def __init__(self, loop=asyncio.get_event_loop()):
5353 self .loop = loop
5454 self .start_time = time .time ()
5555 self .running = True
56- # future which will be called when the bot stops
56+ # future which will be called when the bot stopsIf you
5757 self .stopped_future = asyncio .Future (loop = self .loop )
5858
5959 # stores each bot server connection
@@ -90,8 +90,10 @@ def __init__(self, loop=asyncio.get_event_loop()):
9090 self .db_session = scoped_session (self .db_factory )
9191 self .db_metadata = MetaData ()
9292
93- # set botvars.metadata so plugins can access when loading
93+ # set botvars so plugins can access when loading
9494 botvars .metadata = self .db_metadata
95+ botvars .user_agent = self .user_agent
96+
9597 logger .debug ("Database system initialised." )
9698
9799 # Bot initialisation complete
Original file line number Diff line number Diff line change 22botvars - contains variables set by cloudbot to be easily access
33"""
44
5- # MetaData object to be assigned in the CloudBot object initialization
65# this is assigned in the CloudBot so that its recreated when the bot restarts
76metadata = None
7+ user_agent = None
Original file line number Diff line number Diff line change @@ -12,13 +12,13 @@ def wyr(bot):
1212 r = requests .get (url = API_URL , headers = headers )
1313 data = r .json ()
1414
15- # decrapify text
15+ # clean up text
1616 title = data ['title' ].strip ().capitalize ().rstrip ('.?,' )
1717 choice1 = data ['choicea' ].strip ().lower ().rstrip ('.?,!' ).lstrip ('.' )
1818 choice2 = data ['choiceb' ].strip ().lower ().rstrip ('.?,!' ).lstrip ('.' )
1919 link = data ['link' ]
2020
21- # get all the words in the answers
21+ # get a list all the words in the answers
2222 text = choice1 .split () + choice2 .split ()
2323 text = [word for word in text if word != "a" ]
2424
You can’t perform that action at this time.
0 commit comments