Skip to content

Commit

Permalink
Merge pull request #13 from offish/v2.0.0
Browse files Browse the repository at this point in the history
v2.0.0
  • Loading branch information
offish authored Oct 29, 2023
2 parents dac2563 + 671faea commit 0eec359
Show file tree
Hide file tree
Showing 33 changed files with 1,458 additions and 900 deletions.
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
__pycache__
.vscode
config.json
logs
include
lib
Scripts
bin
pyvenv.cfg
lib64
*.log
*.bat
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020 offish
Copyright (c) 2020-2023 offish

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
181 changes: 121 additions & 60 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,93 +6,154 @@
[![Discord](https://img.shields.io/discord/467040686982692865?color=7289da&label=Discord&logo=discord)](https://discord.gg/t8nHSvA)
[![Code style](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

[![Donate Steam](https://img.shields.io/badge/donate-steam-green.svg)](https://steamcommunity.com/tradeoffer/new/?partner=293059984&token=0-l_idZR)
[![Donate PayPal](https://img.shields.io/badge/donate-paypal-blue.svg)](https://www.paypal.me/0ffish)
Automated <abbr title="Team Fortress 2">TF2</abbr> trading bot with GUI support, built with Python. Prices are by default provided by [Prices.TF](https://prices.tf).

## Donate
Donations are not required, but greatly appericated.
- BTC: `bc1qntlxs7v76j0zpgkwm62f6z0spsvyezhcmsp0z2`
- [Steam Trade Offer](https://steamcommunity.com/tradeoffer/new/?partner=293059984&token=0-l_idZR)

Automated trading bot for Team Fortress 2 using prices provided by [Prices.TF](https://prices.tf).

## Features
* Automatic pricing from [Prices.TF](https://prices.tf)
* Basic website GUI (going to be updated)
* Uses MongoDB for saving/getting prices and trades
* Support for running multiple bots at once
* Accepts offer(s) sent by owner
* Supports both Non-Craftable and Craftable items
* Supports Random Craft Hats
* Supports options listed in [`settings.py`](express/settings.py)
* Saves trade data after trade has gone through
* Colored and readable logging
* Automated item pricing by [Prices.TF](https://prices.tf)
* GUI for adding items, changing prices and browsing trades
* Bank as many items as you want

Backpack.tf listing might be added in the future.

## Screenshots
![GUI](https://user-images.githubusercontent.com/30203217/120229592-c2b76000-c24d-11eb-8d23-725556925ba3.png)
![Screenshot](https://user-images.githubusercontent.com/30203217/99878862-a2587a00-2c08-11eb-9211-8c8ac86821e6.png)
* Add items by name or SKU
* Uses MongoDB for saving items, prices and trades
* Supports Random Craft Hats [[?]](#random-craft-hats)
* Run multiple bots at once, each with their own database
* Supports SKU item formats for ease of use
* Supports 3rd party inventory providers [[?]](#3rd-party-inventory-providers)
* Utilizes [tf2-sku](https://github.com/offish/tf2-sku)
* Utilizes [tf2-data](https://github.com/offish/tf2-data)
* Utilizes [tf2-utils](https://github.com/offish/tf2-utils)

*Backpack.tf listing is not supported yet.*

## Showcase
![GUI Prices](https://github.com/offish/tf2-express/assets/30203217/31dbe594-877b-486c-b06e-a243bcbce34c)
![GUI Trades](https://github.com/offish/tf2-express/assets/30203217/7a5225a8-cbd6-4e12-b703-1bf9e0d0d674)
![tf2-express](https://github.com/offish/tf2-express/assets/30203217/c32d6c2e-b59d-4923-97e7-8ba7cf5f8640)

## Installation
Download the repository, navigate to the folder, and install the required packages.
Full installation guide can be found on the [wiki](https://github.com/offish/tf2-express/wiki).

```
pip install -r requirements.txt
If MongoDB is already installed, it should be fairly straight forward.

```bash
git clone [email protected]:offish/tf2-express.git
cd tf2-express
pip install -r requirements.txt
```

## Setup
Configure the `bots` variable inside the [`config.py`](express/config.py) file. Here you need to add your bots credentials.
Rename `config.example.json` to `config.json`. Update credentials and set your preferred `options`.

Example config:
```json
{
"name": "Bot 1",
"username": "steam-username",
"password": "steam-password",
"api_key": "api-key",
"secrets": {
"steamid": "steam-id-64",
"shared_secret": "sharedsecret=",
"identity_secret": "identitysecret="
}
},
{
"name": "Bot 2",
"username": "steam-username",
"password": "steam-password",
"api_key": "api-key",
"secrets": {
"steamid": "steam-id-64",
"shared_secret": "sharedsecret=",
"identity_secret": "identitysecret="
}
"name": "nickname",
"check_versions_on_startup": true,
"bots": [
{
"name": "bot1",
"username": "username",
"password": "password",
"api_key": "111AA1111AAAA11A1A11AA1AA1AAA111",
"secrets": {
"steamid": "76511111111111111",
"shared_secret": "Aa11aA1+1aa1aAa1a=",
"identity_secret": "aA11aaaa/aa11a/aAAa1a1="
},
"options": {
"accept_donations": true,
"decline_bad_offers": false,
"decline_trade_hold": true,
"decline_scam_offers": true,
"allow_craft_hats": true,
"save_trades": true,
"poll_interval": 30,
"owners": [
"76511111111111111",
"76522222222222222"
]
}
},
{
"name": "bot2",
"username": "username2",
"password": "password2",
"api_key": "111AA1111AAAA11A1A11AA1AA1AAA111",
"secrets": {
"steamid": "76511111111111111",
"shared_secret": "Aa11aA1+1aa1aAa1a=",
"identity_secret": "aA11aaaa/aa11a/aAAa1a1="
},
"options": {
"accept_donations": true,
"decline_bad_offers": false,
"decline_trade_hold": false,
"decline_scam_offers": false,
"allow_craft_hats": false,
"save_trades": true,
"poll_interval": 60,
"database": "bot2database"
}
}
]
}
```
If you're running multiple bots, the variable should look something like this. `Name` is only for logging, this could be whatever you want (username, index, symbol, etc).

You can also change your settings inside the [`settings.py`](express/settings.py) file.
Every option/setting here should be pretty self explanatory.
For more information follow the [wiki](https://github.com/offish/tf2-express/wiki).

```python
accept_donations = True
decline_trade_hold = True
decline_scam_offers = True
allow_craft_hats = True
save_trades = True
## Running
```bash
# tf2-express/
python main.py # start the bot
python panel.py # start the gui
```

After starting the GUI, you can open http://127.0.0.1:5000/ in your browser.

## Running
After you have configured the bot you can run this command. Make sure you're in the correct directory.
```
python main.py
```
Logs will be available under `logs/express.log`.
Level is set to DEBUG, so here you will be able to see every request etc. and more information than is shown in the terminal.

*Do NOT share this log file with anyone else before removing sensitive information. This will leak your `API_KEY` and more.*

To open the GUI run this command while being in the same directory as the [`main.py`](main.py) file, and open http://127.0.0.1:5000 in your browser.
## Updating
```bash
# tf2-express/
git pull
pip install --upgrade -r requirements.txt
# update packages like tf2-utils, tf2-data and tf2-sku,
# which the bot is dependant on
```
python -m express.ui.panel

## Explanation
### Random Craft Hats
If a craftable hat does not have a specific price in the database, it will be viewed as a Random Craft Hat (SKU: -100;6), if `enable_craft_hats` is enabled.

**WARNING:** *This applies to any hat. Such as Ellis' Cap, Team Captain, Earbuds, Max Heads etc. This is a feature, not a bug.*

Simply open the GUI and add "Random Craft Hat" to the pricelist. Set the buy and sell price to whatever you want. This item cannot get automatic price updates.

### 3rd Party Inventory Providers
Avoid Steam's inventory rate-limits by using a third party provider like SteamApis, Steam.supply or your own.

## Testing
```bash
# tf2-express/
python -m unittest
```

## Todo
- [ ] Add stock limits (in stock/max stock)
- [ ] Add BackpackTF listing

## License
MIT License

Copyright (c) 2020 [offish](https://offi.sh)
Copyright (c) 2020-2023 offish

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
8 changes: 4 additions & 4 deletions express/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__title__ = "tf2-express"
__author__ = "offish"
__license__ = "MIT"
__version__ = "1.2.9"
__title__ = "tf2-express"
__author__ = "offish"
__license__ = "MIT"
__version__ = "2.0.0"
58 changes: 0 additions & 58 deletions express/client.py

This file was deleted.

51 changes: 51 additions & 0 deletions express/config.example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"name": "nickname",
"check_versions_on_startup": true,
"bots": [
{
"name": "bot1",
"username": "username",
"password": "password",
"api_key": "111AA1111AAAA11A1A11AA1AA1AAA111",
"secrets": {
"steamid": "76511111111111111",
"shared_secret": "Aa11aA1+1aa1aAa1a=",
"identity_secret": "aA11aaaa/aa11a/aAAa1a1="
},
"options": {
"accept_donations": true,
"decline_bad_offers": false,
"decline_trade_hold": true,
"decline_scam_offers": true,
"allow_craft_hats": true,
"save_trades": true,
"poll_interval": 30,
"owners": [
"76511111111111111",
"76522222222222222"
]
}
},
{
"name": "bot2",
"username": "username2",
"password": "password2",
"api_key": "111AA1111AAAA11A1A11AA1AA1AAA111",
"secrets": {
"steamid": "76511111111111111",
"shared_secret": "Aa11aA1+1aa1aAa1a=",
"identity_secret": "aA11aaaa/aa11a/aAAa1a1="
},
"options": {
"accept_donations": true,
"decline_bad_offers": false,
"decline_trade_hold": false,
"decline_scam_offers": false,
"allow_craft_hats": false,
"save_trades": true,
"poll_interval": 60,
"database": "bot2database"
}
}
]
}
28 changes: 0 additions & 28 deletions express/config.py

This file was deleted.

Loading

0 comments on commit 0eec359

Please sign in to comment.