Changelogs
Last updated
Was this helpful?
Last updated
Was this helpful?
Redesigned the objects
Removed BaseObject
class
Flags
object has been renamed to JokeFlags
Added language
alias for Joke.lang
All objects are now frozen dataclasses which means they are now immutable and are read-only.
All objects now have proper __repr__
attributes
Entire library is now properly typehinted. Thanks to for their contributions in typehinting the library.
Moved get_safe_joke
from utils module to Client
and AsyncClient
classes. Thanks to
Client now works with async context manager. Thanks to
AsyncClient
now raises a new error UnsupportedUsage
on exiting context manager. Thanks to
Added support for /weather
endpoint. You can now fetch weathers easily using get_weather
methods.
Added get_weather
in both client classes
Added four new classes Weather
, CurrentWeather
, WeatherLocation
, WeatherForecast
Added new error, InvalidCityError
raised upon invalid city provided in get_weather
method.
Restructured the library's data classes
All the data classes now inherit from a super class called BaseObject
Restructured the Exceptions hierarchy
Restructured library files
All data classes are now in a single module object
Deprecated version 2 of API
Added support for version 4
Version 3 usage now triggers console warnings
AI method now uses kwargs due to change in parameters for version 4 and 3.
Added initial support for v4 beta
get_joke methods in both Client and AsyncClient classes now return correct link.
Warning added for v4 beta.
Added support for unique_key
query on /ai/response
.
New module randomstuff.utils
utils.generate_unique_id
is a new method used to generate secure unique IDs.
Added support for bot_name
and dev_name
queries on /ai/response
.
get_ai_response()
take optional arguments dev_name
and bot_name
which determines developer name and bot name respectively.
Added warnings.
You are now warned when initialising client with version='2'
.
Add suppress_warnings
optional argument in clients that determines whether you get console warnings or not.
All methods and classes now raise errors.AuthError
when invalid API key is passed.
Same for unauthorised plan in get_ai_response()
get_joke()
works properly now.
Add support for v2
Client
and AsyncClient
now take version
argument that determines the API version
Added support for plans
get_ai_response()
now takes plan
argument which determines the plan to use.
Fixed minor bugs
Initial Release
AI response now is wrapped into a class called to stay even with new responses from version 4 AI response endpoint.
New Exception sub class: for 500s errors. Credits to
Added new Exception sub class: .
VersionError
,PlanError
and ServerError
are changed to , and that are now inherited from .
Added Exception
class:
Added two sub-classes of : and
now has proper default version. ()
utils.generate_unique_id
now is called (As per version 4.) ()
Added errors.HTTPError
class for 500s statuses. ()
now properly inherits from ()
Added method to format a "two-part" joke into custom (human readable) format.
Added method to filter or ignore any unsafe joke.
Warnings now have certain colours using Unicode. Credits to
get_ai_response_beta()
argument added with different parameters names as default method. This is use able only with v4 beta. See
get_ai_response()
take optional argument unique_id
which is used to chat with a certain key. See page for more info.