Skip to content

Commit

Permalink
Added simple code
Browse files Browse the repository at this point in the history
  • Loading branch information
stupidcucumber committed Nov 28, 2023
1 parent 883bcd7 commit cd2bc99
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 1 deletion.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
config.yaml
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Introduction
This bot is intended to serve as a SecretSanta randomizer to bring people around the world! It's idea is very simple: user can create a group and get special id of that group. After obtaining Id user automatically joins the initiated group and can share this id with others.

While creating group, admin specifies time for the timer. When time passed all members of the group who specified the valid information about their interests will get information about a person to whome they will give present!

Merry X-mas!

# Setting up
First you will need to install all required packages. We strongly advise to do it in a newly created environment using conda/virtualenv. To to this run the following command:
```
python3 -m pip install -r requirements.txt
```

# Implementation

## Database
For storing information about customers we use PostgreSQL.
3 changes: 3 additions & 0 deletions config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
database:
ip: 127.0.0.1
port: 5051
21 changes: 21 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,23 @@
import telebot
import yaml
import argparse

def parse_arguments():
parser = argparse.ArgumentParser()

parser.add_argument('--config-path', type=str, default='./config.yaml',
help='Path to the file, where base configuration is being stored.')
parser.add_argument('--api-key', type=str, required=True,
help='API-key of your bot.')

return parser.parse_args()


if __name__ == '__main__':
args = parse_arguments()
bot = telebot.TeleBot(args.api_key)

with open(args.config_path) as config:
config = yaml.safe_load(config)

print(config)
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pyTelegramBotAPI
pyyaml

0 comments on commit cd2bc99

Please sign in to comment.