Clarify return semantics
See https://git.vvvvvvaria.org/decentral1se/xbotlib/issues/6.
This commit is contained in:
parent
7618fee082
commit
b3cb78776e
@ -64,10 +64,10 @@ from xbotlib import Bot
|
||||
class EchoBot(Bot):
|
||||
|
||||
def direct(self, message):
|
||||
return self.reply(message.text, to=message.sender)
|
||||
self.reply(message.text, to=message.sender)
|
||||
|
||||
def group(self, message):
|
||||
return self.reply(message.content, room=message.room)
|
||||
self.reply(message.content, room=message.room)
|
||||
```
|
||||
|
||||
And then `python echo.py`. You will be asked a few questions in order to load
|
||||
@ -332,6 +332,9 @@ def serve(self, request):
|
||||
return self.respond(rendered)
|
||||
```
|
||||
|
||||
Please note the use of the `return` keyword here. The `serve` function must
|
||||
return a response that will be passed to the web server.
|
||||
|
||||
If you want to pass data from your `direct`/`group` functions to the `serve`
|
||||
function, you'll need to make use of [some type of persistent
|
||||
storage](#persistent-storage). Your `serve` function can read from the storage
|
||||
|
Reference in New Issue
Block a user