跳转到主要内容

Steam API的Python封装

项目描述

steam.py

A modern, easy to use, and async ready package to interact with the Steam API. Heavily inspired by discord.py.

Supports Version License GitHub issues GitHub stars Discord Documentation Status

主要功能

  • 使用 async/await 语法编写的现代Pythonic API
  • 命令扩展以帮助创建机器人
  • 具有面向对象设计,易于使用
  • 完全类型提示,以加快开发速度

安装

需要Python 3.10或更高版本

要安装库,请运行以下命令之一

# Linux/macOS
python3 -m pip install -U steamio
# Windows
py -m pip install -U steamio

或者对于开发版本。

# Linux/macOS
python3 -m pip install -U "steamio @ git+https://github.com/Gobot1234/steam.py@main"
# Windows
py -m pip install -U "steamio @ git+https://github.com/Gobot1234/steam.py@main"

快速示例

import steam


class MyClient(steam.Client):
    async def on_ready(self) -> None:
        print("Logged in as", self.user)

    async def on_trade(self, trade: steam.TradeOffer) -> None:
        if not trade.is_our_offer():
            await trade.user.send("Thank you for your trade")
            print(f"Received trade: #{trade.id}")
            print("Trade partner is:", trade.user)
            print("We would send:", len(trade.sending), "items")
            print("We would receive:", len(trade.receiving), "items")

            if trade.is_gift():
                print("Accepting the trade as it is a gift")
                await trade.accept()


client = MyClient()
client.run("username", "password")

机器人示例

from steam.ext import commands

bot = commands.Bot(command_prefix="!")


@bot.command
async def ping(ctx: commands.Context) -> None:
    await ctx.send("Pong!")


bot.run("username", "password")

链接

项目详情


下载文件

下载适用于您的平台的文件。如果您不确定选择哪个,请了解更多关于 安装包 的信息。

源代码分发

steamio-1.0.1.tar.gz (358.6 kB 查看哈希值)

上传时间 源代码

构建分发

steamio-1.0.1-cp311-cp311-macosx_14_0_arm64.whl (417.1 kB 查看哈希值)

上传时间 CPython 3.11 macOS 14.0+ ARM64

支持者