Add examples
This commit is contained in:
parent
cc5ef29d2e
commit
f6d9fbc39c
1
.gitignore
vendored
1
.gitignore
vendored
@ -9,4 +9,3 @@ build/
|
|||||||
dist/
|
dist/
|
||||||
pip-wheel-metadata/
|
pip-wheel-metadata/
|
||||||
bot.conf
|
bot.conf
|
||||||
echo.py
|
|
||||||
|
17
examples/echo.py
Normal file
17
examples/echo.py
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
from xbotlib import Bot
|
||||||
|
|
||||||
|
|
||||||
|
class EchoBot(Bot):
|
||||||
|
"""SYN/ACK bot for testing things work.
|
||||||
|
|
||||||
|
Just direct message the bot and see if you get back what you sent. If so,
|
||||||
|
then you know your setup is working.
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
def react(self, message):
|
||||||
|
"""Send back what we get."""
|
||||||
|
self.reply(to=message.sender, body=message.body)
|
||||||
|
|
||||||
|
|
||||||
|
EchoBot()
|
20
examples/whisper.py
Normal file
20
examples/whisper.py
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
from xbotlib import Bot
|
||||||
|
|
||||||
|
|
||||||
|
class WhisperBot(Bot):
|
||||||
|
"""Pseudo-anonymous whispering in group chats.
|
||||||
|
|
||||||
|
In order to activate this bot you can invite it to your group chat. Once
|
||||||
|
invited, you can directly message the bot outside of the group chat and
|
||||||
|
tell it you want it to whisper your message into the group chat. The bot
|
||||||
|
will then do this on your behalf and not reveal your identity. This is nice
|
||||||
|
when you want to communicate with the group somewhat anonymously.
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
def react(self, message):
|
||||||
|
"""Receive direct messages and pass them to group chats."""
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
WhisperBot()
|
Reference in New Issue
Block a user