Releases: jykob/TSBot
1.5.0
What's Changed
Task args
You can now pass args to tasks.
Arguments are positional only and type safe.
async def background_task(bot: TSBot, arg1: str, arg2: int) -> None:
print(arg1, arg2)
# Some background task
bot.register_task(background_task, "test arg", 1)
Better typing support
Command handler overloads
Command handlers are just a little bit more type safe. For example, if you define a raw command handler and have more than 1 additional argument, your editor should yell at you.
Typed events and ctx overloads
Your editor should give smart suggestions about the event_type
and their context types.
Full Changelog: 1.4.1...1.5.0
1.4.1
What's Changed
Tasks exceptions
Before exceptions raised inside tasks would pass silently.
Errors should never pass silently.
-- The Zen of Python
Tasks that exit with an exception will log the exception when TSBot cleans up the task
PR: #56
Better default ports
Raw connection type would require you to set port manually.
If you don't configure the port, TSBot will infer the port from the protocol.
PR: #57
Full Changelog: 1.4.0...1.4.1
1.4.0
Features
Raw connections
With the new connection system (#50) came simple way to implement different connection types.
The PR hinted a possibility of raw connections. Now raw connections have been implemented.
You can configure TSBot to use raw connections when defining TSBot
instance:
bot = TSBot(
username="USERNAME",
password="PASSWORD",
address="ADDRESS",
port=10011, # Important! The default port is 10022, the port for SSH.
protocol="raw"
)
Full PR #55
Full Changelog: 1.3.2...1.4.0
1.3.2
1.3.1
1.3.0
Release 1.3.0
❗❗ Deprecation warning ❗❗
ready
event is deprecated. Use connect
instead.
When registering event handlers, change event to connect
@bot.on("connect")
async def ...
Features
Connection refactor
All the connection related code has been moved off of bot.TSBot
to connection
package.
TSConnection
will try to upkeep connection to the server.
If the connection goes down for what ever reason, the bot will try to establish new connection.
This behavior can be configured via TSBot
arguments:
connection_retries
: How many connection attemps allowed.connection_retry_timeout
: How long between each connection attemps.
New events
With new connection behavior comes new events:
connect
: Works the same as old ´ready´ event, which is now deprecated.disconnect
: Emitted when connection is lost.reconnect
: Emitted when connection is lost and regained.
New TSBot
instance variables
Some useful information about the current bot instance has been added.
New instance variables:
bot.clid
: bots current client id.bot.cldbid
: bots server database id.bot.uid
: bots uid.
These can come handy when e.g. moving the bot to another channel.
Commands self check changes
Previously the bot was checking its uid
against invokers uid
.
This has been changed to the clid
(client_id). issue: #47 pr: #49