GitXplorerGitXplorer
G

steam-ext-tf2

public
6 stars
1 forks
1 issues

Commits

List of commits on branch main.
Verified
c1c71712e9ac7e0eaf6270ac82b6d54e171a99b7

Add archival notice

GGobot1234 committed a year ago
Unverified
44ddb9a735fcc35bab2bd2671a946acbdb504a8f

Small updates

GGobot1234 committed 2 years ago
Unverified
0bf74b8bca4a452b2e635e9c8c5a265b957edcdb

Target main again

GGobot1234 committed 2 years ago
Unverified
400422d829ef46f4b2e6434d35a8f2653ac396a3

Make APP_ID a constant in protobufs instead of a file

GGobot1234 committed 2 years ago
Verified
3390e3e5333f10e04cda10cbed09d40a912a62dc

Update pyproject.toml

GGobot1234 committed 2 years ago
Unverified
ab6ea133ff5ba29a3a4b734aed2fc2f2981227b4

Merge branch 'main' of https://github.com/Gobot1234/ext.tf2

GGobot1234 committed 2 years ago

README

The README file for this repository.

steam-ext-tf2

NOTE: This library is now included in steam.py V1 and is no longer updated here

An extension to interact with the Team Fortress 2 Game Coordinator for steam.py. tf2.Client and tf2.Bot are steam.Client and commands.Bot subclasses respectively, so whatever you can do with steam/ext.commands you can do with ext.tf2

Installation

To install this extension just run:

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

Example Auto-crafting metal

import steam
from steam.ext import tf2

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


@bot.event
async def on_ready() -> None:
    print("Bot is ready")

    
@bot.event
async def on_trade_accept(trade: steam.TradeOffer) -> None:
    refined_crafted = 0
    backpack = await bot.user.inventory(steam.TF2)
    scrap = backpack.filter_items("Scrap Metal")
    for scrap_triplet in steam.utils.chunk(scrap, 3):
        if len(scrap_triplet) != 3:
            break
        await bot.craft(scrap_triplet)

    backpack = await bot.user.inventory(steam.TF2)
    reclaimed = backpack.filter_items("Reclaimed Metal")
    for reclaimed_triplet in steam.utils.chunk(reclaimed, 3):
        if len(reclaimed_triplet) != 3:
            break
        await bot.craft(reclaimed_triplet)
        refined_crafted += 1

    print(f"Crafted {refined_crafted} Refined Metal")

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