Skip to content

Commit 8701071

Browse files
authored
Migrate README to GitHub Wikis
1 parent 55e14b1 commit 8701071

File tree

1 file changed

+1
-274
lines changed

1 file changed

+1
-274
lines changed

README.md

+1-274
Original file line numberDiff line numberDiff line change
@@ -2,283 +2,10 @@
22

33
A [customizable](/config/template_config.toml), [multilanguage](/strings) Telegram shop bot with [Telegram Payments support](https://core.telegram.org/bots/payments)!
44

5-
## Demo
6-
7-
Send a message to [@greedtestbot](https://t.me/greedtestbot) on Telegram to view a demo of the bot in action!
8-
9-
Use the special credit card number `4242 4242 4242 4242` to add unlimited credit to your account.
10-
11-
## Screenshots
5+
\[ [**Documentation**](https://github.com/Steffo99/greed/wiki) | [Support](https://github.com/Steffo99/greed/issues/new/choose) \]
126

137
![](https://i.imgur.com/FdT2tRV.png)
148

159
![](https://i.imgur.com/rDYWdUB.png)
1610

1711
![](https://i.imgur.com/9plMzO6.png)
18-
19-
## Installation via Docker
20-
21-
This installation procedure assumes you are on a system with `docker` installed, with a supported CPU architecture.
22-
23-
### Requirements
24-
25-
* [Docker Engine](https://docs.docker.com/get-docker/)
26-
* An Internet connection
27-
* A Telegram bot token (obtainable at [@Botfather](https://t.me/Botfather))
28-
* A payment provider token (obtainable by [connecting a provider with your bot](https://t.me/Botfather))
29-
30-
### Steps
31-
32-
1. Run a container using the project's Docker image:
33-
```console
34-
# docker run --volume "$(pwd)/config:/etc/greed" --volume "$(pwd)/strings:/usr/src/greed/strings" --volume "$(pwd)/data:/var/lib/greed" ghcr.io/steffo99/greed
35-
```
36-
37-
2. Edit the configuration file `config.toml` that was created in the `strings` directory, adding your bot and payment tokens to it:
38-
```console
39-
# nano config/config.toml
40-
```
41-
(Press **Ctrl+X** and then two times **Enter** to save and quit `nano`.)
42-
43-
3. _Optional:_ customize the files in the `strings` folder for custom messages.
44-
45-
4. Start the bot:
46-
```console
47-
python -OO core.py
48-
```
49-
50-
5. Open Telegram, and send a `/start` command to your bot to be automatically promoted to 💼 Manager.
51-
52-
6. Stop the bot by pressing **Ctrl+C**.
53-
54-
### Running the bot
55-
56-
After the installation, to run the bot, you'll need to:
57-
58-
1. Run its Docker container from the same directory you installed it from:
59-
```console
60-
# docker run --volume "$(pwd)/config:/etc/greed" --volume "$(pwd)/strings:/usr/src/greed/strings" --volume "$(pwd)/data:/var/lib/greed" ghcr.io/steffo99/greed
61-
```
62-
63-
### Keep the bot running
64-
65-
If you want to keep the bot open even after you closed your terminal window, you'll need to pass the appropriate arguments to the docker command:
66-
67-
1. Set the Docker container to always restart and to detach on successful start:
68-
```console
69-
# docker run --detach --restart always --volume "$(pwd)/config:/etc/greed" --volume "$(pwd)/strings:/usr/src/greed/strings" --volume "$(pwd)/data:/var/lib/greed" ghcr.io/steffo99/greed
70-
```
71-
72-
### Updating
73-
74-
To update the bot, run the following commands:
75-
76-
1. Find the ID of the Docker container of the bot:
77-
```console
78-
# docker container ls
79-
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
80-
abcdefabcdef ghcr.io/steffo99/greed "python -OO core.py" 6 seconds ago Up Less than a second relaxed_hypatia
81-
```
82-
83-
2. Stop the Docker container of the bot:
84-
```console
85-
# docker container stop abcdefabcdef
86-
```
87-
88-
3. Remove the Docker container of the bot:
89-
```console
90-
# docker container rm abcdefabcdef
91-
```
92-
93-
4. Pull the latest Docker image of the bot:
94-
```console
95-
# docker pull ghcr.io/steffo99/greed:latest
96-
```
97-
98-
5. Restart the bot with the newly downloaded image:
99-
```console
100-
# docker run --detach --restart always --volume "$(pwd)/config:/etc/greed" --volume "$(pwd)/strings:/usr/src/greed/strings" --volume "$(pwd)/data:/var/lib/greed" ghcr.io/steffo99/greed
101-
```
102-
103-
## Installation from source
104-
105-
This installation procedure assumes you are on a Linux system, using `bash` and have `python3.8` installed.
106-
107-
### Requirements
108-
109-
* [Git](https://git-scm.com/)
110-
* [Python 3.6 (or higher)](https://www.python.org/)
111-
* An Internet connection
112-
* A Telegram bot token (obtainable at [@Botfather](https://t.me/Botfather))
113-
* A payment provider token (obtainable by [connecting a provider with your bot](https://t.me/Botfather))
114-
115-
Consider renting a VPS to host the bot on; a cheap one should do, as greed is pretty lightweight! :)
116-
117-
### Steps
118-
119-
1. Download the project files by running:
120-
```console
121-
git clone https://github.com/Steffo99/greed.git
122-
```
123-
124-
2. Enter the newly created folder:
125-
```console
126-
cd greed
127-
```
128-
129-
3. Create a new virtualenv:
130-
```console
131-
python3.8 -m venv venv
132-
```
133-
134-
4. Activate the virtualenv:
135-
```console
136-
source venv/bin/activate
137-
```
138-
139-
5. Install the project requirements:
140-
```console
141-
pip install -r requirements.txt
142-
```
143-
144-
6. _Optional:_ For colored console output, install [coloredlogs](https://pypi.org/project/coloredlogs/):
145-
```console
146-
pip install coloredlogs
147-
```
148-
149-
7. Generate the configuration file:
150-
```console
151-
python -OO core.py
152-
```
153-
154-
8. Edit the configuration file `config.toml`, adding your bot and payment tokens to it:
155-
```console
156-
nano config/config.toml
157-
```
158-
(Press **Ctrl+X** and then two times **Enter** to save and quit `nano`.)
159-
160-
9. _Optional:_ customize the files in the `strings` folder for custom messages.
161-
162-
10. Start the bot:
163-
```console
164-
python -OO core.py
165-
```
166-
167-
11. Open Telegram, and send a `/start` command to your bot to be automatically promoted to 💼 Manager.
168-
169-
12. Stop the bot by pressing **Ctrl+C**.
170-
171-
### Running the bot
172-
173-
After the installation, to run the bot, you'll need to:
174-
175-
1. Activate the virtualenv (if it's not already activated in the current console session):
176-
```bash
177-
source venv/bin/activate
178-
```
179-
180-
2. Start the bot:
181-
```bash
182-
python -OO core.py
183-
```
184-
185-
### Keep the bot running
186-
187-
If you want to keep the bot open even after you closed your terminal window, you'll need to use some external program.
188-
189-
Some of them are:
190-
191-
- `screen` (easier, but doesn't restart automatically)
192-
- `systemd` (recommended, but more difficult)
193-
194-
#### `screen`
195-
196-
1. Open a `screen` that will be running the bot with the following command:
197-
```bash
198-
screen venv/bin/python -OO core.py
199-
```
200-
To safely detach the screen, press Ctrl+A and then Ctrl+D.
201-
202-
#### `systemd`
203-
204-
Assuming you downloaded `greed` in `/srv/greed`:
205-
206-
1. Create a new user named `greed`:
207-
```bash
208-
useradd greed --system
209-
```
210-
211-
2. Give ownership of the greed folder you downloaded earlier to the `greed` user:
212-
```bash
213-
chown -R greed: /srv/greed
214-
```
215-
216-
3. Create a new file in `/etc/systemd/system` named `bot-greed.service` with the following contents:
217-
```ini
218-
[Unit]
219-
Name=bot-greed
220-
Description=Greed Bot
221-
Wants=network-online.target
222-
After=network-online.target nss-lookup.target
223-
224-
[Service]
225-
Type=exec
226-
User=greed
227-
WorkingDirectory=/srv/greed
228-
ExecStart=/srv/greed/venv/bin/python -OO /srv/greed/core.py
229-
Environment=PYTHONUNBUFFERED=1
230-
231-
[Install]
232-
WantedBy=multi-user.target
233-
```
234-
235-
4. Start the bot-greed service:
236-
```bash
237-
systemctl start bot-greed
238-
```
239-
240-
5. If everything goes well, enable the bot-greed service, so it will automatically start on a reboot:
241-
```bash
242-
systemctl enable bot-greed
243-
```
244-
245-
### Updating
246-
247-
To update the bot, run the following commands:
248-
249-
```bash
250-
git stash
251-
git pull
252-
git stash pop
253-
```
254-
255-
> If you're using an older version of greed, you may need to recreate the configuration, as greed won't use `config.ini` anymore and will use `config.toml` instead.
256-
257-
## Usage
258-
259-
All features can be accessed through the Telegram bot chat.
260-
261-
As a 💼 Manager, you can add new products, check the placed orders, create new transactions and generate .csv log files.
262-
You can also add additional 💼 Managers.
263-
264-
Users will be able to add credit to their wallet, place orders and contact you in case they require assistance.
265-
266-
## Documentation and help
267-
268-
If you find a bug, have an idea for a new feature or just require help with `greed`, please [post an issue](https://github.com/Steffo99/greed/issues/new) or [open a discussion](https://github.com/Steffo99/greed/discussions/new) on GitHub, or, if GitHub is blocked in your country, send me an email at [ste.pigozzi@gmail.com](mailto:ste.pigozzi@gmail.com)!
269-
270-
If you can read Italian, you can try to read the [paper](https://docs.google.com/document/d/1f4MKVr0B7RSQfWTSa_6ZO0LM4nPpky_GX_qdls3EHtQ/edit?usp=sharing) I wrote about greed for my final High School exam.
271-
272-
If you are proficient in Python, you can also try reading the code. Most of the bot interactions can be found in the [`worker.py`](worker.py) file, so try to have a look there.
273-
274-
## Forks
275-
276-
Some people made a copy of Greed and added or changed some things to it (they made a _fork_).
277-
These forks are listed below.
278-
279-
> Please note that @Steffo99, the main developer of `greed`, does not endorse any of these forks.
280-
> **Do not file bug reports here for bugs in a fork!**
281-
282-
### Bitcoin - Blockonomics
283-
284-
[DarrenWestwood](https://github.com/DarrenWestwood) is currently maintaining a [`greed`](https://github.com/DarrenWestwood/greed) fork adding **Bitcoin support** through [Blockonomics](https://www.blockonomics.co/).

0 commit comments

Comments
 (0)