Skip to main content

A economy plugin for nonebot 2

Project description

NoneBotPluginLogo

NoneBotPluginText

nonebot-plugin-chikari-economy

✨ NoneBot 经济插件(库) ✨

license pypi python

📖 介绍

一个经济插件(库),可由其他插件调用,以便插件间的经济联动

💿 安装

使用 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

nonebot_plugin_chikari_economy-0.0.7.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file nonebot_plugin_chikari_economy-0.0.7.tar.gz.

File metadata

File hashes

Hashes for nonebot_plugin_chikari_economy-0.0.7.tar.gz
Algorithm Hash digest
SHA256 cb0dfd1d30d242a3881c829acfdd828b0d0590da4ce081b3564b6c4a2703c4a3
MD5 97d1898d04782b4a01bd9c9007e1abb2
BLAKE2b-256 9e18bda29cbbb23bfce72be00b83bd5157fbe2fb3f39f2eadd208de4e5661361

See more details on using hashes here.

File details

Details for the file nonebot_plugin_chikari_economy-0.0.7-py3-none-any.whl.

File metadata

File hashes

Hashes for nonebot_plugin_chikari_economy-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 d9003d91321c3203b4b8680f663e06f6b9aaee3a030efe90ac71bd015ea001fe
MD5 56a92c55f3c0610192c1c2ac6fc0c12f
BLAKE2b-256 1c7d90d688af67648bfff2d605dadcb0e7201238c01479314f391199988ab386

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page