Compare commits

..

No commits in common. "8030955f3f534c95c8856fbaedfc3ce1a864a757" and "636ea209d18aec99e29687674bcb27949ded8b2f" have entirely different histories.

3 changed files with 4 additions and 4 deletions

View File

@ -29,7 +29,7 @@ Make sure you have this information right now:
- bot url (wss://your-snek-instance.com/rpc.ws) - bot url (wss://your-snek-instance.com/rpc.ws)
#### Create a file #### Create a file
Open a file ending with the `.py` extension and paste this content. Replace the authentication details on the bottom lines with the one of the account you just created. Open a file ending with the `.py` extension and pase this content.
```python ```python
import asyncio import asyncio
@ -120,6 +120,6 @@ The `ExampleBot` class inherits from a base `Bot` class and implements several e
- `on_own_message`: Logs messages sent by the bot itself. - `on_own_message`: Logs messages sent by the bot itself.
- `on_mention`: Handles mentions; if "source" is in the message, it replies with its own source code, with sensitive data disguised. - `on_mention`: Handles mentions; if "source" is in the message, it replies with its own source code, with sensitive data disguised.
- `on_message`: Responds to "hello" and "bye" messages if the bot has joined the channel. - `on_message`: Responds to "hello" and "bye" messages if the bot has joined the channel.
The bot will be instantiated and runs asynchronously. It will survive server deploys and network outages. If such issue occurs, it will try to reconnect within a second like nothing happened. It's production ready. The bot will be instantiated and runs asynchronously.

View File

@ -67,5 +67,5 @@ class ExampleBot(Bot):
await self.send_message(channel_uid, result) await self.send_message(channel_uid, result)
bot = ExampleBot(url="ws://snek.molodetz.nl/rpc.ws", username="example", password="xxxxxx") bot = ExampleBot(url="ws://snek.molodetz.nl/rpc.ws", username="example", password="example")
asyncio.run(bot.run()) asyncio.run(bot.run())

View File

@ -11,7 +11,7 @@ authors = [
{ name = "retoor", email = "retoor@molodetz.nl" } { name = "retoor", email = "retoor@molodetz.nl" }
] ]
keywords = ["chat", "snek", "molodetz","bot"] keywords = ["chat", "snek", "molodetz","bot"]
requires-python = ">=3" requires-python = ">=3.12"
dependencies = [ dependencies = [
"aiohttp" "aiohttp"
] ]