Metadata-Version: 2.4
Name: nios-bot
Version: 0.1.4
Summary: Асинхронный клиент для NiosMess Bot Api
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: httpx>=0.20.0
Dynamic: license-file

# NiosBot

Hey guys! Welcome to the NiosBot API guide. This async library is super easy to use for building awesome bots on NiosMess. Let's dive right in!

## 1. Getting Ur Token
First things first, u need a token to connect ur bot. U can grab one right here: https://ni-os.ru/u/BotCreator. Pls keep it safe and private!

## 2. Installation
Just open up ur terminal and run:
`pip install nios-bot==0.1.4`
It's latest version of nios-bot with a lot of fixed bugs;

## 3. Quick Start & Basics
This library runs asynchronously and uses `httpx` under the hood to handle requests[cite: 1]. By default, it connects to the base URL `https://ni-os.ru/bot-api`[cite: 1]. 

Here is a quick example of how to start ur bot and make it echo messages back[cite: 1]:

```python
import asyncio
from nios_bot import NiosBot

# Initialize the bot with ur token
bot = NiosBot(token="your_token_here")

# Register a message handler
@bot.message_handler()
async def echo(message):
    chat_id = message["chat"]["id"]
    text = message.get("text", "")
    # Send the message back to the chat
    await bot.send_message(chat_id=chat_id, text=f"U just said: {text}")

async def main():
    # Start the polling loop so the bot listens for updates
    await bot.start_polling()

if __name__ == "__main__":
    asyncio.run(main())
```

## 4. Available Methods
The `NiosBot` class provides several handy methods to interact with the API[cite: 1]:

* **Get Bot Info**: Call `await bot.get_me()` to get info about ur bot[cite: 1].
* **Send Messages**: Use `await bot.send_message(chat_id, text)` to send a text[cite: 1]. U can also pass an optional `reply_markup` dictionary or `reply_to_message_id`[cite: 1].
* **Edit Keyboards**: Need to update an inline keyboard? Use `await bot.edit_message_reply_markup(chat_id, message_id, reply_markup)`[cite: 1].
* **Delete Messages**: Remove a message using `await bot.delete_message(chat_id, message_id)`[cite: 1].
* **Chat Info**: Retrieve details about a specific chat with `await bot.get_chat(chat_id)`[cite: 1].
* **Member Info**: Check on a specific user in a chat via `await bot.get_chat_member(chat_id, user_id)`[cite: 1].

## 5. Handling Callback Queries
If ur bot uses inline keyboards, u will need to handle those button clicks. U can do this easily using the callback query decorator[cite: 1]:

```python
@bot.callback_query_handler()
async def handle_button_click(callback):
    callback_id = callback["id"]
    
    # Always remember to answer the callback query!
    await bot.answer_callback_query(callback_query_id=callback_id, text="Action completed!")
```

Note: It is super important to call `await bot.answer_callback_query()` so the button doesn't just spin forever and show a loading state[cite: 1]. The `text` parameter is totally optional, but it's really useful for showing small pop-up notifications to the user[cite: 1].

Hope this helps u build something amazing!
