Update echobot to latest yaboli version
This commit is contained in:
parent
74a8adfa58
commit
1c409601db
3 changed files with 6 additions and 3 deletions
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
- add docstrings to `Bot`
|
- add docstrings to `Bot`
|
||||||
- change `KILL_REPLY` and `RESTART_REPLY` to be optional in `Bot`
|
- change `KILL_REPLY` and `RESTART_REPLY` to be optional in `Bot`
|
||||||
|
- fix echobot example
|
||||||
- fix imports
|
- fix imports
|
||||||
|
|
||||||
## 1.1.3 (2019-04-19)
|
## 1.1.3 (2019-04-19)
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
[general]
|
[general]
|
||||||
nick = EchoBot
|
nick = EchoBot
|
||||||
|
cookie_file = bot.cookie
|
||||||
|
|
||||||
[rooms]
|
[rooms]
|
||||||
test
|
test
|
||||||
|
|
|
||||||
|
|
@ -8,13 +8,14 @@ class EchoBot(yaboli.Bot):
|
||||||
"!echo <text> – reply with exactly <text>",
|
"!echo <text> – reply with exactly <text>",
|
||||||
]
|
]
|
||||||
|
|
||||||
def __init__(self, config_file):
|
def __init__(self, *args, **kwargs):
|
||||||
super().__init__(config_file)
|
super().__init__(*args, **kwargs)
|
||||||
self.register_botrulez(kill=True)
|
self.register_botrulez(kill=True)
|
||||||
self.register_general("echo", self.cmd_echo)
|
self.register_general("echo", self.cmd_echo)
|
||||||
|
|
||||||
async def cmd_echo(self, room, message, args):
|
async def cmd_echo(self, room, message, args):
|
||||||
await message.reply(args.raw)
|
text = args.raw.strip() # ignoring leading and trailing whitespace
|
||||||
|
await message.reply(text)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue