bonk-bot


Namebonk-bot JSON
Version 1.2.4 PyPI version JSON
download
home_pageNone
SummaryPython API wrapper for bonk.io web game.
upload_time2024-06-26 19:23:09
maintainerSafizapi
docs_urlNone
authorSafizapi
requires_python>=3.8
licenseMIT License Copyright (c) 2024 Safizapi Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords bonk bonk.io bots api
VCS
bugtrack_url
requirements python-engineio python-socketio aiohttp requests nest-asyncio pymitter
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # bonk_bot
User-friendly async python framework for writing bots in bonk.io.
Supported python versions: 3.8+
## Features
- API is using async and await for handling several connections and requests at once
- Different bonk.io servers support
- Event-based
## Installing
**Python 3.8 and higher required**

Go to your project's terminal and run the following command:
```
pip install bonk_bot
```
## Bot example
```py
import asyncio

from bonk_bot.BonkBot import bonk_guest_login
from bonk_bot.Game import Game, Player, Message
from bonk_bot.Types import Servers, Modes

bot = bonk_guest_login("Safizapi")
bot.set_main_avatar(None)


@bot.on("game_connect")
async def on_connect(game: Game):
    print(f"Connected game {game.room_name}")


@bot.on("player_join")
async def on_player_join(game: Game, player: Player):
    await game.send_message(f"Hi, {player.username}")


@bot.on("message")
async def on_message(game: Game, message: Message):
    if message.content == "!ping" and not message.author.is_bot:
        await game.send_message("Pong!")


@bot.on("game_disconnect")
async def on_game_disconnect(game: Game):
    print(f"Disconnected from game {game.room_name}")


async def main():
    game = await bot.create_game(name="Cool room", max_players=8, server=Servers.Warsaw())
    await game.set_mode(Modes.Grapple())

    await bot.run()


asyncio.run(main())
```
## Events
- **player_join**: triggered when some player joins the room
- **player_left**: triggered when some player leaves the room
- **player_ready**: triggered when some player presses ready button
- **error**: triggered when some connection error is occures
- **player_team_change**: triggered when some player changes team
- **team_lock**: triggered when host locks teams
- **team_unlock**: triggered when host unlocks teams
- **message**: triggered when some player sends message
- **bot_kick**: triggered when bot is kicked from the game
- **bot_ban**: triggered when bot is banned from the game
- **player_kick**: triggered when some player is kicked from the room
- **player_ban**: triggered when some player is banned from the room
- **mode_change**: triggered when host changes mode
- **player_balance**: triggered when some player is balanced
- **teams_turn_on**: triggered when host turns on teams
- **teams_turn_off**: triggered when host turns off teams
- **host_change**: triggered when game host changes
- **new_room_name**: triggered when host changes room name
- **new_room_password**: triggered when host sets a new password for game
- **room_password_clear**: triggered when host clears game password
- **game_disconnect**: triggered when bot disconnects from the game

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "bonk-bot",
    "maintainer": "Safizapi",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "bonk, bonk.io, bots, api",
    "author": "Safizapi",
    "author_email": null,
    "download_url": null,
    "platform": null,
    "description": "# bonk_bot\r\nUser-friendly async python framework for writing bots in bonk.io.\r\nSupported python versions: 3.8+\r\n## Features\r\n- API is using async and await for handling several connections and requests at once\r\n- Different bonk.io servers support\r\n- Event-based\r\n## Installing\r\n**Python 3.8 and higher required**\r\n\r\nGo to your project's terminal and run the following command:\r\n```\r\npip install bonk_bot\r\n```\r\n## Bot example\r\n```py\r\nimport asyncio\r\n\r\nfrom bonk_bot.BonkBot import bonk_guest_login\r\nfrom bonk_bot.Game import Game, Player, Message\r\nfrom bonk_bot.Types import Servers, Modes\r\n\r\nbot = bonk_guest_login(\"Safizapi\")\r\nbot.set_main_avatar(None)\r\n\r\n\r\n@bot.on(\"game_connect\")\r\nasync def on_connect(game: Game):\r\n    print(f\"Connected game {game.room_name}\")\r\n\r\n\r\n@bot.on(\"player_join\")\r\nasync def on_player_join(game: Game, player: Player):\r\n    await game.send_message(f\"Hi, {player.username}\")\r\n\r\n\r\n@bot.on(\"message\")\r\nasync def on_message(game: Game, message: Message):\r\n    if message.content == \"!ping\" and not message.author.is_bot:\r\n        await game.send_message(\"Pong!\")\r\n\r\n\r\n@bot.on(\"game_disconnect\")\r\nasync def on_game_disconnect(game: Game):\r\n    print(f\"Disconnected from game {game.room_name}\")\r\n\r\n\r\nasync def main():\r\n    game = await bot.create_game(name=\"Cool room\", max_players=8, server=Servers.Warsaw())\r\n    await game.set_mode(Modes.Grapple())\r\n\r\n    await bot.run()\r\n\r\n\r\nasyncio.run(main())\r\n```\r\n## Events\r\n- **player_join**: triggered when some player joins the room\r\n- **player_left**: triggered when some player leaves the room\r\n- **player_ready**: triggered when some player presses ready button\r\n- **error**: triggered when some connection error is occures\r\n- **player_team_change**: triggered when some player changes team\r\n- **team_lock**: triggered when host locks teams\r\n- **team_unlock**: triggered when host unlocks teams\r\n- **message**: triggered when some player sends message\r\n- **bot_kick**: triggered when bot is kicked from the game\r\n- **bot_ban**: triggered when bot is banned from the game\r\n- **player_kick**: triggered when some player is kicked from the room\r\n- **player_ban**: triggered when some player is banned from the room\r\n- **mode_change**: triggered when host changes mode\r\n- **player_balance**: triggered when some player is balanced\r\n- **teams_turn_on**: triggered when host turns on teams\r\n- **teams_turn_off**: triggered when host turns off teams\r\n- **host_change**: triggered when game host changes\r\n- **new_room_name**: triggered when host changes room name\r\n- **new_room_password**: triggered when host sets a new password for game\r\n- **room_password_clear**: triggered when host clears game password\r\n- **game_disconnect**: triggered when bot disconnects from the game\r\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2024 Safizapi  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "Python API wrapper for bonk.io web game.",
    "version": "1.2.4",
    "project_urls": {
        "Repository": "https://github.com/Safizapi/bonk_bot"
    },
    "split_keywords": [
        "bonk",
        " bonk.io",
        " bots",
        " api"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0608d76cff2d93f35f4326184cb3a62a3aaa0d6fe3f89c4df385b360df6de895",
                "md5": "edfc293da3d11429017f776ed05f7ee7",
                "sha256": "19ad8f616b3d774be4eb8f717339c7063043c783b060f12a66785bee6eadfd84"
            },
            "downloads": -1,
            "filename": "bonk_bot-1.2.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "edfc293da3d11429017f776ed05f7ee7",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 20474,
            "upload_time": "2024-06-26T19:23:09",
            "upload_time_iso_8601": "2024-06-26T19:23:09.807988Z",
            "url": "https://files.pythonhosted.org/packages/06/08/d76cff2d93f35f4326184cb3a62a3aaa0d6fe3f89c4df385b360df6de895/bonk_bot-1.2.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-26 19:23:09",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Safizapi",
    "github_project": "bonk_bot",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "python-engineio",
            "specs": [
                [
                    "==",
                    "3.14.2"
                ]
            ]
        },
        {
            "name": "python-socketio",
            "specs": [
                [
                    "==",
                    "4.6.0"
                ]
            ]
        },
        {
            "name": "aiohttp",
            "specs": [
                [
                    "==",
                    "3.9.5"
                ]
            ]
        },
        {
            "name": "requests",
            "specs": [
                [
                    "==",
                    "2.32.3"
                ]
            ]
        },
        {
            "name": "nest-asyncio",
            "specs": [
                [
                    "==",
                    "1.6.0"
                ]
            ]
        },
        {
            "name": "pymitter",
            "specs": [
                [
                    "==",
                    "0.5.1"
                ]
            ]
        }
    ],
    "lcname": "bonk-bot"
}
        
Elapsed time: 0.31107s