A economy plugin for nonebot 2
Project description
📖 介绍
一个经济插件(库),可由其他插件调用,以便插件间的经济联动
💿 安装
使用 nb-cli 安装
在 nonebot2 项目的根目录下打开命令行, 输入以下指令即可安装nb plugin install nonebot-plugin-chikari-economy
使用包管理器安装
在 nonebot2 项目的插件目录下, 打开命令行, 根据你使用的包管理器, 输入相应的安装命令pip
pip install nonebot-plugin-chikari-economy
pdm
pdm add nonebot-plugin-chikari-economy
poetry
poetry add nonebot-plugin-chikari-economy
conda
conda install nonebot-plugin-chikari-economy
打开 nonebot2 项目根目录下的 pyproject.toml 文件, 在 [tool.nonebot] 部分追加写入
plugins = ["nonebot_plugin_chikari_economy"]
🎉 使用
开发者
你可以通过以下方法使用本插件的功能
require("nonebot_plugin_chikari_economy")
import nonebot_plugin_chikari_economy
def_money_type
def def_money_type(id: str,name: str,description: str):
"""定义一种新的货币种类
不使用此方法定义货币直接使用可能会出现意料之外的错误
id相同时,新的定义会覆盖旧的定义,但已有的货币量不变
Args:
id (str): 货币的id,不同的id会视为不同的货币
name (str): 货币的名字
description (str): 货币的描述
Returns:
tuple: 一个二元组,应当为(name, description)
"""
set_money
def set_money(uid: str,id: str,value: float):
"""设置用户的某种货币数量
Args:
uid (str): 用户id
id (str): 货币id
value (float): 货币要设置成的值
Returns:
float: 货币设置后的值
"""
add_money
def add_money(uid: str,id: str,value: float):
"""增加(或减少)用户的某种货币数量
Args:
uid (str): 用户id
id (str): 货币id
value (float): 货币要增加(负数为减少)的值
Returns:
float: 货币增加(或减少)后的值
"""
inquire_money
def inquire_money(uid: str,id: str):
"""查询用户的某种货币数量
Args:
uid (str): 用户id
id (str): 货币id
Returns:
float: 货币当前数量
"""
指令表
| 指令 | 权限 | 需要@ | 范围 | 说明 |
|---|---|---|---|---|
| Chikari_economy_inquire_one_money | 群员 | 否 | 群聊 | 内置的单种货币查询指令,一般不建议使用 |
| Chikari_economy_inquire_all_money | 群员 | 否 | 群聊 | 内置的所有货币查询指令,一般不建议使用 |
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nonebot_plugin_chikari_economy-0.0.7.tar.gz.
File metadata
- Download URL: nonebot_plugin_chikari_economy-0.0.7.tar.gz
- Upload date:
- Size: 5.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cb0dfd1d30d242a3881c829acfdd828b0d0590da4ce081b3564b6c4a2703c4a3
|
|
| MD5 |
97d1898d04782b4a01bd9c9007e1abb2
|
|
| BLAKE2b-256 |
9e18bda29cbbb23bfce72be00b83bd5157fbe2fb3f39f2eadd208de4e5661361
|
File details
Details for the file nonebot_plugin_chikari_economy-0.0.7-py3-none-any.whl.
File metadata
- Download URL: nonebot_plugin_chikari_economy-0.0.7-py3-none-any.whl
- Upload date:
- Size: 6.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d9003d91321c3203b4b8680f663e06f6b9aaee3a030efe90ac71bd015ea001fe
|
|
| MD5 |
56a92c55f3c0610192c1c2ac6fc0c12f
|
|
| BLAKE2b-256 |
1c7d90d688af67648bfff2d605dadcb0e7201238c01479314f391199988ab386
|