- Improvements :)
- Add method for sending video messages
- Misc improvements to device id handling
- None
- None
- Fix bug
- None
- Fixes a bug that caused an error on session save if session saving is disabled.
- None
- None
- Allow using E2EE with access token
- None
- Fixes a bug that prevented e2ee usage when access token
- None
- None
- Encryption Support!
- None
- Fixes a bug that prevented custom event listeners from functioning properly
- None
- None
- Encryption Support!
- Add support for e2e encrypted rooms
- Add limited verification support (device only)
- Add support for extendable config
- None
- None
- None
- Update dependencies
- None
- Update matrix-nio Dependency to version 0.19.0
- Fix test broken by matrix-nio updates
- None
- None
- The command matcher now has support for case-insensitive matches.
- Add case insensitive option to command matcher
- Update Pillow Dependency to version 9.0.1
- None
- None
Fixes a potential security problem.
- None
- Resolve issue #136: "Replace usage of ast.literal_eval with json.loads"
- None
- None
Fixes a bug.
- None
- Resolve issue #129: "AttributeError: 'Bot' object has no attribute '_need_allow_homeserver_users'"
- None
- None
Example usage is shown below:
"""
Example Usage:
random_user
!echo something
random_user2
*reacts with 👍️
echo_reaction_bot
Reaction: 👍️
"""
import simplematrixbotlib as botlib
creds = botlib.Creds("https://example.com", "echo_reaction_bot", "password")
bot = botlib.Bot(creds)
@bot.listener.on_reaction_event
async def echo_reaction(room, event, reaction):
resp_message = f"Reaction: {reaction}"
await bot.api.send_text_message(room.room_id, resp_message)
bot.run()
- A listener for handling
m.reaction
events has been added. Bot developers can now useListener.on_reaction_event
to smoothly handle reactions.
- None
- None
- None
None
- None
- Fixed #101 'Api' object has no attribute 'async_client'
- None
- None
Version 2.5.0 adds improvements to the config feature. A thank you to HarHarLinks for their contributions to version 2.5.0!
- Add allow/block lists: This allows bot developers to specify allow/block lists of users who have permission to interact with the bot using regex.
- Permissions can checked with
Match.is_from_allowed_user()
, which lets the bot developer choose which responses are restricted. - The allow/block lists can by modified at runtime via the
Config.add_allowlist()
,Config.remove_allowlist()
,Config.add_blocklist()
, andConfig.remove_blocklist()
methods.
- None
- None
- None
Example usage is shown below:
import simplematrixbotlib as botlib
creds = botlib.Creds("https://home.server", "user", "pass")
bot = botlib.Bot(creds)
PREFIX = '!'
@bot.listener.on_message_event
async def echo(room, message):
match = botlib.MessageMatch(room, message, bot, PREFIX)
if match.is_not_from_this_bot() and match.prefix() and match.command( "echo"):
response = " ".join(arg for arg in match.args())
await bot.api.send_text_message(room.room_id, response)
bot.run()
A thank you to HarHarLinks for their contributions to version 2.4.1!
- (Documentation) Added missing
await
statements to several examples - (Documentation) Added additional clarification on using the
m.notice
msgtype
- (Documentation) Used Markdown instead of HTML to display a specific link
- None
- None
Version 2.4.0 provides several new features and a fix. A thank you to HarHarLinks for their contributions to version 2.4.0! Example usage is shown below:
import simplematrixbotlib as botlib
creds = botlib.Creds("https://home.server", "user", "pass")
bot = botlib.Bot(creds)
PREFIX = '!'
@bot.listener.on_message_event
async def echo(room, message):
match = botlib.MessageMatch(room, message, bot, PREFIX)
if match.is_not_from_this_bot() and match.prefix() and match.command(
"echo"):
response = " ".join(arg for arg in match.args())
await bot.api.send_text_message(room.room_id, response, "m.notice") ## Uses the msgtype of m.notice instead of m.text
bot.run()
- Newlines are now supported when sending markdown messages.
- The msgtype of text and markdown messages can now be specified. Text and markdown messages can now optionally be sent as
m.notice
to avoid alerting everybody of the new message. The default msgtype will continue to bem.text
.
- Fixed issue where the homeserver was hardcoded in an http request.
- None
- None
Version 2.3.0 adds support for additional configuration via config files and other methods. Currently, there is only one setting that can be changed, however many existing and future features will be able to be enabled or disabled via this config. Example usage is shown below:
"""
random_user
!echo something
echo_bot
something
"""
import simplematrixbotlib as botlib
creds = botlib.Creds("https://home.server", "user", "pass")
config = botlib.Config()
config.load_toml("config.toml")
bot = botlib.Bot(creds, config)
PREFIX = '!'
@bot.listener.on_message_event
async def echo(room, message):
match = botlib.MessageMatch(room, message, bot, PREFIX)
if match.is_not_from_this_bot() and match.prefix() and match.command("echo"):
await bot.api.send_text_message(room.room_id,
" ".join(arg for arg in match.args()))
bot.run()
An example of a toml config file is shown below:
[simplematrixbotlib.config]
join_on_invite = false
- Configuration via config files and other methods.
- None
- None
- None
In addition to username/access_token, it is possible to authenticate using username/password and login(SSO) token. Example usage is shown below:
"""
Example Usage:
random_user
!echo something
echo_bot
something
"""
import simplematrixbotlib as botlib
creds = botlib.Creds(
homeserver="https://example.org",
username="echo_bot",
access_token="syt_c2...DTJ",
)
bot = botlib.Bot(creds)
PREFIX = '!'
@bot.listener.on_message_event
async def echo(room, message):
match = botlib.MessageMatch(room, message, bot, PREFIX)
if match.is_not_from_this_bot() and match.prefix() and match.command(
"echo"):
await bot.api.send_text_message(room.room_id,
" ".join(arg for arg in match.args()))
bot.run()
- Aauthentication via access_tokens
- None
- None
- None
Example usage is shown below:
#### Respond to all messages from users with a hello world message that involves markdown formatting
import simplematrixbotlib as botlib
creds = botlib.Creds("https://home.server", "user", "pass")
bot = botlib.Bot(creds)
@bot.on_message_event
async def hello_world_md(room, message):
match = botlib.MessageMatch(room, message, bot)
markdown_message = "# Hello World from [simplematrixbotlib](https://github.com/i10b/simplematrixbotlib)!"
if match.is_not_from_this_bot():
await bot.api.send_markdown_message(
room_id=room.room_id,
message=markdown_message)
bot.run()
- Send messages formatted in markdown via the
Bot.api.send_markdown_message()
method.
- None
- None
- None
The second major version of the simplematrixbotlib package has been released. Example usage is shown below:
#### echo.py
#### Example:
#### randomuser - "!echo example string"
#### echo_bot - "example string"
import simplematrixbotlib as botlib
creds = botlib.Creds("https://home.server", "echo_bot", "pass")
bot = botlib.Bot(creds)
PREFIX = '!'
@bot.listener.on_message_event
async def echo(room, message):
match = botlib.MessageMatch(room, message, bot, PREFIX)
if match.is_not_from_this_bot() and match.prefix() and match.command("echo"):
await bot.api.send_text_message(
room.room_id, " ".join(arg for arg in match.args())
)
bot.run()
Bot.listener
Listener.on_message_event
Listener.on_custom_event
Listener.on_startup
MessageMatch.args
MessageMatch.is_from_userid
- Login via login_token
- Rename
MessageMatch.not_from_this_bot
toMessageMatch.is_not_from_this_bot
MessageMatch.command
Return string if no arguments passed
Bot.add_message_listener
Bot.add_startup_action
- None
Final release of v1
- None
- Fix dependency error upon package installation
- None
- None
None
- Sending images via
bot.api.send_image_message
- Fix a bug in which the bot would print the join message twice
- None
- None
None
- None
- Fix extra join message bug
- None
- None
None
- None
- None
- None
- None
No changes to functionality or API
- None
- None
- None
- None
None
Bot.add_startup_action
- Fix getting of joined rooms
- None
- None
None
- Use stored device_name and access_token to login
- Fix decryption of access_token and device_id
- Refactor
Creds
class
- None
- None
None
- None
- Rename
API
class toApi
- Add numpy-style docstrings
- None
- None
None
- None
- Fix inaccurate command matching
- None
- None
None
- None
- Ignore messages sent before bot run
- None
- None
None
- Matching messages via
MessageMatch
class
- None
- None
- None
None
Bot.add_message_listener
API.send_text_message
- None
- None
- None
None
- None
- Implement callbacks into Bot
- Refactor asyncio loop
- None
- None
None
- None
- Add additional keywords to setup.py
- None
- None
Initial Release
- None
- None
- None
- None