{"id":21433,"library":"hikari","title":"Hikari","description":"Hikari is an asyncio-native Discord API wrapper for Python 3.10+ (Python 3.14 compatible via <3.15 constraint). As of v2.5.0, it provides both REST and gateway (WebSocket) APIs with a model-first design. The library replaces the older lightbulb command framework with first-class interaction support. Breaking changes between 2.x minor versions mainly involve gateway event handling and model attribute casing.","status":"active","version":"2.5.0","language":"python","source_language":"en","source_url":"https://github.com/hikari-py/hikari","tags":["discord","api","asyncio","bot"],"install":[{"cmd":"pip install hikari","lang":"bash","label":"Standard install"},{"cmd":"pip install hikari[server] hikari[toolbox]","lang":"bash","label":"Optional extras for HTTP server and CLI tools"}],"dependencies":[{"reason":"HTTP client for REST API","package":"aiohttp","optional":false},{"reason":"DNS resolution (recommended on Linux)","package":"aiodns","optional":true},{"reason":"Fast JSON serialization","package":"orjson","optional":true}],"imports":[{"note":"Top-level exports changed in v2; the legacy impl submodule is still available but not recommended.","wrong":"from hikari.impl import RESTApp","symbol":"RESTApp","correct":"from hikari import RESTApp"},{"note":"Same as RESTApp, prefer top-level.","wrong":"from hikari.impl import GatewayBot","symbol":"GatewayBot","correct":"from hikari import GatewayBot"},{"note":"Bitwise intents enum merged into top-level in v2.","symbol":"Intents","correct":"from hikari import Intents"},{"note":"Events are accessed via the hikari.events module.","symbol":"events","correct":"import hikari.events as events"}],"quickstart":{"code":"import asyncio\nimport os\nimport hikari\n\nbot = hikari.GatewayBot(token=os.environ.get('DISCORD_TOKEN', ''))\n\n@bot.listen()\nasync def on_message(event: hikari.events.MessageCreateEvent) -> None:\n    if event.content and event.content.startswith('!ping'):\n        await event.message.respond('Pong!')\n\nif __name__ == '__main__':\n    bot.run()","lang":"python","description":"Simple bot that responds to !ping with Pong! using GatewayBot."},"warnings":[{"fix":"Use an async function or a callable class that can be awaited.","message":"GatewayBot.listen() no longer accepts a lambda as the event handler in v2.5. Use an async function or a callable class.","severity":"breaking","affected_versions":">=2.5.0"},{"fix":"Move cache configuration from a cache component to the GatewayBot constructor, e.g., bot = GatewayBot(token=..., cache=hikari.CacheSettings(...)).","message":"Cache configuration has changed in v2.5.0: the cache is now passed via the 'cache' parameter of GatewayBot or RESTBot, not via a separate component.","severity":"breaking","affected_versions":">=2.5.0"},{"fix":"Replace .mention with .user_mentions for user mentions or .role_mention_ids for role mentions.","message":"hikari.Message.mention field is deprecated, use hikari.Message.user_mentions or hikari.Message.role_mention_ids.","severity":"deprecated","affected_versions":">=2.5.0"},{"fix":"Use the bot as a context manager (async with bot:) or call bot.close() on shutdown.","message":"RESTBot and GatewayBot require aiohttp session management; do not create multiple sessions without closing previous ones (resource leak).","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Ensure you have hikari>=2.0.0 installed: pip install hikari --upgrade","cause":"Attempting to import from 'hikari' directly in an older version where the classes were in 'hikari.impl'.","error":"ImportError: cannot import name 'GatewayBot' from 'hikari'"},{"fix":"Replace the lambda with an async function.","cause":"Passing a lambda as event handler to bot.listen() in hikari>=2.5.0, which requires a coroutine function.","error":"TypeError: object NoneType can't be used in 'await' expression (attempting to use lambda)"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}