boticordpy/README.md

92 lines
2.4 KiB
Markdown
Raw Normal View History

2022-02-17 19:14:39 +03:00
<p align="center">
2023-08-05 17:52:25 +03:00
<img width="560" src="https://cdn.discordapp.com/attachments/712173636181557272/1137397261677109298/bcpy.png" alt="">
2022-02-17 19:14:39 +03:00
</p>
2021-08-24 21:20:10 +03:00
2022-02-17 19:14:39 +03:00
<p align="center">
<b>
2022-02-26 10:09:26 +03:00
The easiest way to use BotiCord API in Python.
2022-02-17 19:14:39 +03:00
<span> · </span>
<a href="https://py.boticord.top/">Docs</a>
</b>
</p>
<p align="center">
<a href="https://pypi.org/project/boticordpy/"><img src="https://img.shields.io/pypi/dm/boticordpy?style=flat-square" alt=""></a>
<a href="https://pypi.org/project/boticordpy/"><img src="https://img.shields.io/pypi/v/boticordpy?style=flat-square" alt=""></a>
<a href="https://py.boticord.top/"><img src="https://img.shields.io/readthedocs/boticordpy?style=flat-square" alt=""></a>
</p>
<h2>Features</h2>
2022-02-17 19:16:17 +03:00
2022-02-17 19:14:39 +03:00
* Object-oriented
2022-02-26 10:09:26 +03:00
* Full BotiCord API Coverage
2022-02-17 19:14:39 +03:00
* Modern Pythonic API using `async`/`await` syntax
2023-06-27 18:26:42 +03:00
* BotiCord Websocket
2022-04-22 11:36:17 +03:00
* It is not necessary to use any particular library used to interact with the Discord API.
2022-02-17 19:14:39 +03:00
<h2>Installation</h2>
2023-06-27 18:26:42 +03:00
<b>Python 3.8 or newer is required.</b>
2022-02-17 19:14:39 +03:00
Enter one of these commands to install the library:
```
2022-02-26 10:09:26 +03:00
pip install boticordpy
2022-02-17 19:14:39 +03:00
```
```
2022-02-26 10:09:26 +03:00
python3 -m pip install boticordpy
2022-02-17 19:14:39 +03:00
```
Or just clone the repo: https://github.com/boticord/boticordpy
<h2>Examples</h2>
You can find other examples in an examples folder.
**Discord.py Autopost example**
```py
2022-02-26 10:09:26 +03:00
from discord.ext import commands
from boticordpy import BoticordClient
2022-02-17 19:14:39 +03:00
2022-02-26 10:09:26 +03:00
bot = commands.Bot(command_prefix="!")
2022-02-17 19:14:39 +03:00
2023-06-27 18:26:42 +03:00
# Function that will return the current bot's stats.
2022-02-26 10:09:26 +03:00
async def get_stats():
2023-08-06 09:28:27 +03:00
return {"servers": len(bot.guilds), "shards": None, "members": len(bot.users)}
2022-02-17 19:14:39 +03:00
2023-06-27 18:26:42 +03:00
# Function that will be called if stats are posted successfully.
2022-02-26 10:09:26 +03:00
async def on_success_posting():
2023-06-27 18:26:42 +03:00
print("wow stats posting works")
2022-02-17 19:14:39 +03:00
2023-06-27 18:26:42 +03:00
boticord_client = BoticordClient(
"your_boticord_api_token", version=3
) # <--- BotiCord API token
2022-02-26 10:09:26 +03:00
autopost = (
boticord_client.autopost()
.init_stats(get_stats)
.on_success(on_success_posting)
2023-06-27 18:26:42 +03:00
.start("id_of_your_bot") # <--- ID of your bot
2022-02-26 10:09:26 +03:00
)
2022-02-17 19:14:39 +03:00
2023-06-27 18:26:42 +03:00
bot.run("bot token") # <--- Discord bot's token
2022-02-17 19:14:39 +03:00
```
<h2>Links</h2>
* [PyPi](https://pypi.org/project/boticordpy)
* [Documentation](https://py.boticord.top)
* [Github](https://github.com/boticord/boticordpy)
2022-02-26 10:09:26 +03:00
* [BotiCord](https://boticord.top/)
2022-02-18 18:58:18 +03:00
* [Support](https://boticord.top/discord)
2022-02-17 19:14:39 +03:00
<h2>Help</h2>
2022-02-26 10:09:26 +03:00
If You need any help we recommend you to check the documentation. You can find us [here](https://bcord.cc/support). Main developer is **[Marakarka](https://boticord.top/profile/585766846268047370)**