Added branches system, updated database, v0.8.0
- Updated to v0.8.0 - Added note about rate limitting to README - Updated examples to work with new callback system - Updated README to describe new callback system correctly - Added branch_bot.py example - Updated database so internal functions are prefixed with underscore now - Replaced MatrixBot.add_room_event_callback with MatrixBot.add_callback - Database schema version is 4 now - Added room state to database to simplify user code - Added RoomStateFilter
This commit is contained in:
@@ -99,26 +99,12 @@ async def main() -> None:
|
||||
max_args=3
|
||||
)
|
||||
|
||||
# callback for message that
|
||||
# 1. are sent not by this bot
|
||||
# 2. do match the command filter
|
||||
bot.add_callback(
|
||||
~SenderIsBotFilter() & command_filter,
|
||||
on_gen_command)
|
||||
|
||||
# callback for message that match the command filter
|
||||
bot.callbacks.add_callback(command_filter, on_gen_command)
|
||||
# callback for new image message
|
||||
bot.add_callback(
|
||||
~SenderIsBotFilter() & MessageTypeFilter(MessageType.IMAGE) & NewMessageFilter(),
|
||||
on_image
|
||||
)
|
||||
|
||||
# callback for message that
|
||||
# 1. are sent not by this bot
|
||||
# 2. are new messages (not edits)
|
||||
bot.add_callback(
|
||||
~SenderIsBotFilter() & BodyExistsFilter() & NewMessageFilter(),
|
||||
on_wrong_message
|
||||
)
|
||||
bot.callbacks.add_callback(MessageTypeFilter(MessageType.IMAGE), on_image)
|
||||
# callback for message that contain body
|
||||
bot.callbacks.add_callback(BodyExistsFilter(), on_wrong_message)
|
||||
|
||||
# run until Ctrl+C
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user